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

Looking for a final answer on a trigger.

Status
Not open for further replies.
Level 2
Joined
Aug 18, 2008
Messages
8
I have been trying to find out the answer to my
problem for some time on the hive, what i
want to do is have a neutral passive transport type unit that if approached by a player its ownership is changed to the player that approaches it.

The trick is that i also want the transport to change back to
neutral passive once no units owned by a player are inside or around it.

I have been told to use regions for this situation, then told
that regions are not meant to move around that much. Any suggestions?

Light_Switch

EDIT: Sorry for not putting
  • on the title, I missed doing that.
 
Level 5
Joined
Oct 17, 2006
Messages
151
Ok well luckily this one is an easy one!

You do indeed use regions, but in order 2 explain this I will have 2 use "the box" for it.
Also, for this to work you will be needing to know how to use variables.

Ok, so this is what it would look like:
HTML:
Event:
- a unit enters region (specify your region)

Condition:
- Player owner of Unit entering region equal to Player 1 (pretending that this is the player you are referring to)

Actions:
- Give ownership of "the transport which should be a variable" to Player owning Entering Unit

Then you would need a second code if they go out of the region. Which would look like:
HTML:
Event:
- a unit leaves region (region specified once again)

Condition:
- Player owner of Unit entering region equal to Player 1 (same comment as above)

Actions:
- Give ownership of "the transport which should be a variable" to Neutral - Passive

There u go... that should work! :infl_thumbs_up:
 
Level 2
Joined
Aug 18, 2008
Messages
8
how do i make the region follow around the transport when it moves?

also why does the transport need to be a variable?
sorry but i like things explained so i can use them again if i ever have to
 
Level 5
Joined
Oct 17, 2006
Messages
151
sorry but i like things explained so i can use them again if i ever have to

Thats no problem! I share that same opinion. :grin:

If you want what you can do is set an event where every second (or if you want to be very accurate) every .01 second, you move the region to where ever your transport is (if your transport were a variable, this would be very easy.

The reason why I would make your transport a variable is so that if ever in the future I need to link to it, I know what it is right off the bat. However, if you don't want to make the special nifty variables (and your transport is pre-placed meaning it isn't created through a trigger), in the action "set ownership of (your transport) to Player 1", you can directly link to the transport if it is pre-placed on the map. But this will only work if units are not pre-placed on the map.

Does that explain it?
 
Level 2
Joined
Aug 18, 2008
Messages
8
I made 3 triggers like this:

Right Jeep A
Events
Unit - A unit enters Right Jeep <gen>
Conditions
(Owner of Jeep 0073 <gen>) Equal to Neutral Passive
((Triggering unit) is Mechanical) Equal to False
Actions
Unit - Change ownership of Jeep 0073 <gen> to (Owner of (Triggering unit)) and Retain color
__________________________________________________________________________

Right Jeep U
Events
Unit - A unit leaves Right Jeep <gen>
Conditions
(Owner of (Triggering unit)) Equal to (Owner of Jeep 0073 <gen>)
((Triggering unit) is Mechanical) Equal to False
Actions
Unit - Change ownership of Jeep 0073 <gen> to Neutral Passive and Change color
__________________________________________________________________________

Right Jeep M
Events
Time - Every 0.10 seconds of game time
Conditions
Actions
Region - Center Right Jeep <gen> on (Position of Jeep 0073 <gen>)
_____________________________________________________________________

This appeared to be working well at first because the i got control of the vehicle when i walked up to it, but i moved around a bit and got out I simply just lost control. If I walked back to the spot where the region originally was I would get control again.
It seems like the region isnt moving for some reason.
 
Level 5
Joined
Oct 17, 2006
Messages
151
I am sorry for not answering earlier, I had something come up (Democratic campaign FTW)

Anyways, I looked at the code you used which I am assuming is the "center region on wherever", and I noticed a note selecting that code

"This has no effect unless the specified region is a variable"

This means that in the very beginning of the game, you are going to have to set "Right Jeep" to a variable.

This might solve your problem :wink:
 
Status
Not open for further replies.
Top