• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!

GUI Trigger not functioning

Status
Not open for further replies.
Level 6
Joined
Jul 13, 2006
Messages
140
Now, for some reason, the picking every units of type and do actions part of this trigger doesn't work.

  • Untitled Trigger 001
    • Events
      • Time - Every 60.00 seconds of game time
    • Conditions
    • Actions
      • Sound - Play GoodJob <gen>
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in (Units of type Region) and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked unit) has an item of type Unstable) Equal to True
            • Then - Actions
              • Set Num = (Random integer number between 0 and 2)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • Num Equal to 2
                • Then - Actions
                  • Set AMPoint = (Position of (Picked unit))
                  • Unit - Create 3 Footman for Neutral Hostile at AMPoint facing Default building facing degrees
                  • Unit - Create 3 Rifleman for Neutral Hostile at AMPoint facing Default building facing degrees
                  • Custom script: call RemoveLocation(udg_AMPoint)
                • Else - Actions
                  • Do nothing
            • Else - Actions
              • Do nothing
Also, this trigger doesn't work, mainly because I couldn't find a fitting third condition since the current one is pretty much nonsense

  • region
    • Events
      • Unit - A unit Begins casting an ability
    • Conditions
      • And - All (Conditions) are true
        • Conditions
          • (Ability being cast) Equal to Hostile Region
          • (Unit-type of (Target unit of ability being cast)) Equal to Region
          • ((Owner of (Casting unit)) Current gold) Equal to (Min(20, 0))
    • Actions
      • Item - Remove (Item carried by (Target unit of ability being cast) of type Hostile)
      • Item - Remove (Item carried by (Target unit of ability being cast) of type Friendly)
      • Item - Remove (Item carried by (Target unit of ability being cast) of type Neutral)
      • Set AMPoint = (Position of (Target unit of ability being cast))
      • Item - Create Hostile at AMPoint
      • Hero - Give (Last created item) to (Target unit of ability being cast)
      • Player - Add -20 to (Owner of (Casting unit)) Current gold
      • Custom script: call RemoveLocation(udg_AMPoint)
So, I just wonder if anybody could help me fix these two triggers (saying if they leak or not and at what place can also be of help).
 
Level 28
Joined
Jan 26, 2007
Messages
4,789
1) Did you try adding game messages to check this? (even if the unit has the locust ability, it should still be picked), perhaps you just didn't turn off "Fixed Random Seed" and you weren't lucky, so it gave the wrong number again and again (because it's not random anymore with "Fixed Random Seed", which is on by standard I believe).

2) What is it supposed to do? The third condition is indeed bullshit (it checks if the player's gold = 0 or not, the entire "min"-part doesn't make sense, as they're not variables).
But then why did you add it? What third condition would you like?
 
Level 6
Joined
Jul 13, 2006
Messages
140
1) Did you try adding game messages to check this? (even if the unit has the locust ability, it should still be picked), perhaps you just didn't turn off "Fixed Random Seed" and you weren't lucky, so it gave the wrong number again and again (because it's not random anymore with "Fixed Random Seed", which is on by standard I believe).

2) What is it supposed to do? The third condition is indeed bullshit (it checks if the player's gold = 0 or not, the entire "min"-part doesn't make sense, as they're not variables).
But then why did you add it? What third condition would you like?

1) I have tried with making it to random number between 2 and 2 and it still didn't work. So I have no idea what is wrong.

2)The third condition is supposed to check if the player has 20g or not and then run the trigger or else it does nothing.
So it should be: if player has 20 gold or more, but that is not a trigger action, which gives me a headache in solving this.
 
Level 9
Joined
Nov 4, 2007
Messages
931
Errr how about instead of Equal to you try Greater than or Equal to for your third condition? And also you're first trigger has a Unit group checking if the Unit Type is Region... What does that mean?
 
Level 9
Joined
Nov 4, 2007
Messages
931
Your use of the word action is very confusing, just so I'm clear, are we talking about this:
  • And - All (Conditions) are true
    • Conditions
    • (Ability being cast) Equal to Hostile Region
    • (Unit-type of (Target unit of ability being cast)) Equal to Region
    • ((Owner of (Casting unit)) Current gold) Equal to (Min(20, 0))
You're third function can simply be this:
  • ((Owner of (Casting unit)) Current gold) Greater than or equal to 20
If all you're checking with #3 that the gold if the person is at least 20.
 
Level 6
Joined
Jul 13, 2006
Messages
140
Your use of the word action is very confusing, just so I'm clear, are we talking about this:
  • And - All (Conditions) are true
    • Conditions
    • (Ability being cast) Equal to Hostile Region
    • (Unit-type of (Target unit of ability being cast)) Equal to Region
    • ((Owner of (Casting unit)) Current gold) Equal to (Min(20, 0))
You're third function can simply be this:
  • ((Owner of (Casting unit)) Current gold) Greater than or equal to 20
If all you're checking with #3 that the gold if the person is at least 20.

Yeah, like that.
But the only thing is: I have no idea which condition that is, heh.
Although the main trigger that I need help with is the first one which refuses to work.

Edit: Forget about the second sentence, found the right action, heh.
But I still need help with the first trigger as it still refuses to respond (except the sound part)
 
Level 11
Joined
Jan 25, 2009
Messages
572
First of all in the first trigger called "Untitled Trigger 001" you are not leaking but you are using memory that you shouldn't use cuz the
  • Do nothing
takes memory and if you remove that one, the trigger will still be the same. But that's not very important.

Now to the real problem.

In the first trigger i can't see any problems but in the second i can see some.
1st. The condition as i see it should be like this:
  • Conditions
    • ((Owner of (Triggering unit)) Current gold) Greater than or equal to 20
2nd. The Action that sets the current gold of the casting player to -20 shoul be like this...

  • Player - Set (Owner of (Triggering unit)) Current gold to (((Owner of (Triggering unit)) Current gold) - 10)
  • Custom script: To set this one use the func called "Arithmetic" in the list. :)
EDIT:
Now i can see the prob in the first trigger. You know that the "random integer number between 0 and 2" is like 0/2. In that case there is a 0% chance to do all the actions that u want to do. But if you want to have 50% you should use between 1 and 2 and if you want 25% you should use 1 and 4 and so on. You can calculate that in the Calculator on you'r computer. Like this: 1/4=0.25 that means 25% If you use a Real instead of Iteger you can be more specific. Like this 0.01/0.05 = 0.2 That means 20%
Fix that and it should work. If not comment again :wink:

//Tom (Svenskunganka in-game) :grin:
 
Level 6
Joined
Jul 13, 2006
Messages
140
First of all in the first trigger called "Untitled Trigger 001" you are not leaking but you are using memory that you shouldn't use cuz the
  • Do nothing
takes memory and if you remove that one, the trigger will still be the same. But that's not very important.

Now to the real problem.

In the first trigger i can't see any problems but in the second i can see some.
1st. The condition as i see it should be like this:
  • Conditions
    • ((Owner of (Triggering unit)) Current gold) Greater than or equal to 20
2nd. The Action that sets the current gold of the casting player to -20 shoul be like this...

  • Player - Set (Owner of (Triggering unit)) Current gold to (((Owner of (Triggering unit)) Current gold) - 10)
  • Custom script: To set this one use the func called "Arithmetic" in the list. :)
EDIT:
Now i can see the prob in the first trigger. You know that the "random integer number between 0 and 2" is like 0/2. In that case there is a 0% chance to do all the actions that u want to do. But if you want to have 50% you should use between 1 and 2 and if you want 25% you should use 1 and 4 and so on. You can calculate that in the Calculator on you'r computer. Like this: 1/4=0.25 that means 25% If you use a Real instead of Iteger you can be more specific. Like this 0.01/0.05 = 0.2 That means 20%
Fix that and it should work. If not comment again :wink:

//Tom (Svenskunganka in-game) :grin:

After testing, it still doesn't work.
 
Level 28
Joined
Jan 26, 2007
Messages
4,789
EDIT:
Now i can see the prob in the first trigger. You know that the "random integer number between 0 and 2" is like 0/2. In that case there is a 0% chance to do all the actions that u want to do. But if you want to have 50% you should use between 1 and 2 and if you want 25% you should use 1 and 4 and so on. You can calculate that in the Calculator on you'r computer. Like this: 1/4=0.25 that means 25% If you use a Real instead of Iteger you can be more specific. Like this 0.01/0.05 = 0.2 That means 20%
Fix that and it should work. If not comment again :wink:

//Tom (Svenskunganka in-game) :grin:
No, it's a random integer between 0 and 2 (0, 1 and 2), so the chance would be 1/3, not 0/2.
If you say a random number between 5 to 6, it's a 50% chance (either 5 or 6, 2 integers, 1/2), not a (5/6 x 100) = 83% chance... your calculation method makes some sense, but it's really not what it says ^^


Anyway, did you try adding game messages?
Add a game message behind every action to see if it worked or not, you can add "Game - Display to (All Player) the text: String(Num)" after you set the variable "num", then you can add a game message that says "If/then/else = true" right in front of the set location, so you can check whether it really didn't do anything, ...
It's very easy to see where a trigger bugs that way and it makes it easier for everyone out here.
 
Level 11
Joined
Jan 25, 2009
Messages
572
No, it's a random integer between 0 and 2 (0, 1 and 2), so the chance would be 1/3, not 0/2.
If you say a random number between 5 to 6, it's a 50% chance (either 5 or 6, 2 integers, 1/2), not a (5/6 x 100) = 83% chance... your calculation method makes some sense, but it's really not what it says ^^


Anyway, did you try adding game messages?
Add a game message behind every action to see if it worked or not, you can add "Game - Display to (All Player) the text: String(Num)" after you set the variable "num", then you can add a game message that says "If/then/else = true" right in front of the set location, so you can check whether it really didn't do anything, ...
It's very easy to see where a trigger bugs that way and it makes it easier for everyone out here.

Well so then the chance to do it is 33,33% chance. Well i cant figure out the problem then. He would mby try to remove the "call bj wantDestroyGroup = true" and replace that with an "Call DestroyGroup" in the end of the trigger. the bj wantDestroyGroup is NOT 100% safe in some cases.
 
Level 11
Joined
Jan 25, 2009
Messages
572
Sorry for doubble post but i think i've figured out the problem :) MAYBE. I think it's in the unit group. You picks every unit of type "Region" in WHAT??? Mby that's the problem... You doesn't pick the unit in any point or region just picks a unit. Mby trying this would help.
  • Unit Group - Pick every unit in (Units in (Entire map) matching ((Unit-type of (Picked unit)) Equal to Region)) and do (Actions)
    • Loop - Actions
    • ((The actions u want to have))
 
Level 6
Joined
Jul 13, 2006
Messages
140
Sorry for doubble post but i think i've figured out the problem :) MAYBE. I think it's in the unit group. You picks every unit of type "Region" in WHAT??? Mby that's the problem... You doesn't pick the unit in any point or region just picks a unit. Mby trying this would help.
  • Unit Group - Pick every unit in (Units in (Entire map) matching ((Unit-type of (Picked unit)) Equal to Region)) and do (Actions)
    • Loop - Actions
    • ((The actions u want to have))

Nope, didn't work, not that nor removing the custom script.
 
Level 11
Joined
Jan 25, 2009
Messages
572
Well if you've set all to what i've told... It should not be any problems... And now i see something that you may have forgotten into the object/world editor... Are you 100% sure that the "picked unit" has the item "Unstable"? That mby is the problem.
 
Status
Not open for further replies.
Top