Stream Posted January 3, 2008 Share Posted January 3, 2008 I've created a trigger to fire a script to make an NPC walk to the PC and start a conversation. The trigger is set up fine but I'm having some trouble with the script. This is the script; void main() { object oNPC=GetObjectByTag("Deadly_IC_Sul_1"); object oPC=GetFirstPC(); int bRun=FALSE; if (GetJournalEntry("deadlyictra")==70); return; vector MoveTo = GetPosition(oPC); location lExit=Location(MoveTo,0.0f); ActionDoCommand(SetCommandable(TRUE,oNPC)); AssignCommand (oNPC,ActionForceMoveToLocation(lExit,bRun)); AssignCommand(oNPC, ActionStartConversation(GetFirstPC(), "", 0, 0, 0, "", "", "", "", "", "", 0, 0xFFFFFFFF, 0xFFFFFFFF, 0)); } How it is there, the script won't fire - but if I remove the part about a journal entry the script will then fire. Obviously I need to keep it in as I don't want the trigger to fire the script unless the quest is at the right entry. The script complies fine whether the journal entry part is in or not. If anyone's got any ideas I'd really appreciate it as I can't for the life of me think what the problem is. Kind Regards --Deadly Stream Link to comment Share on other sites More sharing options...
stoffe Posted January 3, 2008 Share Posted January 3, 2008 I've created a trigger to fire a script to make an NPC walk to the PC and start a conversation. The trigger is set up fine but I'm having some trouble with the script. How it is there, the script won't fire - but if I remove the part about a journal entry the script will then fire. Obviously I need to keep it in as I don't want the trigger to fire the script unless the quest is at the right entry. You have a semicolon after the if-statement checking the quest stage, ending the statement there. As such the next line (return;) will always be run and terminate the script. You should also check who's tripping the trigger since the script will run whenever anyone steps on it, not just the main character. Like: void main() { object oPC = GetFirstPC(); if (GetEnteringObject() == oPC) { if (GetJournalEntry("deadlyictra") == 70) return; object oNPC = GetObjectByTag("Deadly_IC_Sul_1"); SetCommandable(TRUE, oNPC); AssignCommand(oNPC, ActionForceMoveToObject(oPC)); AssignCommand(oNPC, ActionStartConversation(oPC)); } } Link to comment Share on other sites More sharing options...
Stream Posted January 3, 2008 Author Share Posted January 3, 2008 I can't believe I put that semicolon in there, I didn't even realise I'd done it - what a fool. I'm not exactly the best of scripters but I've done enough to know better than that. I never thought about checking who's tripping the trigger, thanks for pointing that out Stoffe, that could've caused a few problems. Regards --Deadly Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.