I have a map in which each player has a ship. This ship has a lot of variables (speed, turn rate, etc.) that are stored as arrays and indexed by the player number. For example, player 2's ship has speed: FlierSpeed[2], with turn rate: Turn[2], and so on.
I recently discovered what should be a bug in my map, but isn't. I'm confused as to why there is no problem. The triggers are very large but here's what happens:
Situation: the player gets a special mission, so I destroy his old ship and create a new one for him.
Trigger 1: the player selects a dialogue box and I first kill his old ship, and then create a new one. I then set up the data to match the new ship: FlierSpeed[2] = new ship's default speed, for example.
Trigger 2: fires every time any unit dies. It erases all the data in the variables, i.e. FlierSpeed[2] = 0.
So here is what I think should happen:
Trigger 1 is fired by the player clicking the dialogue box. It kills his old ship which will queue Trigger 2. But first, it writes in the new ship's data. Then Trigger 2 should fire, and erases the exact same data, setting FlierSpeed[2] = 0, for example.
That's not what happens though. Instead FlierSpeed[2] is still set to the new ship's speed. The position in the array (2 in this example) is stored as the custom value of each ship and is set to the player number (whenever Player 2 gets a new ship its custom value is set to 2). Here are the truncated triggers:
What's happening here? Does the second trigger run in the middle of trigger 1? I would think it would just queue up?
I recently discovered what should be a bug in my map, but isn't. I'm confused as to why there is no problem. The triggers are very large but here's what happens:
Situation: the player gets a special mission, so I destroy his old ship and create a new one for him.
Trigger 1: the player selects a dialogue box and I first kill his old ship, and then create a new one. I then set up the data to match the new ship: FlierSpeed[2] = new ship's default speed, for example.
Trigger 2: fires every time any unit dies. It erases all the data in the variables, i.e. FlierSpeed[2] = 0.
So here is what I think should happen:
Trigger 1 is fired by the player clicking the dialogue box. It kills his old ship which will queue Trigger 2. But first, it writes in the new ship's data. Then Trigger 2 should fire, and erases the exact same data, setting FlierSpeed[2] = 0, for example.
That's not what happens though. Instead FlierSpeed[2] is still set to the new ship's speed. The position in the array (2 in this example) is stored as the custom value of each ship and is set to the player number (whenever Player 2 gets a new ship its custom value is set to 2). Here are the truncated triggers:
-
Sandpeople Button Blastboat
-
Events
- Dialog - A dialog button is clicked for kidnapDialog
-
Conditions
- (Clicked dialog button) Equal to kidnapBlastboat
-
Actions
- Set tempInteger = (Player number of (Triggering player))
- Dialog - Hide kidnapDialog for (Triggering player)
- Unit - Hide Fliers[tempInteger]
- Unit - Kill Fliers[tempInteger]
- -------- -------------------- --------
- -------- Make Blastboat --------
- -------- -------------------- --------
- Set CreationOpenSpot = tempInteger
- Set CreationShipType = Blastboat
- Set CreationPlayerOwner = (Player(CreationOpenSpot))
- Set x = (Center X of SandpeopleExit <gen>)
- Set y = (Center Y of SandpeopleExit <gen>)
- Custom script: call MoveLocation(udg_LocationMove1, udg_x, udg_y)
- Unit - Create 1 CreationShipType for CreationPlayerOwner at LocationMove1 facing CreationAngle degrees
- Set Fliers[CreationOpenSpot] = (Last created unit)
- Unit - Set the custom value of (Last created unit) to CreationOpenSpot
- -------- -------------------- --------
- Set FlierTurn[CreationOpenSpot] = 2.00
- -------- -------------------- --------
- -------- -------------------- --------
-
Events
-
Ship dies
-
Events
- Unit - A unit Dies
-
Conditions
- ((Triggering unit) is A Hero) Not equal to True
-
Actions
- Set DeadUnit = (Triggering unit)
- -------- --------- --------
- Set deathInteger = (Custom value of DeadUnit)
- Set Fliers[deathInteger] = No unit
- Set FlierTurn[deathInteger] = 0.00
-
Events
What's happening here? Does the second trigger run in the middle of trigger 1? I would think it would just queue up?