HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Create unit facing Position AND Angle

07-31-2003, 10:41 PM#1
Panto
Greetings.

I have a trigger which creates a unit. I'm trying to make the unit faces a certain number of degrees away from a unit.

It isn't working. Here's my test actions:
Quote:
Unit - Create 1 Peasant for (Picked player) at ((Picked player) start location) facing (Position of Castle 0012 <gen>)
Unit - Make (Last created unit) face ((Facing of (Last created unit)) - 45.00) over 0.00 seconds
I would expect this to create the Peasant facing the Castle, and then turn him to be facing 45 degrees further to the peasant's right.

However, apparently the second part of the trigger isn't working. Got any ideas why? He successfully faces the Castle but not then away from it.
08-01-2003, 03:39 AM#2
FyreDaug
Try adding a small wiat between each trigger action.
08-01-2003, 04:35 AM#3
Nemesis9x
what is this???? i dont think this should be here. ((Facing of (Last created unit))
08-01-2003, 04:42 AM#4
ceb5503
after you create the unit, create a variable to store the units current facing. Then, for the move direction, just replace facing of last created unit with the variable.
08-01-2003, 05:15 AM#5
Panto
Mm hm, I tried your suggestion before, too, ceb5503. It didn't work, either.

I wonder if there's some property of the unit that it's not letting itself move.

I made a similar trigger (that simply adjusted a different unit's facing angle when you hit Esc), and the unit moved just fine. Interestingly, though, it didn't do it instantly (as 0.00 seconds would imply). Instead, it moved over about a second. That's a shame.
08-01-2003, 07:13 AM#6
ceb5503
Don't know why it didn't work. I tested it just now myself. Here is what I did.

Untitled Trigger 001
Events
Player - Player 1 (Red) types a chat message containing hi as An exact match
Conditions
Actions
Unit - Create 1 Footman for Player 1 (Red) at (Center of Region 000 <gen>) facing (Position of Town Hall 0000 <gen>)
Set hi = (Facing of (Last created unit))
Unit - Make (Last created unit) face (hi - 90.00) over 0.01 seconds


It probably would have worked without the variable to, but I figure oh well. This trigger worked off of me typing hi. Just a simple trigger. It started off facing the castle which was right above it, and then it turned to the East. I didn't test it with 0.00 seconds, so perhaps that is the problem?
12-16-2003, 02:35 AM#7
volatile
ceb5503 how the heck did you set the variable "hi" to the current facing degree??? I can't figure it out anywhere, is it a WEU function only? I'm using UMSWE.

Set hi = (Facing of (Last created unit))
12-16-2003, 02:42 AM#8
FyreDaug
Why the fuck are you reviving dead threads? Quit doing it!

EDIT: And hi would be a real variable
12-16-2003, 03:15 AM#9
Aiursrage2k
There is a animation function called

SetUnitTurnSpeedBJ(unit,real)
If you changed the units turn speed to zero it might work.
12-16-2003, 09:41 PM#10
volatile
Um, gee, the profanity could be taken out of that reply. I would rather search for something and comment on it rather than open a new thread asking the same old question that 1000 others have asked. If a MODERATOR would tell me that people are not supposed to revive dead threads then I would open a new thread for my questions. However, I now have another question, how do you know if a thread has been closed or not?
12-16-2003, 09:55 PM#11
AlasdairJC
If it's closed, you can't reply to it. But, people get pissed off if you "revive" threads, that is, take a thread that has "died"(Not had any responses for ages, and probably won't recieve any more), and reply to it, pushing it back to the top of the list. Anyway, why not use trig?( tan-1( (vertical distance from castle)/(horizontal distance from castle) ) )+ 45
12-17-2003, 04:01 PM#12
Panto
To be totally truthful, there isn't anything inherently wrong with posting on a thread that hasn't received attention in a long time, providing that your post is relevant to the thread, isn't already answered in the thread discussion, and is more than a discussion of a minor point.

As far as searching for relevant topics, I applaud that, really. You could have posted a new thread, but this thread is pertinent to your goal, so I don't mind.

Some people have seized on "replying to old threads" as one of those cut-off-his-tongue crimes because they see people complain about threads that get revived. Generally speaking, a lot of, err, irritating forum-posters have a tendency of going back into the depths of the forum and posting relatively meaningless responses to ancient topics. Those are bad. Sleeping dragons should not be disturbed by the court jester.

On the other hand, if you have some gold to contribute to the dragon's hoard, I don't think he'd mind a bit.
12-18-2003, 06:17 AM#13
Balthamos
Ok after reading the thread I'm not really sure if Panto was able to fix his bug so I may as well post how I'd do it.

Unit - Create 1 Peasant for (Picked player) at ((Picked player) start location) facing ((Angle from ((Picked Player) start location) to (Position of Castle 0012 <gen> )) - 45.00) degrees

That's how I would do it and I've tested it already for you, works fine, hope this helps.