View Single Post
Old 03-29-2013, 11:00 PM   #8
Fair Strides
@Fair Strides 2
Witty Programmer
Fair Strides 2's Avatar
Status: Moderator
Join Date: Jan 2012
Location: Oregon, United States
Posts: 756
Current Game: Master of Orion 2
Originally Posted by arsenalforever View Post
Okay, I've managed to write this piece of code thanks to zbyl2 on the Deadly Stream forums:

void main()
object oNPC = CreateObject(OBJECT_TYPE_CREATURE, "g_gammorean", Location(Vector(25.0,34.0,65.0), 0.0f));
DelayCommand(5.0, AssignCommand(oNPC, ActionStartConversation(GetFirstPC(),"Gamorrean")));
Now how do I get it to run once I'm on Onderon and go anywhere near the gammorean?
You can make a custom OnHeartbeat script which will check if you are X meters away from him, and if so, execute the script.

void main() {
    ExecuteScript("k_ai_master", OBJECT_SELF, KOTOR_DEFAULT_EVENT_ON_HEARTBEAT);

if(GetLastPerceived() == GetFirstPC) {
    ExecuteScript("convstart", OBJECT_SELF);
That code should work if placed as the OnHeartbeat script. All you have to do is replace "convstart" with the name of your and Zybl's script, while still being in quotes. If it son't work, come back and I'll try to help.

All of my mods are available on Deadlystream.

Always remember modders: "Quality= Effort*Time"

KSE 3.3.7 is LIVE!!! Check it out here.
Fair Strides 2 is offline   you may: quote & reply,