• 🏆 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!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Need some help

Status
Not open for further replies.
Level 6
Joined
Feb 27, 2008
Messages
222
Ok, so im trying to make a trigger which does this -
You insert a command, in my case it is : -random
once you insert it, it turns off all triggers and then, every... say... 0,5 seconds it picks a random trigger and runs it.
Now, i tried doing it with hashtable, and i've been partially successful... the thing which kept me from being totally successful is the content of the other triggers... for instance

  • Events
    • Time - Elapsed game time is 10.00 seconds
  • Actions
    • Game - Display to (All players) the text: 10 seconds have ela...
    • Set Loc[1] = (Center of (Playable map area))
    • Unit - Create 1 Thunder Clap 3 for Neutral Hostile at Loc[1] facing Default building facing degrees
    • Custom script: call RemoveLocation(udg_Loc[1])
    • Trigger - Turn on Cast <gen>
and the other trigger

  • Events
    • Time - Every 3.00 seconds of game time
  • Actions
    • Set Group = (Units of type Thunder Clap 3)
    • Unit Group - Pick every unit in Group and do (Actions)
      • Loop - Actions
        • Set Loc[1] = (Random point in (Playable map area))
        • Unit - Move (Picked unit) instantly to Loc[1]
        • Animation - Play (Picked unit)'s birth animation
        • Unit - Order (Picked unit) to Human Mountain King - Thunder Clap
    • Custom script: call RemoveLocation(udg_Loc[1])
    • Custom script: call DestroyGroup(udg_Group)
obviously, this makes a unit cast a random placed thunder clap every 3 seconds. This happens without the -random command

now, when i tried using hashtables, the problem was that every time the trigger started (which was 0.5 seconds), the trigger had to create a casting unit for each of the spells since they all are similar to this one.
Then, just one of them cast a spell, and the rest still showed their birth animations. Then i had to remove all of them. This was really unrealistic, cause it spawned like 10 units each 0.5 seconds and only one of them did something causing the map to be flooded with a lot of unnecessary crap.


so, if you have 10 triggers like this, how would you make it so that each 0.5 seconds a random one is executed?
 
Level 28
Joined
Jan 26, 2007
Messages
4,789
Well, you could do something like this at map init:

  • Actions
    • Set RandomTrigger[1] = Trigger 1 <gen>
    • Set RandomTrigger[2] = Trigger 2 <gen>
    • Set RandomTrigger[3] = Trigger 3 <gen>
Then, when someone types random, create a trigger like this:

  • Trigger
    • Events
      • Time - Every 0.50 seconds of game time
    • Conditions
    • Actions
      • Trigger - Run RandomTrigger[(Random integer number between 1 and 10)] (checking conditions)
 
Level 6
Joined
Feb 27, 2008
Messages
222
sorry for double post but...
now im really confused. I started remaking the triggers, but got stuck on the first one cause i'm getting a really dumb result.

Trigger 1 :
  • Events
    • Time - Elapsed game time is 10.00 seconds
  • Conditions
  • Actions
    • Game - Display to (All players) the text: 10 seconds have ela...
    • Trigger - Turn on Cast <gen>
Trigger 2 :
  • Events
    • Time - Every 3.00 seconds of game time
  • Conditions
  • Actions
    • Set Loc[1] = (Random point in (Playable map area))
    • Unit - Create 1 Thunder Clap 3 for Neutral Hostile at Loc[1] facing Default building facing degrees
    • Unit - Order (Last created unit) to Human Mountain King - Thunder Clap
    • Unit - Add a 3.10 second Generic expiration timer to (Last created unit)
    • Custom script: call RemoveLocation(udg_Loc[1])
    • Custom script: call DestroyGroup(udg_Group)
This set of triggers doesnt work. However, if i make the casting unit (named "Thunder clap 3" by mistake) to be created for player 1 , it works.

why?

edit : I guess it works if the unit is created for a Player... so i guess i will have to make it so that the 12th player (brown) is a computer who controls the spells.
 
Status
Not open for further replies.
Top