agoon12 Posted April 20, 2011 Share Posted April 20, 2011 Alright, so here's what I'd do. Might not be the most elegant way, but whatever, it should work just fine. Create a new quest, e.g. "NpcControlQuest".Create a new script, set it to "Quest Script": scn NpcControlQuestSCRIPT short NpcDelete Now save it, go back to the Quest you've created before and set the Script to the Quest's Questscript.So basically, this script just defines the variable "NpcDelete", but it doesn't do anything with it. It's just necessary to define all variables used. Now open the script that you've put onto your NPCs (that one with the begin ondeath) and add the following somewhere above the begin ondeath line: begin gamemode if ( NpcControlQuest.NpcDelete == 1 ) disable markfordelete set NpcControlQuest.NpcDelete to 0 endif end Alright, so what this does is that as soon as that the var NpcDelete is set to 1, it will disable and delete the NPC + set the Var to 0. Once the var is set to 1, this script will run in all your NPCs, deleting them. After that, the variable is set to 0, which then ensures that newly placed NPCs don't get deleted right away. Now, all you need to do is to change the Terminal script. So add the line set NpcControlQuest.NpcDelete to 1 to the terminal option. Something like "Delete all NPCs" or whatever your name for that may be. Alright, I'm quite sure this works, if it doesn't then there is some minor mistake with addressing the variables properly, I'll fix that tomorrow. I don't have access to a GECK right now, so I made that up without really testing itl. It's the best you can get from me right now. But as said, tomorrow I'll have a GECK at hand and then I'll fix any errors occuring. Hope this helped. Link to comment Share on other sites More sharing options...
Min1ons Posted April 20, 2011 Author Share Posted April 20, 2011 YES! Not perfect but A LOT better, the only problem is that only one at a time gets deleted, and you have to constantly enter and exit the terminal. If there is a way to delete them ALL at one time, that would be better. Other then that, thanks for the help! :biggrin: :biggrin: :biggrin: Link to comment Share on other sites More sharing options...
agoon12 Posted April 21, 2011 Share Posted April 21, 2011 Alright, that was what i feared would happen.Hmm, lets try something: Alter the scripts to the following: Quest Script: scn NpcControlQuestSCRIPT short NpcDelete begin gamemode if ( NpcDelete == 1 ) set NpcDelete to 0 endif end NPC Script begin gamemode if ( NpcControlQuest.NpcDelete == 1 ) disable markfordelete endif end You don't need to change the terminal command at all. Okay, and in addition to this, change the script delay of your controlquest in the quest tab to something like 5 seconds.In the previous version the first NPC would delete itself and then reset the NpcDelete-value to 0, causing the other NPCs to not delete themselves (because the value was 0 again). Now I put the reset-thingy into the quest script, due to the script delay of 5 seconds it will only check whether the value is 1 once every 5 seconds, giving all the NPCs the time to delete themselves. This is not the most elegant way, I'll write a better script with timer involved later. Glad that I could help you. BTW: If you want to have a hundred percent working method, then just remove [/size] [size="1"]if ( NpcDelete == 1 ) set NpcDelete to 0[/size] [size="1"]endif[/size][size="1"] from either script and add a second terminal command. Like that you can choose from "Deleting Mode" and "Spawning Mode", then the first command line gets set NpcControlQuest.NpcDelete to 1 and the second line gets set NpcControlQuest.NpcDelete to 0 . This will work for sure, only thing ist that you have to stop the deleting proccess manually. But as I said, I'll develop some elegant scripts later! ;) Link to comment Share on other sites More sharing options...
Min1ons Posted April 21, 2011 Author Share Posted April 21, 2011 :verymad: it did delete all of them, all the NPC's spawned are deleted. however once you activate the button, the future NPC's get deleted right when they spawn. :wallbash: Link to comment Share on other sites More sharing options...
agoon12 Posted April 22, 2011 Share Posted April 22, 2011 Okay, that means the value does not get resetted properly.If you use a button instead of a terminal now, just put the following script on the button. scn Whatevernamethisscriptmighthave short doonce float timer begin onactivate if ( doonce == 0 ) set doonce to 1 set NpcControlQuest.NpcDelete to 1 set timer to 5 endif end begin gamemode if ( doonce == 1 ) if ( timer > 0 ) set timer to ( timer - getsecondspassed ) else set doonce to 0 set NpcControlQuest.NpcDelete to 0 endif endif end This will do the job by first deleting all the NPCs and after 5 seconds resetting the value so that you may spawn new NPCs. It's for a button or switch and not for a terminal though. Link to comment Share on other sites More sharing options...
Recommended Posts