need the right trigger (help)

MissKerrigan

Active Member
Reaction score
23
Hello,

There are 20 enemy units in the level (excluding your unit)

When your unit dies:

- all enemy units must removed from the level (20 units will be created when the level starts)
- a text message should appear with the text 'Failed'

When your unit enters the region 'Finish:

- all enemy units must removed from the level (20 units will be created when the level starts)
- a text message should appear with the text 'Concratiolations'

I tried to create 2 triggers, but only ONE trigger should create the 'text tag failed' and ONE trigger should create the text 'Concratiolations'
Which trigger action can I use to remove the enemy units? and do I have to create this action in both triggers?

What is the easiest way to create this?

MissKerrigan
 

Dave312

Censored for your safe viewing
Reaction score
269
Trigger for when the unit dies:
Trigger:
  • Failed
    • Events
      • Unit - [Your_Hero] dies
    • Local Variables
    • Conditions
    • Actions
      • UI - Display "Failed!" for (All players) to Subtitle area
      • Unit Group - Pick each unit in [Level_Units] and do (Actions)
        • Actions
          • Unit - Remove (Picked unit) from the game

Trigger for when the unit enters the finish region:
Trigger:
  • Completed
    • Events
      • Unit - [Your_Hero] Enters Finish
    • Local Variables
    • Conditions
    • Actions
      • UI - Display "Congratulations!" for (All players) to Subtitle area
      • Unit Group - Pick each unit in [Level_Units] and do (Actions)
        • Actions
          • Unit - Remove (Picked unit) from the game


[Level_Units] is a Unit Group variable which contains all 20 enemy units in the level. I think I remember reading something in another thread where you had set this up already.
 

MissKerrigan

Active Member
Reaction score
23
Thanks for your example Dave but did you actually tried it?

Pick each unit from 'level 1 unit' does work, but when I try to remove picked units it's not working at all. Well actually it works but for some reason the unit are NOT removing all in the same time, they are only removing 1 by 1 every 2 seconds, dunno why

So this screws my next attempt if this is without 40 seconds (20 x 2 seconds = 40 seconds)

Because if I start my level again, there are still some units of the last created unit group which are not removed yet, + the new units which are created will be added in the unit group (maybe they even would be removed by the trigger action of the last attempt. omg I explain this really stupid, hope that 1 of you get it


Also the text message should only displayed for the player of which unit has been killed, this seems also impossible, I can select 'triggering player' but nothing is happening
 

X-maul

AKA: Demtrod
Reaction score
201
What you should do is to have a [Level_Units] variable with the array size of [the amount of levels in the map] and a variable named [Current_Level]" this variable will be changed each round so your computer keeps track of what level it is. Then every time your create the new wave of units you just add them to [Level_Unit[Current_Level]].

If this does not make sense to you, tell me and I'll elaborate.
 

Dave312

Censored for your safe viewing
Reaction score
269
Have you got a wait action in the "Pick Units In Group" Loop? It should be removing all units at the same time.

Triggering player is the player who owns the unit that did the event (either died or entered the Finish region) so that should work. I'm not sure why it won't work.
 

MissKerrigan

Active Member
Reaction score
23
I made it quitte simple:

event 'playing unit level 1' (variable-type-unit) dies
condition
action pick each unit in unit group 'level 1'
action wait 1.0 game seconds
action remove 1 unit from unit group 'level 1'
action remove 1 unit from unit group 'level 1'
action remove 1 unit from unit group 'level 1'
action remove 1 unit from unit group 'level 1'
action remove 1 unit from unit group 'level 1'
action remove 1 unit from unit group 'level 1'
action remove 1 unit from unit group 'level 1'
action remove 1 unit from unit group 'level 1'
action remove 1 unit from unit group 'level 1'
action remove 1 unit from unit group 'level 1'
action remove 1 unit from unit group 'level 1'
action remove 1 unit from unit group 'level 1'
action remove 1 unit from unit group 'level 1'
action remove 1 unit from unit group 'level 1'
action remove 1 unit from unit group 'level 1'
action remove 1 unit from unit group 'level 1'
action remove 1 unit from unit group 'level 1'
action remove 1 unit from unit group 'level 1'
action remove 1 unit from unit group 'level 1'
action remove 1 unit from unit group 'level 1'

(20 times)

Only 1 unit is removed from the unit group and since I CANNOT find any action which removes ALL units from the unit group I tried to make 20 actions but it's not working sigh...
 

Dave312

Censored for your safe viewing
Reaction score
269
Why do you have a wait? That was why it was only removing 1 unit every second. Delete that and go back to what you had before and it will work fine.

Also the Remove Unit From Unit Group action does not remove a unit from the game. You need to use the Remove Unit action.
 

X-maul

AKA: Demtrod
Reaction score
201
When you use the "Pick Units In Group" loop, it does an action for every unit in the unit group, so if the unit group have 20 units in it, it will run the actions 20 times. When you are working with the "Pick Units In Group" you can use the "Picked Unit" to refer to the unit currently being handled in the loop, so if you want to remove all units in the unit group you set up a "Pick Units In Group" and the action inside it will be "Unit - Remove (Picked unit) from the game" (just as Dave said it)
 

MissKerrigan

Active Member
Reaction score
23
The reason why I create a wait of 1 sec (Dave) is because I am sure then the unit group will be picket FIRST and after that the units disappear

I remember I tried already the trigger without the wait, but only 1 unit was removed, hmm I will try it again
 

Phubar

Ultra Cool Member
Reaction score
30
Do you have found the solution?

If not i will try to explain how "pick every unit" works... The action is a loop (it means that for every unit it does all the actions in the list ie: for the first unit it does action , action2, action3 then fore the second unit it does action again action1, action2, action3 then for the third unit it does action again action1, action2, action3 and so on) and it doesnt select all the units at the same time and then it does actions (thet can be also actions that dont involve the unit or thet involve deleting the unit)
The "pick unit" is not a separated action and its purpose is to specify wich uints will be picked in the loop (but only one unit at time).

Try to think having 20 minatures on yuor table, 15 red and 5 blue.You recive the task to "pick" every unit in the group "units that are blue" and do 3 actions : say "hello!", throw the miniature on the ground and turn around. So you will say "hello!" then grab a blue miniature and throw it to the ground then tourn around. Then there will be 4 blue units on the able and you will say "hello!"then grab a blue miniature and throw it to the ground then tourn around. and so on until you have done these 3 action for evey blue miniature.

So your trigger will be

action pick each unit in unit group 'level 1' and do actions
-- remove picked unit from the game

I hope my post will be usefull :)

PS: remove from group does not remove the unit from the game like Dave said but it only cancels the unit from the list of units that are in a specific group. Like in your phone book or the contact list of your IM. You can organize your contact in severals lists (Units groups) and removing a name from the list doesnt remove the contact from your sim (the whole game map) but only from the specific list.

PPS: correct me if i was wrong.
 

Phubar

Ultra Cool Member
Reaction score
30
Miniatures are the small "statues" used in boerd or table games.
But for my example you can use any object you want :D
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top