• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!

A newbish question

Status
Not open for further replies.
Level 1
Joined
Mar 15, 2011
Messages
3
hi,

i am trying to make a racing map.

but i have a question about the triggers that i will use..

because on a certain circuit/racetrack, it is 2 laps to win.

and i want a message displayed kind of like in gran turismo or need for speed when it comes to the player in the 1st position crosses a checkpoint his current time is recorded and shown on the screen right? well in my case i just want a text saying Lap 1 and <Player in the lead's name> is in the lead.

i tried making my own trigger but everytime a unit passes through the checkpoint region, even if it's not the leader unit, the message is shown. and also how to create a trigger to end the race once 1st 2nd and 3rd place racers have already crossed the finish line? do i need to use a counter variable?

sorry for the VERY confusing explanation, my brain cells are just fried right now due to overuse.. lol

thanks in advance everyone.. :goblin_yeah:
 
Level 7
Joined
Dec 26, 2010
Messages
401
The way I'd go about it would be to use a varriable array for the number of laps and the time, that is initiated for each unit when it leaves the start region, that way each time you cross the line it will add 1 to the counter, giving you the number of laps completed, and when the line is crossed run triggers checking number of laps and the time it took to get the unit places/scores.
 
Level 1
Joined
Mar 15, 2011
Messages
3
thanks bro for the suggestion. the only problem is i don't know the exact format on how to use a variable array in a trigger..

yeah i can set the var before the race starts but what's the syntax or formula?

unit enters finishline_region

condition: unit is belongs to player 1?

actions: for loop? everytime certain unit enters region variable_array= var_array +1?

sorry if i'm not that good yet on using triggers.. but appreciate any further help and suggestions. :)
 
Level 12
Joined
Oct 10, 2009
Messages
438
Hey bro, Im away from my war3 right now, but heres the triggers: (Nested if statements are the way to go)

This trigger sets the winning unit, second unit and third unit in the race, it also check to see if the unit has completed the right amount of laps, and if so they are set.
  • Events
    • Unit - enters region XXXX
  • Conditions
    • Unit - type equal to XXXX
  • Events
    • Set TempInteger = Player number (Owner of Triggering unit)
    • Set Laps[(TempInteger) = Laps [(TempInteger)] + 1
    • If
      • Laps[(TempInteger)] = MaxLaps
    • Then
      • If
        • FirstAvailable = True
      • Then
        • Set FirstAvailable = False
        • Set WinningUnit = Triggering Unit
        • Game - Display message to (All players) ((Owner of Triggering unit) Has won the race!)
      • Else
        • If
          • SecondAvailable = True
        • Then
          • Set SecondAvailable = False
          • Set SecondUnit = Triggering Unit
        • Else
          • If
            • ThirdAvailable = True
          • Then
            • Set ThirdAvailable = False
            • Set ThirdUnit = Triggering Unit
            • Else
              • Do Nothing
    • Else
      • Game - display message to (XXXX) (Conversion real to string(Movement Speed of(Triggering unit)))
 
Level 1
Joined
Mar 15, 2011
Messages
3
thanks. i'm going to try it out now.. even after my thesis i'm going to continue studying WE coz i found out that it's cool.. (even modeling)
:ogre_haosis:
 
Status
Not open for further replies.
Top