redgnom Posted April 11, 2011 Share Posted April 11, 2011 I trying to make a Corpse Removal mod by myself.To reduce the mountains of corpses after IWS and etc.But i don't have any exp in writing scripts.( I find the way, how to check corpse dead-time, and mark it to delete. but don't know how to automaticly select a "dead" Actors in the area one after another, to check them out for delete. Now all what I have is: if target.IsActor if target.GetDead if target.GetTimeDead > 24 Disable markForDelete endif endif endif but iduno how to get this "target". T____T Please, Help. Link to comment Share on other sites More sharing options...
devinpatterson Posted April 11, 2011 Share Posted April 11, 2011 (edited) Just curious how come you mark them for delete instead of just target.disable? I'm also wondering if FlushNonPersistActors from fose might be useful in your script. Edited April 11, 2011 by devinpatterson Link to comment Share on other sites More sharing options...
redgnom Posted April 11, 2011 Author Share Posted April 11, 2011 'disable' only turns off rendering and AI. But object is still in game.I read it in the 'help'.) Link to comment Share on other sites More sharing options...
angelwraith Posted April 11, 2011 Share Posted April 11, 2011 requires NVSE. what your looking for is called refwalking and needs to be used with 200 (actors for refwalking) couple of sources for you: NVSE GetFirstRef GetNextRef use those to grab your references, as i said before the "type" you need is 200 see the syntax for how to use. and finally,in the following spoiler i will provide an example script for you that has these functions being used and actuall doing something with the dead bodies (highlighting them black) so all you need to do is delete what you dont need and make changes to the function part for the dead actors. SCN SUBdetect ref creatureREF int creatureREFcount float rTimer BEGIN GAMEMODE if player.getitemcount SUBaedACT == 0 stopquest SUBdetectquest endif if player.getitemcount AmmoMicroFusionCell < ( SUBskillcostREF.skillcost ) stopquest SUBdetectquest showmessage SUBmfcellsneededMSG endif set rTimer to rTimer - GetSecondsPassed if rTimer <= 0 set SUBskillcostREF.indicatorREF to 0 listclear SUBkilllist ENDIF set creatureREFcount to GetNumRefs 200 2 set creatureREF to GetFirstRef 200 2 if (creatureREF.GetDistance player < 10000) creatureREF.sms NightkinCloakFXShader if ( creatureREF.getdead ) ;dead -> BLACK creatureREF.PMS SUBDeadSpotterShader 1 ; DEAD elseif ( creatureREF.IsInList SUBkillList ) creatureREF.PMS SUBIndicatedforshotSHADER 1 ; indicated for shot elseif(creatureREF.Getdistance SUBflagREF <= 250 ) ; indicated for shot creatureREF.PMS SUBIndicatedforshotSHADER 1 ; indicated for shot set SUBskillcostREF.indicatorREF to creatureREF creatureREF.listaddreference SUBkillList 0 set rTimer to 3 elseif(creatureREF.GetCurrentAIProcedure == 8) ;sleeping -> blue creatureREF.PMS SUBsleepSpotterShader 1 ; sleep elseif(creatureREF.GetCurrentAIProcedure == 16) ;fleeing -> pink creatureREF.PMS SUBfleeSpotterShader 1 ; flee elseif (creatureREF.GetCombatTarget == player) ;attacks player -> red fast blink creatureREF.PMS SUBSpotterShader 1 ; ATTACKING elseif ( creatureREF.GetFactionRelation player == 2) ;ally -> green creatureREF.PMS SUBFriendSpotterShader 1 ; ally elseif (creatureREF.GetFactionRelation player == 1) ;enemy with player-> orange fast blink creatureREF.PMS SUBEnemySpotterShader 1 ; hostile elseif (creatureREF.GetFactionRelation player == 0 && creatureREF.GetAV Aggression >= 2) ;neutral but verry aggressive -> orange fast blink creatureREF.PMS SUBEnemySpotterShader 1 ; hostile else ;any actor alife -> grey creatureREF.PMS SUBNeutral 1 ; neutral endif endif label 5 if creatureREFcount > 0 set creatureREF to GetNextRef if (creatureREF.GetDistance player < 10000) creatureREF.sms NightkinCloakFXShader if ( creatureREF.getdead ) ;dead -> BLACK creatureREF.PMS SUBDeadSpotterShader 1 ; DEAD elseif ( creatureREF.IsInList SUBkillList ) creatureREF.PMS SUBIndicatedforshotSHADER 1 ; indicated for shot elseif(creatureREF.Getdistance SUBflagREF <= 250 ) ; indicated for shot creatureREF.PMS SUBIndicatedforshotSHADER 1 ; indicated for shot set SUBskillcostREF.indicatorREF to creatureREF creatureREF.listaddreference SUBkillList 0 set rTimer to 3 elseif(creatureREF.GetCurrentAIProcedure == 8) ;sleeping -> blue creatureREF.PMS SUBsleepSpotterShader 1 ; sleep elseif(creatureREF.GetCurrentAIProcedure == 16) ;fleeing -> pink creatureREF.PMS SUBfleeSpotterShader 1 ; flee elseif (creatureREF.GetCombatTarget == player) ;attacks player -> red fast blink creatureREF.PMS SUBSpotterShader 1 ; ATTACKING elseif ( creatureREF.GetFactionRelation player == 2) ;ally -> green creatureREF.PMS SUBFriendSpotterShader 1 ; ALLY elseif (creatureREF.GetFactionRelation player == 1) ;enemy with player-> orange fast blink creatureREF.PMS SUBEnemySpotterShader 1 ; hostile elseif (creatureREF.GetFactionRelation player == 0 && creatureREF.GetAV Aggression >= 2) ;neutral but verry aggressive -> orange fast blink creatureREF.PMS SUBEnemySpotterShader 1 ; hostile else ;any actor alife -> grey creatureREF.PMS SUBNeutral 1 ; neutral endif endif set creatureREFcount to creatureREFcount - 1 goto 5 endif set creatureREFcount to GetNumRefs 201 1 set creatureREF to GetFirstRef 201 1 if (creatureREF.GetDistance player < 5000) creatureREF.PMS SUBItemSpotterShader 1 endif label 6 if creatureREFcount > 0 set creatureREF to GetNextRef if (creatureREF.GetDistance player < 5000) creatureREF.PMS SUBItemSpotterShader 1 endif set creatureREFcount to creatureREFcount - 1 goto 6 endif if SUBskillcostREF.indicatorREF showmessage SUBtestmessageMSG endif END and 1 more VERY important thingrefwalking for me is notoriously buggy when not used in a quest script and controlled with startquest and stopquest so i suggest using this in a quest script and setting up a quest to handle it. if you still have any questions ill try to help Link to comment Share on other sites More sharing options...
tunaisafish Posted April 12, 2011 Share Posted April 12, 2011 I've used refwalking extensively in Sortomatic... and yes I did run into some bugs.I spent about a day looking at my code looking for silly mistakes, and putting debugging statements in to see what was happening.The ref's were getting walked, but the properties from the refs were 'stuck' on the first ref found. The solution is simple, but I never would have guessed it. It's an old problem dubbed the 'apple bug'.The only reference and fix/workaround for this I found on Cipscis' Loops page. Link to comment Share on other sites More sharing options...
angelwraith Posted April 12, 2011 Share Posted April 12, 2011 (edited) I've used refwalking extensively in Sortomatic... and yes I did run into some bugs.I spent about a day looking at my code looking for silly mistakes, and putting debugging statements in to see what was happening.The ref's were getting walked, but the properties from the refs were 'stuck' on the first ref found. The solution is simple, but I never would have guessed it. It's an old problem dubbed the 'apple bug'.The only reference and fix/workaround for this I found on Cipscis' Loops page. actually there is NO need for the apple. that is ONLY if you are removing the forms from the formlist.the script provided removes nothing but a 1 off the count variable... no bugs no need for apple. when i was using refwalking in FO3 to move items from a container to the world this is a bug i saw because i actually DID remove the items themselves.if you are working from a container for some reason or decide that the method using variables like in this script isn't for you, i can provide the answer to your problems.. but to be clear no apple is needed for the method i provided here.. as long as you dont actually remove the items from the list. and because after your actors are disabled and markfordelete they will not show up in the count anymore so no room for game bloat. Edited April 12, 2011 by angelwraith Link to comment Share on other sites More sharing options...
tunaisafish Posted April 12, 2011 Share Posted April 12, 2011 and 1 more VERY important thingrefwalking for me is notoriously buggy when not used in a quest script and controlled with startquest and stopquest Sorry, I should have quoted this part before when replying. For me, refwalking has worked like a breeze since I read what Cipscis calls the 'apple bug'. I've not had to resort to creating quests to manage that part at all.I wasn't knocking your proposed solution to the OP's problem if that's what you thought BTW, listclear is not yet implemented for NV. You refer to the apple bug as being involved in formlists, yep I know there are some caveats there too.For all I know one of those is refered to as the 'apple bug' too... before my time :) Link to comment Share on other sites More sharing options...
redgnom Posted April 12, 2011 Author Share Posted April 12, 2011 requires NVSE. what your looking for is called refwalking and needs to be used with 200 (actors for refwalking)...and finally,in the following spoiler i will provide an example script for you that has these functions being used and actuall doing something with the dead bodies (highlighting them black) so all you need to do is delete what you dont need and make changes to the function part for the dead actors....and 1 more VERY important thingrefwalking for me is notoriously buggy when not used in a quest script and controlled with startquest and stopquest so i suggest using this in a quest script and setting up a quest to handle it. if you still have any questions ill try to help Thankyou very much.I'll going to dig in it.) I'm also not good with english, so it's be a very long day...) Link to comment Share on other sites More sharing options...
angelwraith Posted April 12, 2011 Share Posted April 12, 2011 (edited) and 1 more VERY important thingrefwalking for me is notoriously buggy when not used in a quest script and controlled with startquest and stopquest Sorry, I should have quoted this part before when replying. For me, refwalking has worked like a breeze since I read what Cipscis calls the 'apple bug'. I've not had to resort to creating quests to manage that part at all.I wasn't knocking your proposed solution to the OP's problem if that's what you thought BTW, listclear is not yet implemented for NV. You refer to the apple bug as being involved in formlists, yep I know there are some caveats there too.For all I know one of those is refered to as the 'apple bug' too... before my time :) oh gotcha see i misunderstood then see the real reason i like using quest scripts when dealing with refwalking is stopquestfor some reason whenever i tried using refwalking with object quests there was issues with actually getting it to stop once its doing its thingstopquest doesnt care if its in a loop.. it just stops it. and yeah that script has actually been significantly revamped since that last post but for what was needed the old one i had on the laptop sufficed. Im sorry if i mislead you about listclear working.. here is the current script that addressed that problem: SCN SUBdetect ref creatureREF int creatureREFcount float rTimer BEGIN GAMEMODE if player.getitemcount SUBaedACT == 0 stopquest SUBdetectquest endif if player.getitemcount AmmoMicroFusionCell == 0 stopquest SUBdetectquest showmessage SUBmfcellsneededMSG endif set rTimer to rTimer - GetSecondsPassed if rTimer <= 0 set SUBskillcostREF.indicatorREF to 0 label 88 if listgetcount SUBkillList > 1 listremoventhform SUBkillList 0 goto 88 endif ENDIF set creatureREFcount to GetNumRefs 200 2 set creatureREF to GetFirstRef 200 2 if (creatureREF.GetDistance player < 10000) if ( creatureREF.getdead ) ;dead -> BLACK creatureREF.PMS SUBDeadSpotterShader 1 ; DEAD elseif(creatureREF.Getdistance SUBflagREF <= 250 && ( creatureREF.GetCombatTarget == player || creatureREF.GetFactionRelation player == 1 || (creatureREF.GetFactionRelation player == 0 && creatureREF.GetAV Aggression >= 2) ) ) ; indicated for shot creatureREF.PMS SUBIndicatedforshotSHADER 1 ; indicated for shot set SUBskillcostREF.indicatorREF to creatureREF creatureREF.listaddreference SUBkillList 0 set rTimer to 3 elseif(creatureREF.GetCurrentAIProcedure == 8) ;sleeping -> blue creatureREF.PMS SUBsleepSpotterShader 1 ; sleep elseif(creatureREF.GetCurrentAIProcedure == 16) ;fleeing -> pink creatureREF.PMS SUBfleeSpotterShader 1 ; flee elseif (creatureREF.GetCombatTarget == player) ;attacks player -> red fast blink creatureREF.PMS SUBSpotterShader 1 ; ATTACKING elseif ( creatureREF.GetFactionRelation player == 2) ;ally -> green creatureREF.PMS SUBFriendSpotterShader 1 ; ally elseif (creatureREF.GetFactionRelation player == 1) ;enemy with player-> orange fast blink creatureREF.PMS SUBEnemySpotterShader 1 ; hostile elseif (creatureREF.GetFactionRelation player == 0 && creatureREF.GetAV Aggression >= 2) ;neutral but verry aggressive -> orange fast blink creatureREF.PMS SUBEnemySpotterShader 1 ; hostile else ;any actor alife -> grey creatureREF.PMS SUBNeutral 1 ; neutral endif endif label 5 if creatureREFcount > 0 set creatureREF to GetNextRef if (creatureREF.GetDistance player < 10000) if ( creatureREF.getdead ) ;dead -> BLACK creatureREF.PMS SUBDeadSpotterShader 1 ; DEAD elseif(creatureREF.Getdistance SUBflagREF <= 250 && ( creatureREF.GetCombatTarget == player || creatureREF.GetFactionRelation player == 1 || (creatureREF.GetFactionRelation player == 0 && creatureREF.GetAV Aggression >= 2) ) ) ; indicated for shot creatureREF.PMS SUBIndicatedforshotSHADER 1 ; indicated for shot set SUBskillcostREF.indicatorREF to creatureREF creatureREF.listaddreference SUBkillList 0 set rTimer to 3 elseif(creatureREF.GetCurrentAIProcedure == 8) ;sleeping -> blue creatureREF.PMS SUBsleepSpotterShader 1 ; sleep elseif(creatureREF.GetCurrentAIProcedure == 16) ;fleeing -> pink creatureREF.PMS SUBfleeSpotterShader 1 ; flee elseif (creatureREF.GetCombatTarget == player) ;attacks player -> red fast blink creatureREF.PMS SUBSpotterShader 1 ; ATTACKING elseif ( creatureREF.GetFactionRelation player == 2) ;ally -> green creatureREF.PMS SUBFriendSpotterShader 1 ; ALLY elseif (creatureREF.GetFactionRelation player == 1) ;enemy with player-> orange fast blink creatureREF.PMS SUBEnemySpotterShader 1 ; hostile elseif (creatureREF.GetFactionRelation player == 0 && creatureREF.GetAV Aggression >= 2) ;neutral but verry aggressive -> orange fast blink creatureREF.PMS SUBEnemySpotterShader 1 ; hostile else ;any actor alife -> grey creatureREF.PMS SUBNeutral 1 ; neutral endif endif set creatureREFcount to creatureREFcount - 1 goto 5 endif set creatureREFcount to GetNumRefs 201 1 set creatureREF to GetFirstRef 201 1 if (creatureREF.GetDistance player < 5000) creatureREF.PMS SUBItemSpotterShader 1 endif label 6 if creatureREFcount > 0 set creatureREF to GetNextRef if (creatureREF.GetDistance player < 5000) creatureREF.PMS SUBItemSpotterShader 1 endif set creatureREFcount to creatureREFcount - 1 goto 6 endif if SUBskillcostREF.indicatorREF showmessage SUBtestmessageMSG endif END and this should work for what you need. SCN AAAcollectyourdeadSCRIPT ; make sure you save this script as a quest script ref creatureREF int creatureREFcount BEGIN GAMEMODE set creatureREFcount to GetNumRefs 200 2 set creatureREF to GetFirstRef 200 2 if ( creatureREF.getdead ) ;dead -> BLACK creatureREF.disable creatureREF.markfordelete endif label 5 if creatureREFcount > 0 set creatureREF to GetNextRef if ( creatureREF.getdead ) ; DEAD -> disable and delete creatureREF.disable creatureREF.markfordelete set creatureREFcount to creatureREFcount - 1 goto 5 endif endif END make a new quest.save it.open the quest back up and in the script dropdown select the script abovepriority 55allow repeated stagesallow repeated conversation topics. to start your remover use this in a script :startquest yourquestnamehere to stop it use :stopquest yourquestnamehere Edited April 12, 2011 by angelwraith Link to comment Share on other sites More sharing options...
85Degrees Posted December 31, 2011 Share Posted December 31, 2011 The quest doesn't seem to work or do anything.. Do I have to put the first part into the script as well? I only want to remove bodies. Link to comment Share on other sites More sharing options...
Recommended Posts