Trex Posted December 16, 2011 Share Posted December 16, 2011 Hi everyone. I have what I feel is an odd problem and would appreciate some advice. I am trying to find a sensible way for my ship to fill up with the appropriate crew, once they have been recruited. I have a script I fire from the "on enter" of the area file, which seems to work : int StartingConditional() { if (GetGlobalNumber("hk47aboard") == 1) { CreateObject(OBJECT_TYPE_CREATURE, "p_hk47", Location(Vector(14.7,-34.7,11.06), 1.2)); } return FALSE; } But instead, I get this : The HK's don't infinitely spawn, they just get to that amount and in about a second, then stop. Any suggestions on what I might be doing to cause this and how I could get it to stop? Link to comment Share on other sites More sharing options...
Marius Fett Posted December 16, 2011 Share Posted December 16, 2011 Well, I couldn't see anything wrong with that script, so I wrote it out again myself and it works perfectly: int StartingConditional() { if (GetGlobalNumber("hk47aboard") == 1) { CreateObject(OBJECT_TYPE_CREATURE, "p_hk47", Location(Vector(14.7,-34.7,11.06), 1.2)); } return FALSE; } There it is with all your co-ordinates and your global in it, see if it works for you. Weird how mine worked when it's identical to yours from what I can see. Link to comment Share on other sites More sharing options...
Trex Posted December 16, 2011 Author Share Posted December 16, 2011 Thanks for your help, but I'm afraid it still didn't work correctly. What I've ended up doing is using the script during an initial conversation that fires when you enter the mod, and that seems to solve the issue. It's still very bizzare that to me that it wouldn't work the other way though. If they kept on appearing infinitely, I could sort of understand where the problem might come from, but it's very odd that about 20 spawn and that's it. Link to comment Share on other sites More sharing options...
Marius Fett Posted December 16, 2011 Share Posted December 16, 2011 Weird then, how it worked for me. Oh well, these things happen, eh? Good luck with the rest of your project! Link to comment Share on other sites More sharing options...
Fastmaniac Posted December 16, 2011 Share Posted December 16, 2011 So what you're saying is, that this script is fired when you're in a conversation... Then I don't get why you're using a StartingConditional... Nothing is going to be done with the output. It just happens. That's when you use void... The script is probably not working because you're creating an integer, which is a number but you're actually returning a procedure... Link to comment Share on other sites More sharing options...
newbiemodder Posted December 17, 2011 Share Posted December 17, 2011 This happened to me once on an OnOpen script...I think you need to add a conditional/check for the party member to spawn ONCE on your onenter script in addtion to you checking your global "hk47aboard"...I'm no good at scripting maybe someone with better scripting can point you in the right way. Link to comment Share on other sites More sharing options...
Trex Posted December 17, 2011 Author Share Posted December 17, 2011 So what you're saying is, that this script is fired when you're in a conversation... Then I don't get why you're using a StartingConditional... Nothing is going to be done with the output. It just happens. That's when you use void... The script is probably not working because you're creating an integer, which is a number but you're actually returning a procedure... It was originally just an onenter script, but I added a conversation to the start of the module instead, then changed it to a "void main" script that fires during the conversation. Link to comment Share on other sites More sharing options...
Exile007 Posted December 19, 2011 Share Posted December 19, 2011 Int StartingConditional is used to determine whether or not a node of dialog is available. Void Main is used in every other case. As far as your script goes, I would do this: //This is the on-enter script for the Eagle I presume void main() { if ((GetGlobalNumber("hk47aboard")==1) && (!GetIsObjectValid(GetObjectByTag("HK TAG HERE")))) { CreateObject(OBJECT_TYPE_CREATURE,"p_hk47",Location(Vector(14.7,-34.7,11.06),1.2)); } } That should work. But who knows with the Kotor games. Scripts don't have a tendency to produce precise results. Link to comment Share on other sites More sharing options...
Darth InSidious Posted December 19, 2011 Share Posted December 19, 2011 There's also the issue that... you currently are not setting the global number "hk47aboard" agai. So the game will keep spawing HK because you haven't told it not to. If I were to adapt Exile's otherwise excellent script, I would do this: void main() { if ((GetGlobal[b]Boolean[/b]("hk47aboard")==[b]FALSE[/b]) && (!GetIsObjectValid(GetObjectByTag("HK TAG HERE")))) { CreateObject(OBJECT_TYPE_CREATURE,"p_hk47",Location(Vector(14.7,-34.7,11.06),1.2)); [b]SetGlobalBoolean("hk47aboard", TRUE);[/b] } } Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.