+-

Elder Scrolls


Author Topic: Need help with a trigger  (Read 164 times)

HaWkys

  • Masser Deluxe
  • *******
  • Posts: 740
  • NMCDO = biggest clown
    • View Profile
Need help with a trigger
« on: November 23, 2013, 02:52:53 am »
oke so am creating a game (like sheep tag) but instead of having a pen you are killed, another unit will be created in an isolated area. You can be freed by a panel or button outside that one of ur allies has to step on, I am having trouble coming up with a winning trigger for the wolf, when all of the "sheep" for a lack of better term are all in that confined region. So far i have:

Event- Generic unit dies.

Condition- Triggering unit = Sheep AND Unit in specific region = team number of player 1 red (meaning the ENTIRE TEAM)

Action- Player group - remove all picked players from playable map area.
-Autotimed message ("Sheep have lost, Game will end in 5 seconds.
-Wait 5 seconds
-Game over

will this work?

Share on Facebook Share on Twitter


SHEePYTaGGeRNeP

  • Runtag Supremo
  • *****
  • Posts: 326
  • Location: Netherlands
    • View Profile
Re: Need help with a trigger
« Reply #1 on: November 23, 2013, 10:54:10 am »
Change it to?
Code: [Select]
Condition - AND Owner of unit is an ally of Player Red = true   ( It's @ boolean )

Action - Unit Group - Pick every unit of Owned by Triggering Player - remove all picked unit from the game

I don't know what you are trying to do though.
If you want the game to end you probably would want
Code: [Select]
If ( integer ( count units of type SHEEP ) == 0 )
Sheep Lose game.

Wrda

  • Runtagger
  • **
  • Posts: 28
    • View Profile
Re: Need help with a trigger
« Reply #2 on: November 23, 2013, 11:58:07 am »
Code: [Select]
End
    Events
        Unit - A unit Dies
    Conditions
        (Unit-type of (Triggering unit)) Equal to Peasant
    Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (Number of units in (Units of type Peasant)) Equal to 0
            Then - Actions
                Set group = (Units in (Playable map area))
                Unit Group - Pick every unit in group and do (Actions)
                    Loop - Actions
                        Unit - Remove (Picked unit) from the game
                Custom script:   call DestroyGroup(udg_group)
                Game - Display to (All players) the text: Sheep have lost, th...
                -------- -----------------------------------Victory for wolves---------------- --------
                -------- -----------------------------------Defeat for sheep------------------- --------
            Else - Actions

NOTE: group is a unit group variable.

Chakra

  • Runtag Supremo
  • *****
  • Posts: 279
    • View Profile
    • Chatcraft
Re: Need help with a trigger
« Reply #3 on: November 23, 2013, 04:20:07 pm »
Well, if you are fixing one leak on an end-game trigger, should fix both.

Quote
(Unit-type of (Triggering unit)) Equal to Peasant
This by default leaks. However, since it isn't setting some variable to it, it's an instant leak, so you can't do DestroyGroup on it. However, the count function uses the bj_wantDestroyGroup variable, so all you have to do is:

Quote
Custom script:   set bj_wantDestroyGroup = true
Before the if statement.
« Last Edit: November 23, 2013, 04:24:22 pm by Chakra »

Wrda

  • Runtagger
  • **
  • Posts: 28
    • View Profile
Re: Need help with a trigger
« Reply #4 on: November 23, 2013, 05:02:17 pm »
Yes there should be another group of the unit type.
« Last Edit: November 23, 2013, 05:07:57 pm by Wrda »

HaWkys

  • Masser Deluxe
  • *******
  • Posts: 740
  • NMCDO = biggest clown
    • View Profile
Re: Need help with a trigger
« Reply #5 on: November 23, 2013, 06:04:05 pm »
I'll explain myself more in depth.

Event- Generic unit dies

Condition- (Unit-type of (Triggering unit)) Equal to Sheep

Now let me explain for the action. All of the sheep (or any other unit im just naming this one out of the blue) are in the "center like" region of sheep tag. They cannot leave. Once all the sheep team is stuck in this region. I would like the game to end but here i am having problems.

-Wrda u mentioned a specific value like
-total # of units in (specific region = 0) I cant have that i need when all of the players in the sheep team are in that region the game ends.

SHEePYTaGGeRNeP

  • Runtag Supremo
  • *****
  • Posts: 326
  • Location: Netherlands
    • View Profile
Re: Need help with a trigger
« Reply #6 on: November 23, 2013, 07:26:32 pm »
if (Number of units in (Units in Sheep Region <gen> matching ((Unit-type of (Matching unit)) Equal to Wisp))) Equal to (Number of players in (All allies of Player 1 (Red)))
{
Sheep Have Won The Game;
}

Something like this you mean?

EDIT: I don't know if Allies of Player 1  actually checks for players that are playing and are ally of player I, you can also just change to Number of Player in ( Variable Player Group that you created )

Wrda

  • Runtagger
  • **
  • Posts: 28
    • View Profile
Re: Need help with a trigger
« Reply #7 on: November 24, 2013, 01:28:19 am »
Hawkys I don't think you know what my trigger does:
A unit dies
if unit type of the dying unit is sheep, then do actions
if the number of units of sheep is 0 (MEANING THERE ARE NO SHEEPS LEFT) then do actions
blablabla

HaWkys

  • Masser Deluxe
  • *******
  • Posts: 740
  • NMCDO = biggest clown
    • View Profile
Re: Need help with a trigger
« Reply #8 on: November 24, 2013, 04:22:00 am »
yes wrda i knew what you meant, but when the sheep die they are created in the "jail" and can only be freed when a fellow sheep steps on the panel (it opens the gate)

Chakra

  • Runtag Supremo
  • *****
  • Posts: 279
    • View Profile
    • Chatcraft
Re: Need help with a trigger
« Reply #9 on: November 24, 2013, 04:24:41 am »
If the number of all sheep in the playable map area is equal to the number of all sheep in the pen and the gate is closed then they lost?

Sounds like a rather simple deviation.

HaWkys

  • Masser Deluxe
  • *******
  • Posts: 740
  • NMCDO = biggest clown
    • View Profile
Re: Need help with a trigger
« Reply #10 on: November 24, 2013, 04:58:46 am »
lol chakra but if 1 sheep steps on the panel then they all get saved! the game i made is more balanced out

Chakra

  • Runtag Supremo
  • *****
  • Posts: 279
    • View Profile
    • Chatcraft
Re: Need help with a trigger
« Reply #11 on: November 24, 2013, 06:31:30 am »
What does that have anything to do with the issue? I was telling you the logic of the condition, that's all. o.O

You count the number of sheep in the entire map.
You count the number of sheep in the pen thingy.
You check if the pen thingy is closed.

Those three conditions = they lost, yes?

HaWkys

  • Masser Deluxe
  • *******
  • Posts: 740
  • NMCDO = biggest clown
    • View Profile
Re: Need help with a trigger
« Reply #12 on: November 24, 2013, 05:12:36 pm »
but the problem with counting is, what if there is not the amount of players i set it as?

Chakra

  • Runtag Supremo
  • *****
  • Posts: 279
    • View Profile
    • Chatcraft
Re: Need help with a trigger
« Reply #13 on: November 24, 2013, 08:03:17 pm »
What? You aren't counting the number of players. You are counting the total number of sheep, then counting the total number of sheep trapped. If they are equal that means ALL sheep are trapped, yes?

Wrda

  • Runtagger
  • **
  • Posts: 28
    • View Profile
Re: Need help with a trigger
« Reply #14 on: November 24, 2013, 08:41:12 pm »
Hawkys, if there are 0 sheeps left (MEANING THEY ARE ALL IN THE PEN), sheeps lose.
No need to count the total number of sheeps and the traped ones.

 

Recent Posts

YOoooo by Celestial_One
February 04, 2020, 04:05:05 pm

hey guys! by Celestial_One
January 01, 2020, 01:08:18 am

Re: Alive? by GothaWOLF
September 27, 2019, 08:23:15 am

Re: Alive? by Nmcdo
September 26, 2019, 06:20:18 pm

Alive? by GothaWOLF
September 26, 2019, 07:40:50 am

SUP GUYYYYSSSSSSSSS by Sheepdice
September 20, 2018, 02:56:42 am

Re: New Meat on SC2 by Wyvernrider
July 17, 2018, 07:07:48 pm

Re: CD Keys RoC or Frozen Throne? by Wyvernrider
July 17, 2018, 07:06:16 pm


Shoutbox

View Shout History