HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Help if you can...but if you cant Oh Well :P

01-16-2005, 02:42 AM#1
ZhadowAzzazzin
All right heres the deal. Im making a maze and i have everything covered except fo a tiny problem i cant figure out. I made a trigger that spawns all the units for players that are in game and not computer controlled, but because of this my collision detection trigger wont work because I can only use pre-place units for the "A Unit Comes Within Range XXX of Unit". I have a variable for the unit that is suppose to be there, but it wont let me use it. Here is my code...

Quote:
Melee Initialization
Events
Map initialization
Conditions
Actions
Player Group - Pick every player in (All players) and do (If ((((Picked player) slot status) Equal to Is playing) and (((Picked player) controller) Equal to User)) then do (Player Group - Add (Picked player) to Prisoners) else do (Do nothing))


Quote:
Area 1 Spawn
Events
Map initialization
Conditions
Actions
Player Group - Pick every player in Prisoners and do (Unit - Create 1 Prisoner for (Picked player) at (Center of Area 1 Spawn <gen>) facing 0.00 degrees)
Set Prisoner = (Last created unit)


Quote:
Collision Detection
Events
Unit - A unit comes within 60.00 of No unit
Conditions
(Triggering unit) Not equal to Prisoner
Actions
Unit - Explode Prisoner


That should be all you need because nothing else has anything to do with this.

Like I said no pressure ... If you cant help dont. Duh
01-16-2005, 03:12 AM#2
Guest
In your second trigger that spawns the prisoner and sets him to a variable, add another action:

Trigger - Add New Event

and it should look something like:

Trigger - Add to (your third trigger) the event (Unit - Unit comes within x of PrisonerVariable)

Obviously you won't need the event you already have for the third trigger, as you'll be adding it ingame. You'll need to have one variable per prisoner, and one event per variable.

edit: iirc the event will keep working if you set prisoner to something else, it will just trigger for whatever unit prisoner currently is and forget about the previous prisoner (just to clarify the point about one variable per prisoner). I think that's how it works, just letting you know in case there are respawns or what have you.
01-16-2005, 03:24 AM#3
ZhadowAzzazzin
I'm sorry but that was kinda confusing...I don't know if you included this fact, but when it spawns the unit it spawns a unit for every person playing an sets the variable prisoner to the last created variable...and Prisoner is a Unit Variable.

If that was covered then would it be possible to make prisoner an array and have each index equal a player's number so that i could have 1 trigger that checks for each index or would i still need a seperate trigger for each player?
01-16-2005, 03:32 AM#4
Guest
Quote:
Originally Posted by ZhadowAzzazzin
I'm sorry but that was kinda confusing...I don't know if you included this fact, but when it spawns the unit it spawns a unit for every person playing an sets the variable prisoner to the last created variable...and Prisoner is a Unit Variable.

If that was covered then would it be possible to make prisoner an array and have each index equal a player's number so that i could have 1 trigger that checks for each index or would i still need a seperate trigger for each player?

Sorry! And yes, you will need a variable for each prisoner, and I'm pretty sure that an array will work. You won't need a trigger for each player, necessarily (although that is one way to do it and might be the easiest, if most tedious way), but you will need an event for each player, since each Unit - Unit enters range only works for one unit. You can have multiple events on the same trigger.
01-16-2005, 03:48 AM#5
ZhadowAzzazzin
I know you can have more than one event on a trigger, but after reading this topic again i noticed you said to use the prisoner variable in the Unit - Unit Comes Within Range event, but i stated above that for some reason it wont let me use the variable. Oh well ima try what you said and if all else fails im going to have to preplace all the units and revise the spawn triggers to remove units not in use instead of create for those in use. Thx for all your help though it is much appriciated.
01-16-2005, 03:50 AM#6
Guest
Quote:
Originally Posted by ZhadowAzzazzin
I know you can have more than one event on a trigger, but after reading this topic again i noticed you said to use the prisoner variable in the Unit - Unit Comes Within Range event, but i stated above that for some reason it wont let me use the variable. Oh well ima try what you said and if all else fails im going to have to preplace all the units and revise the spawn triggers to remove units not in use instead of create for those in use. Thx for all your help though it is much appriciated.

It won't let you use the variable when you make a new event directly in the trigger, but it should let you use the variable when you add the event via the Trigger - Add New Event action. I hope at least some of what I said makes enough sense to help you out, dunno =P
01-16-2005, 03:54 AM#7
ZhadowAzzazzin
You see I didnt know that lol and yah it all makes sense. Honestly I feel kind Dumb for not thinking of that, but you know i dont reallt care. Thx a lot and btw HOLY CRAP YOU REPLY FAST
:o