HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

I Have A Trigger Question

08-02-2002, 10:19 PM#1
Guest
I'm working on a map and I can't figure out how to do a trigger. What I need to do is to be able to remove a specific unit for a specific player. Please tell me how to do this if you know.
08-02-2002, 10:28 PM#2
Newhydra
Need more context here...when do you want to remove this unit? every X seconds? When the unit enters a region? Performs an action? Is it always the same unit owned by the same player? Is the unit preplaced or created with a trigger(doesn't matter much unless you wanted to do somethin' like when a unit gets within X of this unit remove it)?
08-03-2002, 02:01 PM#3
Guest
My Overall pan is to when a slot is unused to have the Preplaced Hero of that slot be removed. Since the slot would be unused it would not be moving or anything just sitting there.
08-03-2002, 04:24 PM#4
Newhydra
Okay, event is going to be map initilization

then the actions go something like:
pick every player in player group (all players)
if (picked player slot status is unused)
remove unit (unitarray[playerNumber(picked player)]) Else do nothing

The unitarray that I use here is something you create, and add the unit to the array, This makes it more...portable? [can't come up with the right word ;)] But in your specific example, if the units are all of the same type then you'd just do:
pick every unit in unit group (units of type (Type_to_Remove))
if slot status (playerNumber(owner of (picked unit)) is unused
remove(picked unit)

for the actions instead of what I have above
08-03-2002, 05:48 PM#5
Guest
Im afraid I can't find the slot=unused part after I do the select all in player group. It says select all players and do action. Also I can't find the remove unitarray part either. If you could tell me the exact names of the triggers and what i select in each trigger I'd be very thankful. (I'm used to just the old simple Starcraft map maker with the lovely remove unit at location trigger.)
08-03-2002, 05:59 PM#6
Newhydra
I *think* the used/unused thing is under player comparison, though it could be player slot status comparison or something of the sort. You need to pick "If/then/else" then click the blue word condition an' pick player status/player slot status or something of the sort...I'm not infront of the editor or I'd be able to tell you exactly what it is (if all else fails go through each of the player options in conditions, not too many of them)


Its not remove unit array, its remove unit and the unit is a variable (you select it from the menu that comes up)

You'd have another trigger which runs before this one (or even a part of this one) which sets unitarray[1]=Unit that P1 has unitarray[2]=unit that P2 has ect (done using set variable)
08-03-2002, 11:14 PM#7
Guest
Alright i'm still pretty confused but I'll try to figure it out. Why couldn't they just keep it simple like in starcraft map maker. If you ever get the chance to pull out your map maker I would appriciate it if you could name the exact triggers and everything since this hole array player selection and all is really confusing. I'll try to see if i can't figure it out in the mean time.
08-04-2002, 01:14 AM#8
Guest
From what I understand, you want to create heroes ONLY for the players that are playing. A simple way to do this without variales (which I hate) is:


Map Initialization

If player (Insert whatever player here) is equal to playing

Create 1 (Unit you wanna create, the hero, whatever you want) at (Center of or random point in, your choice) (any region that you want)
08-04-2002, 01:55 PM#9
Guest
Hey that should work. Thanks. BTW i hate varibles much more than you. :)
08-04-2002, 11:28 PM#10
Khaoz
a very simple variable free method:

+events
Map Initialization

+conditions

+action
Unit Group - Select all units at regionX* matching [((owner of matching unit) slot status) not equal to (Is Playing)] and do [Unit - Remove (picked unit) from the game]


RegionX of course is a region that covers where all your starting units are.
08-05-2002, 12:45 AM#11
Newhydra
Khaoz, that'd work and get arround the problem in Arrow's method...

Arrows, your method will not work if he needs to later refer to the unit in an event (can't use variables there, have to use pre defined units)

And last, What I ment by the whole variable thing is this:
1)You go into the variable editor and create a new variable, call it unitArray.
2)Edit the properties of the variable and check the array option
3)In the start of the trigger have something which looks like this:
Set Variable unitArray (playerNumber([Owner of {unit}])={unit}

Unit being the unit that's owned by that player.

Then after you do that have a new action which says:

For each Integer a from 1 to [number of players] do if (Slot Status of [Owner of unitArray([Integer A]) is [unused] Then (Remove {unitArray[Integer A]) Else Do Nothing

Integer A is something you pick from the menus as is unused.


You could also, instead of what I just wrote above, do something which says

Pick Every Player in Player Group-All Players and Do (If (Player slot status is unused) then (remove unit (unitArray[Player Number(pickedPlayer)

Or you do what other people have suggested ;) Though I like using variables because they make the code that much more portable...(and easy to change)

That should be clearer for you =)
08-05-2002, 12:41 PM#12
Khaoz
I see what you mean and its a very good idea. Its good to get into the habbit of using variables to keep track of player's units, especially in an RPG. Yet the probem is, if Frvadi's starting units is say a wisp which is used to select a class, then it is really kinda useless to define those. What I like to do is attatch the variable setting to the class selection.

A Unit enters region1
XXX
unit is equal to (custom wisp)
XXX
remove (custom wisp)
Create (RPG Unit 1)
set (playerunitarray[playernumber of (owner of (trigger unit))] to (Last Created Unit)


basically like that....