Warcraft III resources & community, 2003–2006 · archived

Need help with a trigger

8 posts
#1

Need help with a trigger

Ok this is whats happening in my map there are 4 supply depots but only 1 is real now heres the catch i want the real 1 to be random the real one will contain a Supply Captain now i want him to spawn in any four of these regions but only 1 of the four and im gonna have lot of regions in this map so i dont want the trigger to send the Supply Captain to any other regions but those specific 4.
#2
integer i ( global )

---YOUR TRIGGER'S ACTIONS---

Set i = Random Integer Between 1 and 4
if i = 1 then
Create 1 Supply Captain at ( your region )
else
if i = 2 then
Create 1 Supply Captain at ( your region )
else
if i = 3 then
Create 1 Supply Captain at ( your region )
else
Create 1 Supply Captain at ( your region )
#3
where is that action i only see

If/then/else
If/then/else multible actions

i dont see

if/else/else/else
#4
no, make 4 "if/then/else"

like

If/Then/Else
If rannum = 1
Then (your action)
Else - Do Nothing

If/Then/Else
If rannum = 2
Then (your action)
Else - Do Nothing... repeat until 4.
#5
kind of like Haloboy said, here is it indented

Set i = Random Integer Between 1 and 4 
if i = 1 then 
    Create 1 Supply Captain at ( your region ) 
else 
    if i = 2 then 
        Create 1 Supply Captain at ( your region ) 
    else 
        if i = 3 then 
            Create 1 Supply Captain at ( your region ) 
        else 
            Create 1 Supply Captain at ( your region )
#6
umm i think i have a problem
with the set action

Set Integer [index] = Random number between 1 and 4

what do i put for index??
#7
Well i have a long If/Else thing for death messages, so the same concept will work for you. for the Variable
Set DeathMessage = (Random integer number between 1 and 10)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(DeathMessage Equal to 1) or (DeathMessage Equal to 6)
Then - Actions
Game - Display to (All players) the text: Someone went and go...
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(DeathMessage Equal to 2) or (DeathMessage Equal to 7)
Then - Actions
Game - Display to (All players) the text: BAM HAHAHA...uh I m...
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(DeathMessage Equal to 3) or (DeathMessage Equal to 8)
Then - Actions
Game - Display to (All players) the text: We shall mourn the ...
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(DeathMessage Equal to 4) or (DeathMessage Equal to 9)
Then - Actions
Game - Display to (All players) the text: Damn dude ur hero d...
Else - Actions
Game - Display to (All players) the text: Oooh that one hurt....

So yeah it's long but it shows that you can do a lot with triggers. instead of using [Game - Display to (All players)] use [Unit - Create 1 (unit) for (player) at (Center of (locatino) <gen>)]

and you don't have to use just 1-4, you could do stuff like i did so that it's a little more random, or more complex to make people think you're smart =Þ.
#8
dont make integer i an array variable...

(or just always use 0)