Scripting Function Question

Hey again! I have a question. how do I make the NPC look to a specific location through scripting?
-Manvar-

I think that there may a script to do that in NwN’s scripting FAQs, although there may be better ways of doing it NwN 2. Same thing may be true with the contents of the old NwN scripts I gathered together. Anyway here are the links if you want to take a look -

Just The FAQs, ma’am

and the old scrips -

Unearthed Gold
Yet More Gold
Final Gold

TR

1 Like

Hey, @Tarot_Redhand thanks for the answer. I found a command “SetLookAtTarget” which requires a vector. Though, what is a vector? Seriously is it a trigger or coordinates? I don’t know. Anyway, reply if you can.
-Manvar-

No, it’s not a trigger. It’s not coordinates either, but it can be considered as a difference in coordinates between the destination point and the starting point. If you play chess, just think about the way the knight moves: 3 up, 1 left (or 3 up, 1 right or 3 right, 1 up etc…): the vectors representing this move would be (3, -1, 0) or (3, 1, 0) or (1, 3, 0) etc…

2 Likes

If it’s in a conversation put an invisible tiny creature there with an individual tag and just put that tag as the listener on the conversation line that’s playing when you want it to happen. You can destroy the creature in the conversation when it’s work is done with the ga_destroy script.

There are also I points ( like waypoints ) that you can use for this in the blueprints.

1 Like

if owner of the script (OBJECT_SELF) is the facer →

object oObjectToFace = ; // an object to face
SetFacingPoint(GetPosition(oObjectToFace));

if owner of the script (OBJECT_SELF) is not the facer →

object oFacer = ; // the object that turns to face
object oObjectToFace = ; // an object to face

AssignCommand(oFacer, SetFacingPoint(GetPosition(oObjectToFace)));

----
SetFacing(float fDirection) should also work, where fDirection is a compass pt in degrees (0° is east iirc)

 

@Tsongo Waypoints should work also, they are objects after all, unless you really want the object to be the ConversationOwner …

 

@4760 vectors can be coordinates or the difference between two other coordinates … it’s all math(s)

2 Likes

kevL_s… Good to see the (s) in maths to keep us Brits happy !

1 Like