# Trigger help please

Status
Not open for further replies.

#### HelloFlighty

Level 8
Why won't the units move?
• Moving them
• Events
• Time - Every 5.00 seconds of game time
• Conditions
• Actions
• Set Island1revinteger = (Random real number between 1.00 and 3.00)
• If (All Conditions are True) then do (Then Actions) else do (Else Actions)
• If - Conditions
• (Random real number between 1.00 and 3.00) Equal to 1.00
• Then - Actions
• Unit Group - Order (Random 1 units from Revenant) to Move To (Random point in Revenant1 <gen>)
• Else - Actions
• If (All Conditions are True) then do (Then Actions) else do (Else Actions)
• If - Conditions
• (Random real number between 1.00 and 3.00) Equal to 3.00
• Then - Actions
• Unit Group - Order (Random 1 units from Revenant) to Move To (Random point in Revenant2 <gen>)
• Else - Actions
• If (All Conditions are True) then do (Then Actions) else do (Else Actions)
• If - Conditions
• (Random real number between 1.00 and 3.00) Equal to 3.00
• Then - Actions
• Unit Group - Order (Random 1 units from Revenant) to Move To (Random point in Revenant3 <gen>)
• Else - Actions
• Do nothing

#### Fruit Forest

Level 11
Why won't the units move?
Because the real value from 1.00 to 3.00 contains immense number of values like 1.01, 1.02, 1.03 etc. YOu should use integers.
Also I see a mistake: If equal to 1 then do action, if equal to 3 then do action, and AGAIN if qeual to 3 then do action, probably you missed 2 somewhere.

#### HelloFlighty

Level 8
Because the real value from 1.00 to 3.00 contains immense number of values like 1.01, 1.02, 1.03 etc. YOu should use integers.
Also I see a mistake: If equal to 1 then do action, if equal to 3 then do action, and AGAIN if qeual to 3 then do action, probably you missed 2 somewhere.
Oh thank you, i just didn't know what the difference between "real" and "integer" was, but thank you for this info

#### HelloFlighty

Level 8
Because the real value from 1.00 to 3.00 contains immense number of values like 1.01, 1.02, 1.03 etc. YOu should use integers.
Also I see a mistake: If equal to 1 then do action, if equal to 3 then do action, and AGAIN if qeual to 3 then do action, probably you missed 2 somewhere.
How can i make it so that a shop will only accept a certain item, on my map as an example, there is a character that will give you a quest and will ask you to find a certain item, i want you to only be able to sell that specific item to him, no others, it this possible?

#### Dr Super Good

Spell Reviewer
Level 64
Why won't the units move?
The probability logic is probably not what you intended (wrong). Also you only move 1 out of possibly many units. You also leak a lot, but that is not directly related to the trigger not working.
Also I see a mistake: If equal to 1 then do action, if equal to 3 then do action, and AGAIN if qeual to 3 then do action, probably you missed 2 somewhere.
That is still not the correct logic.

Oh thank you, i just didn't know what the difference between "real" and "integer" was, but thank you for this info
What you do is place the 3 regions (JASS rects) into an array in index 0, 1 and 2 (or 1, 2 and 3 if you prefer). Then order the unit to a random point in the region of a random index in the range of 0 to 2 (or 1 to 3 if so preferred) of that array. This way no logical tests are required and the unit will be sent to a random region each time.

Be aware the "(Random 1 units from Revenant)" function of GUI leaks a handle index unless the local declared local handle variable reference counter leak on return bug was fixed with patch 1.27b (no one has said it was so I assume its still a problem).

How can i make it so that a shop will only accept a certain item, on my map as an example, there is a character that will give you a quest and will ask you to find a certain item, i want you to only be able to sell that specific item to him, no others, it this possible?
Intercept the sell orders towards him and abort any that are not for the specific item, possibly displaying a message to inform the player he is not a normal shop. Sale orders should be an order targeting a unit. I suspect JASS might be needed as the order is possibly a raw ID (no string or constant for it in GUI). Some people say pausing, ordering to stop and then unpausing should work to cancel the order.

#### HelloFlighty

Level 8
The probability logic is probably not what you intended (wrong). Also you only move 1 out of possibly many units. You also leak a lot, but that is not directly related to the trigger not working.

That is still not the correct logic.

What you do is place the 3 regions (JASS rects) into an array in index 0, 1 and 2 (or 1, 2 and 3 if you prefer). Then order the unit to a random point in the region of a random index in the range of 0 to 2 (or 1 to 3 if so preferred) of that array. This way no logical tests are required and the unit will be sent to a random region each time.

Be aware the "(Random 1 units from Revenant)" function of GUI leaks a handle index unless the local declared local handle variable reference counter leak on return bug was fixed with patch 1.27b (no one has said it was so I assume its still a problem).

Intercept the sell orders towards him and abort any that are not for the specific item, possibly displaying a message to inform the player he is not a normal shop. Sale orders should be an order targeting a unit. I suspect JASS might be needed as the order is possibly a raw ID (no string or constant for it in GUI). Some people say pausing, ordering to stop and then unpausing should work to cancel the order.
EDIT: how do i assign an index of 1 or 2 to two units that spawn, the trigger below will check whether those units 1 and 2 are alive and if not, will spawn 2 units, i need it to assign the numbers 1 and 2 as their index, i don't know how to do it :/
• SpawningRevs
• Events
• Time - Every 1.00 seconds of game time
• Conditions
• Actions
• If (All Conditions are True) then do (Then Actions) else do (Else Actions)
• If - Conditions
• (Revenant[(Max(1, 2))] is alive) Equal to True
• Then - Actions
• Do nothing
• Else - Actions
• Floating Text - Create floating text that reads working above Worgen 0000 <gen> with Z offset 0.00, using font size 10.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency

Last edited:
Status
Not open for further replies.

Replies
8
Views
1K
Replies
5
Views
737
Replies
0
Views
348
Replies
14
Views
655
Replies
0
Views
728