trigger to remove trees when all units are dead

  • Thread starter Thread starter Gheed
  • Start date Start date
G

Gheed

Guest
is there a way to remove trees when all player one (red) units are dead.
atm i can only do it when one unit dies.. but can you do it when all units are dead.. and how?


tnx
 
hmm, make an integer vaiable called player1_units.

now do a trigger so that every second of the game it sets the variable to however many units owned by player 1 (red), here is a rough trigger:

Code:
events - every 1 second of game time
conditions - none
actions - set player1_units [number of (units in (playable map area)) owned by player 1 (red)] = player1_units [number of (units in (playable map area)) owned by player 2 (red)]

now this trigger

Code:
events - a unit dies
conditions - player1_units [number of (units in (playable map area)) owned by player 1 (red)] becomes equal to 0
- (owner of (triggering unit)) equal to player 1 (red)
actions - your actions here

put your actions in to destroy the doodads or anything else you want to do.

Hope this helps

~Jindo
 
Why run every second?
Just count those that are left when a unit dies.

Number of units in ((Units owned by (Player 1) matching (((Matching unit) is alive) equal to true)) equal to 0
 
a tnx.. i havent tried it yet.. gonna do it soon but ive found a answer meself and it doesnt work.. :D


If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Number of living Ghoul units owned by Player 1 (Red)) Equal to 0
Then - Actions
Destructible - Pick every destructible in Blue wins region <gen> and do (Destructible - Remove (Picked destructible))
Else - Actions
Do nothing
some how this wont work.. do you know why? ( meanwhile i trie your answers :p )
 
Jindo said:
hmm, make an integer vaiable called player1_units.

now do a trigger so that every second of the game it sets the variable to however many units owned by player 1 (red), here is a rough trigger:

Code:
events - every 1 second of game time
conditions - none
actions - set player1_units [number of (units in (playable map area)) owned by player 1 (red)] = player1_units [number of (units in (playable map area)) owned by player 2 (red)]

now this trigger

Code:
events - a unit dies
conditions - player1_units [number of (units in (playable map area)) owned by player 1 (red)] becomes equal to 0
- (owner of (triggering unit)) equal to player 1 (red)
actions - your actions here

put your actions in to destroy the doodads or anything else you want to do.

Hope this helps

~Jindo

i dont understund anything of this... :banghead: :banghead: :banghead:
 
Ok, heres the complete trigger:

Code:
    Events
        Unit - A unit Dies
    Conditions
        (Number of units in (Units owned by Player 1 (Red))) Less than 1
    Actions
        Destructible - Pick every destructible in (Playable map area) and do (Actions)
            Loop - Actions
                Destructible - Kill (Picked destructible)
 
The "Units owned by Player 1 (Red)" will not work.
A dead unit is still a unit. Means it's counted...

You do need the "unit owned by player matching condition".
Where the condition tests for "matching unit is alive".
 
AceHart said:
The "Units owned by Player 1 (Red)" will not work.
A dead unit is still a unit. Means it's counted...

You do need the "unit owned by player matching condition".
Where the condition tests for "matching unit is alive".


but what was wrong with my solution ?

Gheed said:
a tnx.. i havent tried it yet.. gonna do it soon but ive found a answer meself and it doesnt work.. :D


If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Number of living Ghoul units owned by Player 1 (Red)) Equal to 0
Then - Actions
Destructible - Pick every destructible in Blue wins region <gen> and do (Destructible - Remove (Picked destructible))
Else - Actions
Do nothing
some how this wont work.. do you know why? ( meanwhile i trie your answers :p )
 
AceHart said:
I've never used "count living units"...

What did you have as events or conditions?

If - Conditions
(Number of living Ghoul units owned by Player 1 (Red)) Equal to 0
Then - Actions
 
(edit)
Yaw! problem is solved..!!!
What i did was
Event
Player - Player 2 (Blue)'s Food used becomes Less than or equal to 0.00

(created a variable with the type booleran (false) and called Defeat )

Condition
Defeat Equal to False

Action
Destructible - Pick every destructible in Red wins Region <gen> and do (Destructible - Kill (Picked destructible))


and it worked ty for all help :)
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • Ghan Ghan:
    Bot readable, not human usable.
  • The Helper The Helper:
    got it
  • The Helper The Helper:
    Happy Thursday!
  • The Helper The Helper:
    Check out the new Featured Content feature we apparently got with the forum software upgrade! https://www.thehelper.net/featured/
  • The Helper The Helper:
    Also on the bottom right side bar we now have a Trending Content Box!
    +1
  • The Helper The Helper:
    Not on the Headline News page just on the Forums page can we get that Featured and Trending on the home page?
  • Ghan Ghan:
    Since the home page is technically a forum, it now shows on all forum views. Still in the sidebar.
    +1
  • The Helper The Helper:
    Happy Friday! Hope everyone has a fantastic day and an even better weekend!
  • The Helper The Helper:
    Happy Sunday!
  • The Helper The Helper:
    I lovc that I can post webp and X links now! :)
  • The Helper The Helper:
    Happy Thursday!
  • V-SNES V-SNES:
    Happy Friday!
    +1
  • The Helper The Helper:
    we were down for a minute - think a log file or something got too big
    +1
  • Ghan Ghan:
    The alerts say it was down for a while unfortunately.
  • Ghan Ghan:
    Didn't know what was going on while I was at work.
  • Ghan Ghan:
    Disk filled up with logs. Fixed now.
    +1
  • The Helper The Helper:
    not a problem at all thanks for getting us back up
  • The Helper The Helper:
    I think the bots are finding a way to get through the anubis
  • The Helper The Helper:
    Happy Wednesday Everyone! Hope everyone has a Fantastic Day!
    +1
  • The Helper The Helper:
    Yeah, stats are showing big bot influx like 12k page views.
  • Wizard Wizard:
    :wave:
    +1
  • Ghan Ghan:
    TH changed his avatar again. 6 more weeks of summer.
    +3
  • Wizard Wizard:
    lol
    +1
  • The Helper The Helper:
    Guys just a heads up I am going to be shutting the site down soon. I am just waiting on the NUON people to decide whether they want to transfer forum data and keep the discord. My email is [email protected] for anyone that wants to keep in touch and I have a facebook too. I will make an official post later. Love you guys and will miss everyone!
    +1
  • V-SNES V-SNES:
    Sent a pm @The Helper

The Helper Discord

Members online

No members online now.

Affiliates

Hive Workshop NUON Dome World Editor Tutorials
Back
Top