J_Slash Posted April 16, 2005 Share Posted April 16, 2005 OK, i used one of TK102's scripts to prevent items from respawning when re-entering a module, the problem is they still respawn...i'm using beancounter's method to inject the script on entering...can somebody pleaz tell me what's wrong with the damn thing!! I'm going crasy!! here's the script: void main () { float x=7.09929f; float y=12.36148f; float z=-0.03665f; float r=0.0f; vector vecCont=Vector(x,y,z); location locCont=Location(vecCont, r); int nBoolSlot=6; //any number 0-7 can be used here object oContainer=GetNearestObjectToLocation (OBJECT_TYPE_PLACEABLE, locCont); int nCheck=GetLocalBoolean(GetFirstPC(), nBoolSlot); if (nCheck) { return; } CreateItemOnObject("pc_lghtsbr", oContainer, 2); SetLocalBoolean(oContainer, nBoolSlot, TRUE); } Link to comment Share on other sites More sharing options...
boinga1 Posted April 16, 2005 Share Posted April 16, 2005 I personally used The tutorial It suggests using the OnEnter script like this: void main() { object oEntering = GetEnteringObject(); object npctest = GetObjectByTag("npc_vash"); if (GetIsPC(oEntering)) { if (GetIsObjectValid(npctest) == FALSE) { ExecuteScript("my_spawn_script", OBJECT_SELF); } } ExecuteScript("normal_script", OBJECT_SELF); } This is from K1, so it may be outdated, but I think it can be modified to work Link to comment Share on other sites More sharing options...
stoffe Posted April 16, 2005 Share Posted April 16, 2005 Originally posted by J_Slash OK, i used one of TK102's scripts to prevent items from respawning when re-entering a module, the problem is they still respawn...i'm using beancounter's method to inject the script on entering...can somebody pleaz tell me what's wrong with the damn thing!! I'm going crasy!! here's the script: Well, at a quick glance I see one bug that might cause your problem. You check for the boolean value on the Player but set it on the container. Try this instead: void main () { location locCont = Location(Vector(7.09929, 12.36148, -0.03665), 0.0); object oContainer = GetNearestObjectToLocation( OBJECT_TYPE_PLACEABLE, locCont ); if (!GetLocalBoolean(oContainer, 6)) { CreateItemOnObject("pc_lghtsbr", oContainer, 2); SetLocalBoolean(oContainer, 6, TRUE); } } Link to comment Share on other sites More sharing options...
J_Slash Posted April 16, 2005 Author Share Posted April 16, 2005 Actually, the problem isn't in the On-Enter script, this one works fine, the problem is with the respawning items!! the script that i posted is supposed to prevent them from respawning, but for some reason it doesn't work!!!! Thanx for the reply though Oh hey Stoffe!! thanx man, i'll try it and get back to u!! EDIT: It seems to work just fine now!!!Thanx Stoffe, you're a life saver!! Link to comment Share on other sites More sharing options...
tk102 Posted April 16, 2005 Share Posted April 16, 2005 Yes thanks Stoffe! Did I really write that script? I normally don't set locals on creatures. I must've been asleep at the wheel. Link to comment Share on other sites More sharing options...
J_Slash Posted April 17, 2005 Author Share Posted April 17, 2005 That's ok TK102, actually because of this, i now actually understan how the script works!!yay! but u should correct it though, it's in the scripting tutorials, under spawning items, placeables,... Thanx TK102. Edit tk102: Fixed. I'm going to plead innocent on this since I wasn't the last one to edit that tutorial... right Darth333? Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.