• 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.

Help with unit spawning needed.

Status
Not open for further replies.
Level 2
Joined
Feb 12, 2005
Messages
19
Ok, I'll cut right to the chase, I need to figure out how to spawn a unit. But it's not that simple.
I can type "-1" to spawn one type of guy.
"-2" to spawn a differn't type of guy.
And "-3" to spawn another type of guy.
I'm pretty sure I can do THAT little part, but my problem is that I should only be able to have ONE guy on the map at all times.
That means in the begining of the game, I'd type:
"- (Then a 1, 2, or 3.)"
And if I happen to die, I can spawn a new guy. But only if my previous or current character is dead.
Thanks in advance.
 
Level 22
Joined
May 11, 2004
Messages
2,863
First, make a random intiger variable, just call it "random" or something.

Next, on the initial spawn trigger make this action:

set variable- Set "random"= (random intiger bewtween 1 and 3)

if/then/else
If (random intiger) is equal to 1
Then Unit- creat (unit type 1) for (whatever player) at (whatever location)
else- do nothing

If (random intiger) is equal to 2
Then Unit- creat (unit type 2) for (whatever player) at (whatever location)
else- do nothing

If (random intiger) is equal to 3
Then Unit- creat (unit type 3) for (whatever player) at (whatever location)
else- do nothing


Then a second trigger with these same action under a "unit owned by player dies" event, so it does this every time a unit from a certain player is killed

-VGsatomi
 
Level 2
Joined
Feb 12, 2005
Messages
19
It doesn't work.
Is there some kind of other trigger in there?
I put it all exactly the way you did it and it doesn't do anything.
:O
 
Level 4
Joined
Jan 3, 2005
Messages
91
umm ok my solution: (everything put into 1 trigger!)

Code:
[events]
Player 1 types.. containing "-1" as exact ..
Player 1 types.. containing "-2" as exact ..
Player 1 types.. containing "-3" as exact ..
Player 2 types.. containing "-1" as exact ..
Player 2 types.. containing "-2" as exact ..
Player 2 types.. containing "-3" as exact ..
[for all players, copy and paste work, everything into 1 trigger]

ok now 3 conditions, it should look like this:
Code:
[conditions]
- ((Units owned by (Triggering player) matching (((Unit-type of (Matching unit)) is Equal to [UNIT TYPE 1]) and (((Matching unit) is alive) is Equal to True))) is empty) is Equal to True

- ((Units owned by (Triggering player) matching (((Unit-type of (Matching unit)) is Equal to [UNIT TYPE 2]) and (((Matching unit) is alive) is Equal to True))) is empty) is Equal to True

- ((Units owned by (Triggering player) matching (((Unit-type of (Matching unit)) is Equal to [UNIT TYPE 3]) and (((Matching unit) is alive) is Equal to True))) is empty) is Equal to True

You can get there by doing this:

- New condition > boolean comparision > unit group is empty
- [unit group] > units owned by player matching condition
- [player] > event response - triggering player
- [condition] > and
- [condition 1] > boolean comparision > unit is alive > matching unit (is alive)
- [condition 2] > unit type comparision > unit type of unit > [unit] > machting unit
- is equal [your unit type 1]

ok thats the most important thing, now copy and paste this trigger 2 times and change the unit types for each unit type you have. of course we could put all stuff into one single condition by stuffing all 3 unit types into the unit group, but this will be enough.

so now you can do something like, just as you want it. you now should only check what chat string exactly was entered and which player entered the chat string. so it could look like:

Code:
[actions]
IF entered chat string is "-1" THEN create 1 [unit type 1] for [triggering player] at [wherever] facing [whatever]

good luck,

klovadis
 
Level 2
Joined
Feb 12, 2005
Messages
19
Thanks, I had been considering doing something similar to that (Much less effective though, I would assume) But I figured that somebody might have a shorter way.
Meh. Beggers can't be choosers, eh?
 
Status
Not open for further replies.
Top