• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[Trigger] Variable Help

Status
Not open for further replies.

TJC

TJC

Level 1
Joined
Sep 30, 2007
Messages
4
Ok Im trying to make a King of the Hill style map where when the player steps on the hill he gets points. After a certain ammount of points (say 1 point per second, 10 points total) then the game is over and the player wins.

I just wanted to get the thing working single player before I even went on to anything else. So far its a no-go.

I make a new variable, named it "points", set it to integer, initial value is 0.
So far so good.

I have a leaderboard that shows what that the value of "points" is.
This works fine, I can set it to, oh say, 5 and it shows 5 in the board.

Set a region so that when ANY unit enters it (this is only for testing only), that the value of "points" is added to by one.
"Set points = (points + 1).

Test the map, walk the unit onto the region and BAM, a great big nothing happens.

Am I missing something BIG and should be informed of it? Or will this simply not work? Maybe a reformat of my comp is in order?

But for the here and now, what the heck am I doing wrong!!

-TJC
 

TJC

TJC

Level 1
Joined
Sep 30, 2007
Messages
4
That was along my thinking as well...

Firstoff thanks for the quick reply. That sets my mind at ease that I was doing it right. Can I ask though, how do I update it? Maybe something like once a second.

TJC
 

TJC

TJC

Level 1
Joined
Sep 30, 2007
Messages
4
Thank you very much! Myself and my brothers messed with the trigger a bit and got it to work just fine. Now when the unit enters the "hill" area the timer starts, and when it hits a number the game ends in victory.

Next step, making teams and testing it further. Thank you again for the invaluable help!

-TJC
 

TJC

TJC

Level 1
Joined
Sep 30, 2007
Messages
4
New Question

OK, so far so good. Got it working multiplayer, but now theres a problem. The player wont stop getting points. Heres the layout...

Theres 4 teams of 3 players each. When any of players 1-3 enter the region, team 1 gets points. Players 4-6, team 2 gets points. So on, and so forth.

I have a region that the player must enter to get points for there team. Any units of the players that enters the region gets points. If there are multiple units from that or other players of the same team you still get the same points per second (one point). This now works perfectly thanks to the advise of donut3.5.

The problem is getting the thing to stop. I have it set so that there are 4 regions on top of each other. When a unit from team 1 enters the region then it activates a trigger that gives team one the points. Getting the trigger to turn off is a nightmare though! I have an event (unit leaves region area, turn off trigger) but the conditions are impossible! I need to have it so that NO units of player 1-3 are IN the region. But so far we cant get it to work.

Is there some way to tell the region, if there are no units from players 1, 2, or 3 then turn off the trigger?

Thank you guys again for the help!

-TJC
 
Level 21
Joined
Aug 21, 2005
Messages
3,699
Variables:
Score : Integer : Array of 4
Force : Player group : Array of 4
TempUnitGroup1 : Unit Group : No array

Only 1 region is needed. no 4.

  • Map Initialization
  • Events
    • Map Initialization
    • // This trigger will run when loading the map
  • Conditions
  • Actions
    • Player - Add Player 1 to Force[1]
    • Player - Add Player 2 to Force[1]
    • Player - Add Player 3 to Force[1]
    • Player - Add Player 4 to Force[2]
    • // Etc.
  • Events
    • Time - every 2 seconds of game time
    • // this trigger runs every 2 seconds to add points to a team.
  • Conditions
  • Actions
    • For each integer A from 1 to 4 do:
      • Loop - Actions
        • Set "TempUnitGroup1" = units in region 1 matching: (boolean) Owner of matching unit is in Force[Integer A]
        • If (all conditions are true) then do (Then actions) else do (else actions)
          • If - Conditions
            • (Boolean) Tempunitgroup1 = empty
          • Then - Actions
            • Do Nothing
          • Else - Actions
            • Set Score[Integer A] = Score[Integer A] + 1
            • Leaderboard - Set Value for Force[Integer A] to Score[Integer A]
        • Custom script: Call DestroyGroup (udg_TempUnitGroup1)
I don't have WE open, so I might have made some typos

EDIT: posted too early...
 
Last edited:
Status
Not open for further replies.
Top