Saturday, April 14, 2012

"Attack Move-To" orders units to return?

[:1]Hey. I got this problem. I want to change the owner of units once they get trained, then I want them to "Attack Move" a certain location, but once they get there (and sometimes when they kill something on the way) they go back to the building which trained them. It's really weird.


Code:
Unit - Change ownership of (Trained unit) to (Player(((Player number of (Owner of (Triggering unit))) + 1))) and Change color
Unit - Order (Trained unit) to Attack-Move To (Rally-Point of (Triggering unit) as a point)

thats what the trigger looks like. It works perfectly if I remove the
Code:
Unit - Change ownership of (Trained unit) to (Player(((Player number of (Owner of (Triggering unit))) + 1))) and Change color

(only, I remain in control over the units, which I don't want :P)|||well, your trigger unit is the finishing training building. change trigger unit by trained unit in the "order" line.|||If the player has no AI and its not a human player its treated like neutral hostile (at least I think). Anyway, under gameplay constants there should be something that changes the creep return distance or something along those lines. Set it to 999999999 or whatever and it should work, although I'm not exactly sure that this is the cause of your problem.|||nothing worked :S

i tried changing

Creeps - Guard Distance,

Creeps - Guard Return Distance,

Creeps - Return Time (sec) and changing "Triggering Unit" to "Trained Unit"|||Quote:




nothing worked :S

i tried changing

Creeps - Guard Distance,

Creeps - Guard Return Distance,

Creeps - Return Time (sec) and changing "Triggering Unit" to "Trained Unit"




hi dude thanksNS0-501

for nice post.,.|||Hey guy, so as I was browsing around and I came across your problem... I just want to say that it looks like you are overthinking your triggers. I'm thinking that because when I look at your code issue you have the right categories, it just seems your filling out the inputs wrong... Let me show you!


Code:
Unit - Change ownership of (Trained unit) to (Player(((Player number of (Owner of (Triggering unit))) + 1))) and Change color
Unit - Order (Trained unit) to Attack-Move To (Rally-Point of (Triggering unit) as a point)

Is what you came up with.

Now this is what I think you were trying to come up with.


Code:
Unit - Change ownership of (Trained unit) to Player 12 and Change color
Unit - Order (Trained unit) to Attack-Move To (MoveRegion)

Now you can either steal what I have shown you or learn from it!

Something you have to remember when using triggers is that you have to use regions and variables to make advanced functions. I'm pointing that out because the methods your were using suggests that you are relying heavily on the trigger to do the work.

By setting Player 11 and 12 as your "computer players" (by making teams and what not) you can have an easier method for using the "Unit - Change ownership" command at least in comparison to what you were trying to do, haha.

As for using "Unit - Order" commands to get units to move, I would highly suggest using regions whenever possible. As you can see it becomes slightly confusing when simpy using triggers (though it is possible in ways).

One thing I also always tell myself (more useful when starting out) is that if the trigger doesn't make vague sense when I read it out as a sentence, it most likely won't work right. But realise that you may not necessarily know what it is referring to which is not what I'm referring to... (rambling!)

Anyways, if I was unclear in anyway feel free to send me a message regarding this or any other map creating issues that may arise. That goes for everyone, I will gladly help you if needed! :)

No comments:

Post a Comment