Simple trigger not working?

Jscooby

New Member
Reaction score
1
Any idea why this is not working...?
Trigger:
  • Kill
    • Events
      • Player - Player 1 (Red) types a chat message containing -kill as An exact match
      • Player - Player 2 (Blue) types a chat message containing -kill as An exact match
      • Player - Player 3 (Teal) types a chat message containing -kill as An exact match
      • Player - Player 4 (Purple) types a chat message containing -kill as An exact match
      • Player - Player 5 (Yellow) types a chat message containing -kill as An exact match
      • Player - Player 6 (Orange) types a chat message containing -kill as An exact match
      • Player - Player 7 (Green) types a chat message containing -kill as An exact match
      • Player - Player 8 (Pink) types a chat message containing -kill as An exact match
      • Player - Player 9 (Gray) types a chat message containing -kill as An exact match
    • Conditions
      • (MG Arena <gen> contains (Triggering unit)) Equal to True
    • Actions
      • Unit - Kill (Triggering unit)
 

Komaqtion

You can change this now in User CP.
Reaction score
469
What unit would you believe to be (Triggering unit) here ? :eek:

I would believe you might want to kill the selected unit or something ? :S
 

Jscooby

New Member
Reaction score
1
still not working :/

Trigger:
  • Kill
    • Events
      • Player - Player 1 (Red) types a chat message containing -kill as An exact match
      • Player - Player 2 (Blue) types a chat message containing -kill as An exact match
      • Player - Player 3 (Teal) types a chat message containing -kill as An exact match
      • Player - Player 4 (Purple) types a chat message containing -kill as An exact match
      • Player - Player 5 (Yellow) types a chat message containing -kill as An exact match
      • Player - Player 6 (Orange) types a chat message containing -kill as An exact match
      • Player - Player 7 (Green) types a chat message containing -kill as An exact match
      • Player - Player 8 (Pink) types a chat message containing -kill as An exact match
      • Player - Player 9 (Gray) types a chat message containing -kill as An exact match
    • Conditions
      • (MG Arena <gen> contains (Picked unit)) Equal to True
    • Actions
      • Unit - Kill (Picked unit)
 

Sui-cookie

You can change this now in User CP.
Reaction score
49
because there is no triggering unit, or picked unit =o

you would have to add the unit to a unit group variable,
then use use a loop action for the units in the unit group, then your standard
Trigger:
  • call DestroyGroup(udg_UltimaGroupOfCompleteDiabolicalOwnageness)


-if you wanted it to be a picked unit. (which i would recommend, because it much more flexible.)

-btw, you cant use "triggering unit" because a unit isnt triggering the action :x its a player. The only thing you could do involving "Triggering w/e" would be like
Trigger:
  • player - Defeat triggering player

or something involving a player...

and you cant use what you have now, the "selected unit" because no unit is selected... as i've said use a unit group ^^ should work fine afterwords.
 

Sim

Forum Administrator
Staff member
Reaction score
534
> still not working :/

It would be quite nice to know what you're trying to do. Really.
 

Jscooby

New Member
Reaction score
1
I have never been really good at variables... :/


What I am trying to do is when a player types -kill their hero will be killed. But the condition is that the unit must be in a specific region. (Note that each player only has one unit, their hero.)

So how would I script that?
 

tommerbob

Minecraft. :D
Reaction score
110
When your hero enters the region, set it to a variable.

Trigger:
  • Set DeadHero = (Entering unit)


Then in your trigger, you would do

Trigger:
  • Unit - Kill DeadHero


You would probably want to make your variable an array so that each player's hero can be referenced.
 

Jscooby

New Member
Reaction score
1
Alright this is what I have, and it works.

But will this only limit it to one hero? I did not select an array. If I do need to what do I need to set it to? (There are 9 player slots)

Trigger:
  • Kill cont
    • Events
      • Unit - A unit enters MG Arena <gen>
    • Conditions
      • ((Triggering unit) is A Hero) Equal to True
    • Actions
      • Set DeadHero = (Entering unit)



And

Trigger:
  • Kill
    • Events
      • Player - Player 1 (Red) types a chat message containing -kill as An exact match
      • Player - Player 2 (Blue) types a chat message containing -kill as An exact match
      • Player - Player 3 (Teal) types a chat message containing -kill as An exact match
      • Player - Player 4 (Purple) types a chat message containing -kill as An exact match
      • Player - Player 5 (Yellow) types a chat message containing -kill as An exact match
      • Player - Player 6 (Orange) types a chat message containing -kill as An exact match
      • Player - Player 7 (Green) types a chat message containing -kill as An exact match
      • Player - Player 8 (Pink) types a chat message containing -kill as An exact match
      • Player - Player 9 (Gray) types a chat message containing -kill as An exact match
    • Conditions
    • Actions
      • Unit - Kill DeadHero
 

tommerbob

Minecraft. :D
Reaction score
110
To make it specific to each player, you would do exactly what you did, but instead of just "DeadHero" variable, make it an array with size 9, like this:

Trigger:
  • Set DeadHero[player number of (owner of (Triggering unit))] = (Entering unit)


And then when you kill the unit, use that same array [player number of (owner of (Triggering unit))]
 

Tyman2007

Ya Rly >.
Reaction score
74
:p Array with size 9 means that it uses 9 units of data in the 8190 units of data available for each instance.

Not recommended to change it to anything but 1 unless dealing with Jass.

Try it with size 1 if you don't believe me that it will work :p

8190 / 9 = 910 total instances.

If you're going to store a HUGE number like 356745.393948583 then size 5 will be the maximum size you would use, primarily X and Y coordinates which are usually only used in jass.

In GUI, X and Y coordinates are truncated to the hundredths, so an X value of 3555.22233222 would be 3555.22, in which a size 5 would just be taking up extra space not needed.

You normally would go by the amount of numbers there are rather than its absolute value.
 

BAkil

New Member
Reaction score
9
This might help?

Alrighty, this should be a solution to your problem.
Now what the following trigger does is:
When any one of nine players types '-kill', the variable UNITGROUP is set to include all units that belong to the triggering player (the player that typed -kill) and IS a hero. Note that this could include none, one or more units depending on how many heroes the player has. There is a way to make it only kill one, just tell me if you want that. The benefit of doing it this way is that you don't have to take the time to set the DeadHero variable and it's arrays manually.
After setting the UNITGROUP, it picks every unit within that group, and kills them.
Afterwards, the information stored in the UNITGROUP variable is erased to avoid any memory leaks.
Here it is:

Trigger:
  • Kill
    • Events
      • Player - Player 1 (Red) types a chat message containing -kill as An exact match
      • Player - Player 2 (Blue) types a chat message containing -kill as An exact match
      • Player - Player 3 (Teal) types a chat message containing -kill as An exact match
      • Player - Player 4 (Purple) types a chat message containing -kill as An exact match
      • Player - Player 5 (Yellow) types a chat message containing -kill as An exact match
      • Player - Player 6 (Orange) types a chat message containing -kill as An exact match
      • Player - Player 7 (Green) types a chat message containing -kill as An exact match
      • Player - Player 8 (Pink) types a chat message containing -kill as An exact match
      • Player - Player 9 (Gray) types a chat message containing -kill as An exact match
    • Conditions
    • Actions
      • Set UNITGROUP = (Units owned by (Triggering player) matching (((Matching unit) is A Hero) Equal to True))
      • Unit Group - Pick every unit in UNITGROUP and do (Unit - Kill (Picked unit))
      • Custom script: call DestroyGroup (udg_UNITGROUP)
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top