Exile007 Posted June 19, 2008 Share Posted June 19, 2008 Hello there Holowan, I have NO idea why the hell this script is not working! It is fine as far as I can tell, yet for some reason it will not work! What I'm trying to do is fairly simple. I'm trying to start a conversation that will only fire off once, as soon as I enter a module. I have attached it to the OnEnter part of the .are file. void main() { int i = GetGlobalNumber("833_sith"); if(i==0) { object oPC=GetFirstPC(); object oSith=GetObjectByTag("g_cradus"); ActionDoCommand(SetCommandable(TRUE, oSith)); AssignCommand(oSith, ActionStartConversation(oPC, "open")); SetGlobalNumber("833_sith", 1); } } If someone could tell me what I did wrong, I would greatly appreciate it. I probably missed something too. Please excuse me if I sound too pissed off, you must understand I have been at trying to make this work for three days. Link to comment Share on other sites More sharing options...
Gavroche Posted June 19, 2008 Share Posted June 19, 2008 What does not work? Does the dialogue fire as many times as you want while it's meant to fire once only, or just not at all? If it's the latter, just a simple question, are you sure 833_sith is set to 0 by default? I'm not familiar with dialogue firing syntax yet, so the error could also be in the instructions, I can't tell. Link to comment Share on other sites More sharing options...
deathdisco Posted June 19, 2008 Share Posted June 19, 2008 I'm no expert in scripting but if you are using an "if" statement, shouldn't there be an "else" statement somewhere in there? Link to comment Share on other sites More sharing options...
Gavroche Posted June 19, 2008 Share Posted June 19, 2008 Don't think so. Perhaps it makes the code less conventional, but it should not be less functional. What would we put in the "else" anyway? else {do(nothing);} '^^ Here if the condition is not met (which happens any time 833_sith is not 0), the script will simply do nothing. And that's what we want. Link to comment Share on other sites More sharing options...
Darth InSidious Posted June 19, 2008 Share Posted June 19, 2008 Try using a boolean instead of a number. Link to comment Share on other sites More sharing options...
stoffe Posted June 19, 2008 Share Posted June 19, 2008 I have NO idea why the hell this script is not working! It is fine as far as I can tell, yet for some reason it will not work! This problem might be caused by the fact that you don't check who is entering the area before triggering the script. If some NPC is spawned into the area before the player character is, the script will trigger, the global var will be set, but the start conversation function will fail since the player character isn't present in the area yet. (Also, areas have no action queue IIRC, so the ActionDoCommand() function will not be meaningful to use.) Try checking that the character entering is the player character before executing the rest of the script. Like: void main() { object oPC = GetFirstPC(); if ((GetEnteringObject() == oPC) && (GetGlobalNumber("833_sith") == 0)) { object oSith = GetObjectByTag("g_cradus"); SetCommandable(TRUE, oSith); DelayCommand(0.5, AssignCommand(oSith, ActionStartConversation(oPC, "open"))); SetGlobalNumber("833_sith", 1); } } Link to comment Share on other sites More sharing options...
Exile007 Posted June 19, 2008 Author Share Posted June 19, 2008 My apologies for not saying what wasn't working. How very smart. Basically the conversation wasn't starting at all. Thank you very much stoffe, that script worked like a charm. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.