KimCheeWarrior Posted February 15, 2012 Share Posted February 15, 2012 is there anyway to make a mod where a dead body automatically disappears after you loot it completely? Link to comment Share on other sites More sharing options...
caramellcube Posted February 15, 2012 Share Posted February 15, 2012 (edited) It might be difficult to apply this universally, and might not be the most efficient method, but you could add a script to a base NPC or creature with something like this if (GetDead==1) && (GetItemCount MyList < 1) Disable MarkForDelete endif MyList would be a list of all possible items that NPC would be likely to have (don't call it MyList though, that's asking for a conflict). So any time that the NPC is both dead and doesn't have any of the items in that list, it should automatically be deleted. If NPC's have an OnClose event, then that would be the best blocktype to use, as it would only run if the player loots the corpse. I think OnClose needs a closing animation in order to work though, so it might need to be some other blocktype, maybe set as an effect script, but that's likely to be a lot more wastefull of resources as it'll check through that list about 30 times a second, per NPC on screen. If it has to be an effect script, then a timer might help with that, or something like this if (GetDead==1) if (GetItemCount MyList < 1) Disable MarkForDelete endif endif but I've only just started NPC scripting so maybe someone else can suggest something more efficient? EDIT - thinking about it, the 2nd script should be way less laggy than the 1st, so unless you can put it in an OnClose block, i'd say use the 2nd. Edited February 15, 2012 by caramellcube Link to comment Share on other sites More sharing options...
KimCheeWarrior Posted February 15, 2012 Author Share Posted February 15, 2012 i have absolutely no experience in this field. i just use these mods, i dont make em. lol sounds like you might be on to something though but it sounds like a lot of work. i didnt realize that it would be that difficult to create a mod like this, at least, it sounds difficult from the way you explained it. Link to comment Share on other sites More sharing options...
caramellcube Posted February 15, 2012 Share Posted February 15, 2012 well, the script itself would be simple enough, I may have made it sound overcomplicated with all the stuff about efficiency. The hard part would be adding the script to every generic base npc in the game, but that's more time consuming than difficult, and once it's done, any changes made to the script would automatically update everything that has it. I might be able to try this but I've got a backlog of work on a mod I'm already doing. If anyone else wants to try it though hopefully this could be of some help. Link to comment Share on other sites More sharing options...
KimCheeWarrior Posted February 15, 2012 Author Share Posted February 15, 2012 well, the script itself would be simple enough, I may have made it sound overcomplicated with all the stuff about efficiency. The hard part would be adding the script to every generic base npc in the game, but that's more time consuming than difficult, and once it's done, any changes made to the script would automatically update everything that has it. I might be able to try this but I've got a backlog of work on a mod I'm already doing. If anyone else wants to try it though hopefully this could be of some help.i didnt realize that making a mod like this would be so time consuming but if someone were to do it, i would be infinitely grateful. Link to comment Share on other sites More sharing options...
betto212 Posted February 16, 2012 Share Posted February 16, 2012 It might be difficult to apply this universally, and might not be the most efficient method, but you could add a script to a base NPC or creature with something like this if (GetDead==1) && (GetItemCount MyList < 1) Disable MarkForDelete endif MyList would be a list of all possible items that NPC would be likely to have (don't call it MyList though, that's asking for a conflict). So any time that the NPC is both dead and doesn't have any of the items in that list, it should automatically be deleted. If NPC's have an OnClose event, then that would be the best blocktype to use, as it would only run if the player loots the corpse. I think OnClose needs a closing animation in order to work though, so it might need to be some other blocktype, maybe set as an effect script, but that's likely to be a lot more wastefull of resources as it'll check through that list about 30 times a second, per NPC on screen. If it has to be an effect script, then a timer might help with that, or something like this if (GetDead==1) if (GetItemCount MyList < 1) Disable MarkForDelete endif endif but I've only just started NPC scripting so maybe someone else can suggest something more efficient? EDIT - thinking about it, the 2nd script should be way less laggy than the 1st, so unless you can put it in an OnClose block, i'd say use the 2nd. why the second would be less laggy ? if two "ifs" are toggether if the first one fail the second is tested anyway ? Link to comment Share on other sites More sharing options...
chaosislife Posted February 16, 2012 Share Posted February 16, 2012 Bearing in mind that i don't actually code the second one looks like it would cause an error somewhere to me. Shouldn't if statements have an else? Would it just run a loop without one? Would it still try to run the second if check if the first failed? if it ran the second one and found no inventory wouldn't it just delete any critter living or dead that had no inventory? Link to comment Share on other sites More sharing options...
caramellcube Posted February 16, 2012 Share Posted February 16, 2012 betto212 - ok, it might not be less laggy in the 2nd version if the software runs each IF statement in order and stops if any return false. I don't know how multiple IF statements on a single line are handled so the 2nd version is just an extra way of making sure it works out that way. chaosislife - I haven't tested this particular code but if an IF statement fails it should jump directly to that statement's ENDIF point. I just re-checked the scripting tutorial on the geck wiki and it doesn't look like an ELSE statement is necessary. Link to comment Share on other sites More sharing options...
KimCheeWarrior Posted February 16, 2012 Author Share Posted February 16, 2012 Bearing in mind that i don't actually code the second one looks like it would cause an error somewhere to me. Shouldn't if statements have an else? Would it just run a loop without one? Would it still try to run the second if check if the first failed? if it ran the second one and found no inventory wouldn't it just delete any critter living or dead that had no inventory?if the critter had no inventory then he aint worth livin. j/k :P Link to comment Share on other sites More sharing options...
redeyesandlonghair Posted February 16, 2012 Share Posted February 16, 2012 Bearing in mind that i don't actually code the second one looks like it would cause an error somewhere to me. Shouldn't if statements have an else? Would it just run a loop without one? Would it still try to run the second if check if the first failed? if it ran the second one and found no inventory wouldn't it just delete any critter living or dead that had no inventory? It has to get past the first If statement (where it checks if the thing is dead) to get to any statements inside that If statement. It wouldn't delete any living creature without an inventory, though it would delete dead creatures with no inventory as soon as they register as dead. Adding a timer that delays the deletion for a few seconds would prevent things from vanishing the second you kill them. Of course, you might not care about that anyway, since this is an immersion-breaker anyway. Link to comment Share on other sites More sharing options...
Recommended Posts