HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Simple Arrow-change system - Failure

05-11-2007, 10:21 PM#1
Centreri
I'm trying to create a very simple system where a 'control center' building allows the use of customization abilities and the unit itself manipulates these.

The building has the abilities 'Coordinate Arrow One' and 'Coordinate Arrow Two', which allow the user to change between four (more to come) shot types via dialog. It saves it in a variable array of up to 24, first 12 for Arrow One, second twelve for Arrow Two. There's also a 12-value array (integer) that determines which of the two shots is currently being used. When the dialog button is clicked, the triggers see if the unit is using shot one or shot two, and depending on the shot and shot being edited, they either simply change the variables or change ability and variable. I have an array for a dialog and a version of the button array for each player. I like arrays :P. This is that trigger:

Trigger:
Edit Shot1 Response1
Collapse Events
Dialog - A dialog button is clicked for ChangeShot[1]
Conditions
Collapse Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
(Clicked dialog button) Equal to ChangeShotButtonOverall[(Player number of (Triggering player))]
Collapse Then - Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
CurrentShot[(Player number of (Triggering player))] Equal to 1
Collapse Then - Actions
Unit - Remove Shot1[(Player number of (Triggering player))] from HeroUnit[(Player number of (Triggering player))]
Set Shot1[(Player number of (Triggering player))] = Shoot Arrow (Overall)
Unit - Add Shot1[(Player number of (Triggering player))] to HeroUnit[(Player number of (Triggering player))]
Collapse Else - Actions
Set Shot1[(Player number of (Triggering player))] = Shoot Arrow (Overall)
Collapse Else - Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
(Clicked dialog button) Equal to ChangeShotButtonCooldown[(Player number of (Triggering player))]
Collapse Then - Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
CurrentShot[(Player number of (Triggering player))] Equal to 1
Collapse Then - Actions
Unit - Remove Shot1[(Player number of (Triggering player))] from HeroUnit[(Player number of (Triggering player))]
Set Shot1[(Player number of (Triggering player))] = Shoot Arrow (Cooldown)
Unit - Add Shot1[(Player number of (Triggering player))] to HeroUnit[(Player number of (Triggering player))]
Collapse Else - Actions
Set Shot1[(Player number of (Triggering player))] = Shoot Arrow (Cooldown)
Collapse Else - Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
(Clicked dialog button) Equal to ChangeShotButtonRange[(Player number of (Triggering player))]
Collapse Then - Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
CurrentShot[(Player number of (Triggering player))] Equal to 1
Collapse Then - Actions
Unit - Remove Shot1[(Player number of (Triggering player))] from HeroUnit[(Player number of (Triggering player))]
Set Shot1[(Player number of (Triggering player))] = Shoot Arrow (Range)
Unit - Add Shot1[(Player number of (Triggering player))] to HeroUnit[(Player number of (Triggering player))]
Collapse Else - Actions
Set Shot1[(Player number of (Triggering player))] = Shoot Arrow (Range)
Collapse Else - Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
(Clicked dialog button) Equal to ChangeShotButtonSpeed[(Player number of (Triggering player))]
Collapse Then - Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
CurrentShot[(Player number of (Triggering player))] Equal to 1
Collapse Then - Actions
Unit - Remove Shot1[(Player number of (Triggering player))] from HeroUnit[(Player number of (Triggering player))]
Set Shot1[(Player number of (Triggering player))] = Shoot Arrow (Speed)
Unit - Add Shot1[(Player number of (Triggering player))] to HeroUnit[(Player number of (Triggering player))]
Collapse Else - Actions
Set Shot1[(Player number of (Triggering player))] = Shoot Arrow (Speed)
Collapse Else - Actions
Do nothing
Here's the dialog trigger:
Trigger:
Edit Shot1
Collapse Events
Unit - A unit Starts the effect of an ability
Collapse Conditions
(Ability being cast) Equal to Coordinate Arrow One
Collapse Actions
Dialog - Change the title of ChangeShot[(Player number of (Triggering player))] to Choose ability of s...
Dialog - Create a dialog button for ChangeShot[(Player number of (Triggering player))] labelled Overall Shot
Set ChangeShotButtonOverall[(Player number of (Triggering player))] = (Last created dialog Button)
Dialog - Create a dialog button for ChangeShot[(Player number of (Triggering player))] labelled Range Shot
Set ChangeShotButtonRange[(Player number of (Triggering player))] = (Last created dialog Button)
Dialog - Create a dialog button for ChangeShot[(Player number of (Triggering player))] labelled Cooldown Shot
Set ChangeShotButtonCooldown[(Player number of (Triggering player))] = (Last created dialog Button)
Dialog - Create a dialog button for ChangeShot[(Player number of (Triggering player))] labelled Speed Shot
Set ChangeShotButtonSpeed[(Player number of (Triggering player))] = (Last created dialog Button)
Dialog - Show ChangeShot[(Player number of (Triggering player))] for (Triggering player)
And here is the trigger that changes current ability when an ability called Arrow Shift on the main unit is used - it's a simple variable change.
Trigger:
Change Arrows
Collapse Events
Unit - A unit Finishes casting an ability
Collapse Conditions
(Ability being cast) Equal to Arrow Shift
Collapse Actions
Wait 2.00 seconds
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
CurrentShot[(Player number of (Triggering player))] Equal to 1
Collapse Then - Actions
Set CurrentShot[(Player number of (Triggering player))] = 2
Unit - Remove Shot1[(Player number of (Triggering player))] from (Casting unit)
Unit - Add Shot2[(Player number of (Triggering player))] to (Casting unit)
Special Effect - Create a special effect at (Position of (Casting unit)) using Abilities\Spells\Demon\DarkPortal\DarkPortalTarget.mdl
Special Effect - Destroy (Last created special effect)
Collapse Else - Actions
Set CurrentShot[(Player number of (Triggering player))] = 1
Unit - Remove Shot2[(Player number of (Triggering player))] from (Casting unit)
Unit - Add Shot1[(Player number of (Triggering player))] to (Casting unit)
Special Effect - Create a special effect at (Position of (Casting unit)) using Abilities\Spells\Demon\DarkPortal\DarkPortalTarget.mdl
Special Effect - Destroy (Last created special effect)

Problems:
For some reason, clicking on one ability (I currently have both on one unit for testing purposes) also uses the other. I'm also quite sure that the ability doesn't change. Also, every time I use the dialog ability, it adds on the previous dialog - in essense, it says 'Overall, Range, Cooldown, Speed, Overcall, Range, Cooldown, Speed, and keeps on adding the four every time.

Also, as you may have noticed, the way I organized it requires me to make 24 of the big triggers - two for each player, depending on whether shot one or two is being altered. I didn't want to do it this way, but this editor refuses to let me continue without specifying the index of the array, so if there's any way to compress that into one or two triggers, that would be nice.

In other words, nothing works. Any aid would be greatly appreciated. A lot. And a bit more. I promise.
05-12-2007, 11:29 AM#2
Histenchist
Set ChangeShotButtonOverall[(Player number of (TRIGGERING PLAYER?!))] = (Last created dialog Button)... Wrong in trigger 2 (the dialog)
I think it should be the owner of triggering unit.
05-12-2007, 12:48 PM#3
Centreri
It's the same thing. If the player's unit casts an ability, I can reference that by using 'Triggering Player'. Worked before.
05-12-2007, 12:50 PM#4
Troll-Brain
This is a player unit event (convert it in jass and see how the generic unit event works )
So triggering player will work

By the way, triggering player will work as well as owner of triggering player, even if it's an single unit event
05-13-2007, 12:44 PM#5
Centreri
Ehh... Is this too long a request to expect assistance in?
05-13-2007, 08:44 PM#6
Pyrogasm
Quote:
Originally Posted by Centreri
For some reason, clicking on one ability (I currently have both on one unit for testing purposes) also uses the other.
Do they have the same OrderId? Are they both based off of the same ability?
05-13-2007, 11:07 PM#7
Centreri
Yeah, I noticed and fixed that already. I also changed it so that it cleared the dialog in the dialog trigger before doing anything else, but for some reason it still keeps adding on 4 dialog buttons.