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
 
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.
 
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
 
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.
 
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.
 
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...
 
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.
 
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)
 
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
 
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.
 
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.
  • V-SNES V-SNES:
    Happy Friday!
    +1
  • The Helper The Helper:
    News portal has been retired. Main page of site goes to Headline News forum now
  • The Helper The Helper:
    I am working on getting access to the old news portal under a different URL for those that would rather use that for news before we get a different news view.
  • Ghan Ghan:
    Easily done
    +1
  • The Helper The Helper:
    https://www.thehelper.net/pages/news/ is a link to the old news portal - i will integrate it into the interface somewhere when i figure it out
  • Ghan Ghan:
    Need to try something
  • Ghan Ghan:
    Hopefully this won't cause problems.
  • Ghan Ghan:
    Hmm
  • Ghan Ghan:
    I have converted the Headline News forum to an Article type forum. It will now show the top 20 threads with more detail of each thread.
  • Ghan Ghan:
    See how we like that.
  • The Helper The Helper:
    I do not see a way to go past the 1st page of posts on the forum though
  • The Helper The Helper:
    It is OK though for the main page to open up on the forum in the view it was before. As long as the portal has its own URL so it can be viewed that way I do want to try it as a regular forum view for a while
  • Ghan Ghan:
    Yeah I'm not sure what the deal is with the pagination.
  • Ghan Ghan:
    It SHOULD be there so I think it might just be an artifact of having an older style.
  • Ghan Ghan:
    I switched it to a "Standard" article forum. This will show the thread list like normal, but the threads themselves will have the first post set up above the rest of the "comments"
  • The Helper The Helper:
    I don't really get that article forum but I think it is because I have never really seen it used on a multi post thread
  • Ghan Ghan:
    RpNation makes more use of it right now as an example: https://www.rpnation.com/news/
  • The Helper The Helper:
  • The Helper The Helper:
    What do you think Tom?
  • tom_mai78101 tom_mai78101:
    I will have to get used to this.
  • tom_mai78101 tom_mai78101:
    The latest news feed looks good

      The Helper Discord

      Staff online

      • Ghan
        Administrator - Servers are fun

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top