OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: shadow99 on 23 Jul 2004, 07:18:14
-
You can guess what this thread is about. How do I make a unit face another unit by rotating on the spot? Doing it through scripting would be my first choice...
-
try using
unitname dowatch unit2name
in an trigger/init/script/etc..
:cheers:
-
No dice. Not in a camera script anyway. I'll try init...
-
Actually, yes. It does work. Sorry...
-
Well it kind of does and kind of doesn't. It seems to work for three of the characters, but one of them stares at their left and to the ground.
-
Maybe I could make a stationary unit for them to look at...
-
Maybe the other guys have treated him bad..
And he is too ashamed to look at them.
Perhaps a scipt isn't always the best thing to solve the situation.
I suggest you talk to the Unit to make sure he know that you appreciate him.
-
Unless you've typed the unit's name wrong or something, it should work for all units just the way Kaliyuga said above.
You can also try dotarget with the same method in addition to the dowatch.
Another exciting fact is that you can actually edit your own posts here in the forums. Just press (http://www.ofpec.com/yabbse/YaBBImages/modify.gif) which can be found in the top right corner of your every post when viewing the topic. :)
-
The problem with doWatch is that the command is satisfied as long as the target object is within the field of view of the loon who is watching. Since a loon's field of view is quite wide, this means that he can apppear to be looking in an entirely different direction and still obey the command.
The solution - although you can't let the player see this happening - is to use a setDir command.
In general lines of code work equally well in scripts, triggers, waypoints and init fields. (There are rare exeptions for init fields.) Usually when a line of code "doesn't work" the problem is one of syntax. Always check it with the command reference.