Jump to content

unable to disable creature


bobbyskel78

Recommended Posts

the just of it, as stated by the title. For the life o' me, i can't get a creature created by MOO

ref.disable

 

via script. The

ref.getdead

 

also isn't being processed.

 

i've tried both commands via the console and they produce the proper output:
getdead -> 1
getdisabled -> 0
getparentref -> null

the code is supposed to find dead actors, remove the items and then disable the actor. assigning a ref to getfirstref 69 2, the ref is recognized and it is dead, but not processed by the conditional

if ref.getdead

it seems at this point, i keep reloading the game trying to get it to work. prior to this, it was working fine on various creatures in a dungeon. however, for the MOO dead young minotaur, it's not processing.

after reading extensively, i believe i read somewhere that using the placeatme command can produce save game bloat and also dynamic actors, whereas, moveto doesn't.

4 of the young minotaur refs exist. all with no low-level processing & can corpse check initiated. there really doesn't appear to be any thing out of the ordinary with the AI when compared to a existing one. the creature info also looks straitforward and not scripted.

scn DeadCorpseFunction

ref deadCorpseRef
ref parentRef

float fDist

short numItems
short itemInBag
short DCdebug

Begin Function{}

    set deadCorpseRef to GetFirstRef 69 2
;--------------------------------------------------------------- loop
set DCdebug to 1
Label 100
    
    if deadCorpseRef.GetParentRef
MessageBox "step -1"
        set parentRef to deadCorpseRef.GetParentRef

    endif

    if deadCorpseRef

        if DCdebug

            message "FormId %i " deadCorpseRef

        endif
        
        if deadCorpseRef.GetDisabled
MessageBox "step 0"

            set deadCorpseRef to GetNextRef
            goto 100

        endif

        if deadCorpseRef.GetDead

MessageBox "step 1"
                deadCorpseDummyNPCRef.MoveTo Player 0 0 0

                set fDist to deadCorpseRef.GetDistance player

                if eval ( fDist < 3000 )

                    set numItems to deadCorpseRef.GetNumItems

                    if eval ( numItems > 0 )
MessageBox "step 2"
                            deadCorpseRef.RemoveAllItems deadCorpseDummyNPCRef
                            deadCorpseRef.Disable
                            set deadCorpseRef to GetNextRef
                            goto 100

                    else
MessageBox "step 3"
                            deadCorpseRef.Disable
                            set deadCorpseRef to GetNextRef
                            goto 100

                    endif

                else
MessageBox "step 4"
                    set deadCorpseRef to GetNextRef
                    goto 100

                endif

        endif
;---------------------------------------------------------------        

             deadCorpseDummyNPCRef.MoveTo deadCorpseXMarker

            deadCorpseDummyNPCRef.RemoveAllItems deadCorpseContainerRef

            set itemInBag to deadCorpseContainerRef.GetNumItems


            if eval ( itemInBag > 0 )

                deadCorpseContainerRef.Activate Player
                deadCorpseContainerRef.RemoveAllItems Player


                Message "no items",3

            endif

    endif

set deadCorpseQuest.fQuestDelayTime to 15
set deadCorpseQuest.Harvest to 0
set deadCorpseQuest.IsStillRunning to 0

stopQuest deadCorpseQuest

end

 

Link to comment
Share on other sites

GetFirstRef is best used in a loop together with GetNextRef. Well you should really at least get one hit with your script but you cannot move a dead body with moveto but maybe with setpos but moveto is out of the question really as it only work with living targets.

 

Moveto moves an reference that is already in game to the calling ref

PlaceAtMe places a complete new target, well a new reference to your position, made from the base object.

 

That's the reason Moveto cant make a bloat while PlaceAtMe can.

Let's make a tiny example, well I copy the example from the CS Wiki:

ref AnActor
...
set AnActor to GetFirstRef 69 1
while (AnActor)
  ; do something with AnActor
  set AnActor to GetNextRef
loop

But are you really sure it has a parent at all as Oblivionaddicted also typed as I do not think so but the best way to find out is really to peek at Maskar's code and that is not the easiest code to read for sure...

So lets make it more simple maybe? First why do you wanna find the dead body or its parent ref, if it now has any, in the first place? I look for dead bodies with a companion script I made for a 2nd pet and it starts with a loop to find what the player is fighting so I store all living targets in a temp array that the pet and also what the tamed pet is fighting and check with a quest 2 times each second if the targets are still alive or dead and if they are dead, I delete that array index and give some exp to my pet and also check if that target got into the array more than one time and delete those indexes as well. It is better to have a target twice in the array than not at all, so it sure took me long time to make that script as perfect as possible.

Edited by Pellape
Link to comment
Share on other sites

By the way, the easiest way to get an answer about perentrefs, well if the actor reference has a parent is to ask Maskar in a PM.

 

The best way to get rid of dead bodies is to use Midas Touch as that works at all MOO dead creatures and not only at the MOO creatures but at any dead body and it will also make you rich. It base the amount of gold to the targets level.

 

 

 

Midas Touch - Midas Touch imbues the living target with 50 points of fire and normal weapons resistance. When cast on a corpse, it will turn the corpse into gold. In moments, the corpse deteriorates into a cascade of coins.
Edited by Pellape
Link to comment
Share on other sites

i did check for a parent ref via script. it's one of the first conditional statements i ran.

if deadCorpseRef.GetParentRef
MessageBox "step -1"
        set parentRef to deadCorpseRef.GetParentRef

    endif

i also checked it via the console and the CS. there is no parent. the code does pass this conditional check.

;-------------------- disable isn't the prob, i believe it to be the ref, but i don't know how to capture the formid back to the actual ref.

i can try to back track the code in the CS and see exactly where the random spawns are being created and by what means. (ie. placeatme, moveto player ... etc. guess i can check the area where it spawned for any Xmarkers as well.

as stated prior, while in the dungeon, the script was working fine. i think i need to add another debug Messagebox and see if i can grab the formid of the creature and make sure it's valid, if it isn't .... and rather what i'm thinking, the deadCorpseRef is holding a invalid ref and why the getDead condition isn't being met. the final debug message "no items" is being met, but none of the others (ie. MessageBox Step -1 to 4. the var DCdebug does nothing as of current.

i would rather not bug Maskaar or any of the veteran coders. i have in the past, they didn't even recall the individual functions .... so it went no where. if i had to guess, as i do the same, there's no point in rebuilding the wheel, so i imagine many portions of the code are nothing more than using other's resources and getting them to work together and w/ oblivion.

A off topic example. digging through Scorn's vampirism, which i enjoy using and have endorsed is just a compilation of other modders. the CS catches many of the syntax errors, some that are really silly to miss (ie. declare the same var, the same way in the header of the same script. CS won't even compile it w/o changing.

anywho, i'm currently installing morroblivion, Scorn is already spawning vampire hunters, ... etc more mod spawns, so i doubt the err is going to be isolated to MOO.

;------------------------------------------------------------------------- Purpose

the purpose of the script is to streamline the pillaging of dead corpses and more effectively remove bloat saves. i based the foundation of the mod off of Gather Ye Rosebuds, which does similar. it streamlines the collection of flora. disabling the body is just for rendering purposes, as removing game bloat w/ actors i believe is impossible, from everything i've read, dead actor refs are not removed from the game until 72 hours of game time have passed and the player must have to re-enter the cell, otherwise it's never removed. this is where i proposed using a moveto instead of disable, placed in a cell in the Imperial City ... which is quite often visited, thus assuring more removal of refs ... if my logic is clear, as is the implied game function in reference to ref removal.

i think kuertee ran into the same problem, as i noticed the script Kuertee's Cleaned up clean up has been removed, among other things that mod was also removing items to quickly, some quest related. my mod is spell related in combo w/ the mod "actors keep equipment in inventory", clutter cleaning should be more efficient, plus it gives the player the opportunity to salvage through potentially missed equipment and acquire some gold or other resources. any who, that's the purpose.

once i get this figured out, i know i'm going to have to add another conditional command for isofflimits, the arena i suspect is going to be a problem otherwise.
;--------------------------------------------------------------------- Midas Touch
the Midas touch. not sure if that's the route i want to go, as some equipment may be worth using. besides, w/o even looking at the mod, if i had to guess it's a touch spell that acts on a single ref, ciphering through each item. i'm currently using a "summon merchant" mod that almost equates to same thing. i'm going to download it and see if it poses the same problem. the creature in question, has no items, but i can see how the "Midas Touch" is acquiring the actor ref.
;---------------------------------------------------------------------get ref
as i already stated, the getfirstref, which i test to make sure it exists is being passed. getnextref is also working via the previous test in the dungeon, which i believe were only original game creatures. the loop is being processed correctly using the goto command.

i will have to look up setpos, once i figure out the ref prob. moving the disable actor refs to IC just makes more sense to rid the save game of refs. of course, taking into account the dead actor ref has to be 72 hours old and the player has to enter the cell.

i am using Waalx WAC, not sure if that matters. it's pretty buggy, especially in the arena area.
;--------------------------------------------------------------------finito for my own reference and acculades

install 'midas touch' and see how it's gathering the formid and disabling the actor ref.

place a debug message prior to the getDead condition. messagebox "formid %i", oh, i've already done that ... forgot to add the seconds of display for the message. changing to a messagebox "formid %i" deadCorpseRef.

erred on the conditional parentref, but it's not being passed anyhow. need to go ahead and fix that: change set parentRef to deadCorpseRef.getParent -> set deadCorpseRef to **.

Thanks all for your responses. Ya gave this feeble mind some thoughts to chew on.

I will comment again once i've tried the pre-mentioned suggestions. hopefully, to a resolution.

Edited by bobbyskel78
Link to comment
Share on other sites

Well, i traced Midas Touch Spell down to this code:

set me to GetSelf

    if me.IsActor == 0 || me.GetDead !=1 || me == player || me.isEssential == 1
     return
    endif



    set ringCount to GetItemCount MidasDeathRing
    if ringCount < 1
        return
    endif

     me.PlayMagicEffectVisuals OPEN 3
    me.kill
    me.Disable
    me.PositionCell 256, 192, -800, 0, BRMidasCell

apparently, they also are just using the disable command, which as i've already stated, doesn't work. going to test my script with the made adjustments. time to see if the ref formid is actually that of the corpse.

Link to comment
Share on other sites

The disable command is the only available command in Oblivion. We do have extra commands for deleting refs completely in either Morrowind or was it in Skyrim but not in Oblivion.

 

Wrye Bash is good to pick up the bloats and delete them in your save files as I get many of those, specially when I did train enchanting as when you enchant something, a new base object is created and also a new ref if you place it into the world, so the principle is similar to placeatme and should create a bloat when we think about it.

 

I did enchant some stuff that I gave to my companions and I then deleted bloats in a save file with Wrye Bash and those items where gone from my companions but it does not delete the enchanted stuff I had in my inventory.

 

I did enchant some stuff from my mod that also cause string bloats, so when I unchecked it, after correcting the cause of the bloat, I did store the enchanted items away, well the items I had enchanted in game from that mod. Those enchanted items where still in that container after I enabled the mod again, even if I did a save in between to be able to get a clean OBSE save file, as that is the only way so far, according to Idle, the xOBSE developer but I sure did plant some ideas to his mind to look into this, to see if there might be a way for OBSE to be able to clean those bloats but Idle also refer to a main problem with ConSave but that problem is solved in Fallout 4 so he is optimistic to solve it for Oblivion as well.

 

To get the base object of the ref you are checking: GetBaseObject

 

When it comes to bothering Maskar, well I have done that time to time and always get proper and correct answers or questions back sooner or later but mostly within 24h. I do it though when I am out of options or if I have ideas for changes in MOO as another example, which I do have, within the crafting areas.

Edited by Pellape
Link to comment
Share on other sites

The disable command is the only available command in Oblivion. We do have extra commands for deleting refs completely in either Morrowind or was it in Skyrim but not in Oblivion.

 

Wrye Bash is good to pick up the bloats and delete them in your save files as I get many of those, specially when I did train enchanting as when you enchant something, a new base object is created and also a new ref if you place it into the world, so the principle is similar to placeatme and should create a bloat when we think about it.

Doesn't the 'hide' command also exist in Oblivion as it does in Skyrim?

 

As for deleting refs in Morrowind and to my knowledge there are two options to do that which is something like this.

  • In the saves tab in Wrye Mash the user can select any gamesave then click on repair all
  • In the mods tab in Wrye Mash the user can select an esp then click on repair refs or renumber refs

Should the user get a message about bad refs then all bad refs needs to be deleted. However, I know the user can load a gamesave into the Enchanted Editor (EE) and make the changes then save it.

 

 

Anyway, newer TES games are using FormID, but I'm not entirely sure if Oblivion has the BaseID record or not while Skyrim has the BaseID record (Lydia). As you can see Skyrim uses both RefID and BaseID, which are unique for the same, in this case, NPC.

 

 

 

@OP: Maybe changing the script to search for BaseID record(s) instead of focusing on RefID record(s) and doing that might help.

Link to comment
Share on other sites

Well searching for a baseobject in game does not work, only if it is in the inventory or in a container but after you found a ref then you can use the getbaseobject on it, but not searching for it and the reason is that it is not the base object that we see in the game as the base object does not have the coordinates for the object as it is only the reference that is able to hold both the coordinates and hold the baseobject, like a form of container if we play with the thought.

 

We do not have hide in Oblivion - Only disable and enable as far as I know.

 

Tribunal introduced the SetDelete command as I did look it up now and we should really ask Bethesda why they did not implement it in Oblivion as well, so Morrowind without Tribunal only had the ability to disable refs as well, not delete them.... ;)

 

I did not knew that we could load save games with CSE as I have searched a lot for a tool that are able to do it.

Link to comment
Share on other sites

forgot to get rid of the bloat. using WB in conjunction w/ OBMM (i know, i don't want to hear it, tried the others and they failed miserably)( i find it much easier just to use LOOT, paste a total cleaned esp into the data folder, LOOT sorts, activate the mods in order through OBMM, finally ending w/ a bashed patch) i always back up my Oblivion directory prior to installing a questionable mod ... reading posts is usually a good indicator of what to avoid.

Any who, back to the OP. i used a mod tool called "Form Finder". the code itself i don't think is going to be of much help ... maybe it will be, i've yet to check the refid as opposed to what FF found. (ffxxxxxx) the mod generated MOO was the origin and the FF prefix for the hex formid is a indication that the spawn was created in-game.

found some other mods that have esp's and no conflict, different games though, albeit i just want to look at the code.

this is taking too long, i'm multi-tasking and driving myself ape-$H!T, meshes, textures, custom races, kgtools - rather cool project once it gets stable, etc ...

tx again for the input.

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...