Jump to content
  • Announcements

    • AndalayBay

      Orphan Attachments   07/31/2018

      I have been doing some housekeeping lately and I've noticed that I had a lot of orphaned attachments. Attachments get orphaned when the PM or post is deleted without removing the attachment first. Deleting a PM or post does not delete the attachment and the file or image remain on the server. I'd like to ask all members to go through their attachments and delete any attachments you don't need anymore or those that have been orphaned. Where can I get a list of my attachments? Click on your display name in the upper right corner of the forums and pick "My Attachments" from the drop-down list. How can I tell an attachment is orphaned? If the PM has been deleted, you'll see a message like this in your attachment list: Unfortunately there is no message if the post has been deleted, so please check your old posts. We do purge old birthday threads every once in a while. Also some hosted projects have been shut down, so you may have orphaned attachments on one of those locations. Thanks!
Sign in to follow this  
Milotek

Companion Support - Technical Discussion

Recommended Posts

I have started this tread to discuss some issues and thoughts on Companion support for OblivionXP.  This discussion first started in another thread.  If anyone would like to read up on what has been discussed so far, go here.  Read pages 8 and 9.

 

Anyway to pick up where I left off.  I stated that I had found a possible solution to the problem but after further testing it didn't work all the time.  Under certain conditions no XP points were awarded.  That's not good.  More on why later.

 

So, after trying many things nothing seems to make it work as it should.  Here is a list of what has been tried and why it failed in my opinion.

 

First of all, the original had issues do to the OBSE commands getNumFollowers and getNthFollower not working properly.  Not much can be done about this on this end.

 

Second, I tried the the OBSE command getFollowers.  It failed for the same reason as the above did.  I wasn't surprised as I'm sure it was built around the same code.

 

I then tried using the OBSE command getCurrentPackage to get the current editor package running on the companion and then check the type of package.  It failed at times do to a bug with getCurrentPackage not always returning the correct package.   I have on companion that always states that it is in a Follow package when I know for sure it isn't.  I actually found this out a year or so ago and brought it up with the OBSE people. 

 

So the last thing I tried was the one that I thought worked.  I used the vanilla command getCurrentAIPackage to make sure that the companion was in a follow package.  Worked great on single kills, but when the companion went from one kill to the next enemy real quickly no XP points were awarded.  So I read up on getCurrentAIPackage and found that it included dynamic packages such as combat.  So when the companion made the quick transition from one kill to the next, it never dropped out of its combat package.  I did place a strategic stopCombat command that did seem to work.  Then the issue started happening again with the greeting package when NPC's quickly looted the the body they just killed, and creatures that sniff or howl on dead bodies.   I could have turned off 'loot corpses' in the editor but I didn't like the way this was going so I marked it a failure.

 

Now here I am with no solutions, until OBSE fixes these issues or someone comes up with a different approach.  Any ideas are welcomed and encouraged.  Also, if I made and mistakes in my theories, please point them out.

Edited by Milotek

Share this post


Link to post
Share on other sites

That pretty much lines up with my findings as well, unfortunately. One thing you could try is getCurrentAIPackage combined with a test for the form ID of the resulting package. You would test for the last six digits of the form ID to make sure it isn't a dynamic package. However this would require patches specific to each kind of companion mod, so I don't think it's really a feasible solution.

 

The existing companion support works most of the time. Furthermore, you get reduced points for kills when you have a companion, so the few extra points you gain when your companion performs kills while not following your character makes up for the reduced points. :)

Share this post


Link to post
Share on other sites

You might misread my post; I did use getCurrentAIPackage.  It doesn't return a form id, it returns an integer representing the package type.   This was the technique I thought worked. 

 

Anyway the original code is the best solution, even if OBSE never fixes the problem.  It is the cleanest and most efficient way.   I don't mind the amount of XP that I may lose of gain.  It was just a problem I wanted to solve for my own amusement!!  I agree that any solution should work with any companion mod without any changes to that mod.   So for now I am giving up on trying to fix it.

 

I do have another thought about the way sneak kills work when companions are present.    I have found that if the player sneaks and the companion makes a kill you get the bonus for sneaking.  So a player can hide like a coward and let the companion make the kill and get the bonus.   Maybe this is the way it should be as I can see times when you should get bonus when a companion makes the kill.   I do favor not getting the sneak bonus unless I make the kill.  From looking at the code, it would be super simple to do, but don't hold me to that!!  I would like your thoughts about it. 

Share this post


Link to post
Share on other sites

I thought there was a function that returned the Form ID. I know it's something you can find out because Refscope reports it. It's probably another function that's not specific to AI packages. Anyway it would be a lot of work for little gain. :)

 

saebel has already beaten you to it. :D We worked together to make Sneaking Detection Recalibrated (SDR) and Oblivion XP compatible and complement one another. Basically I've left the sneaking stuff to SDR. Oblivion XP will keep the existing sneak detection mechanism, which isn't very robust. If you're serious about sneaking and only getting rewarded when you earn it, then use SDR. If you have a look at the new Ob XP ini, you'll see that I've modified the description for multXPKillSneaking and the poison fix. If you're running SDR, then you would set those options to 0 and let SDR do the XP rewards. saebel has incorporated Oblivion XP's point calculations and poison kill fix.

 

SDR is quite sophisticated and it's better to have a comprehensive system than to try to replicate that in Ob XP. I'll be announcing this when I do the full release for Ob XP.

Share this post


Link to post
Share on other sites

There is one that returns the Form Id, not sure which one it is as there are so many Package functions that it is easy to mix them up.  I just mixed one up myself and is why I am posting.  In my first post, I said that I used getCurrentPackage to get the current editor package, but I just read it also returns the dynamic ones.  I should have used getCurrentEditorPackage, but guess what, its broken too. 

 

It seems like every OBSE function I have ever used doesn't work as advertised.  A bit disappointing to say the least.  When I first heard about OBSE a couple years ago, I was so happy to get more function.  But now I try to avoid them as most seemed flawed.  I do like the added events and they seem to work quite well.

 

I'll look into SDR as I do like to sneak.  My current character is an archer so sneaking is vital.  I have been using SM Combat Hide to keep NPC enemies from finding me so easy.  I like it alot.  I will have to see if SDR will conflict with it.  Thanks for the tip.

 

Glad to hear that I can also disable the poison feature in OBXP if I go SDR as I sometimes get  this error in the poison script:

ObXP: Sneak kill was undetected!
ObXP: Sneak kill was undetected!
ObXP: Sneak kill was undetected!
Error in script 2900909a
Attempting to call a function on a NULL reference or base object
    File: Oblivion XP.esp Offset: 0x0958 Command: Let
Error in script 2900909a
An expression failed to evaluate to a valid result
    File: Oblivion XP.esp Offset: 0x0958 Command: Let
ObXP: Poison killed Necromancer Neophyte!
ObXP: Sneak kill was undetected!

Share this post


Link to post
Share on other sites

That's odd. I'll try to use more poison kills in my current game and see if I can replicate the problem.

 

I've not had an issue with the OBSE functions. Sometimes it's hard to figure out how they work, but for the most part, I find they do work.

Share this post


Link to post
Share on other sites

I only have had that poison kill error message happen 3 or 4 times and I use poisons all the time.  Even though the console prints an error, I believe I still get the XP for it.   I would need to test it more but I haven't been able to create the error at will.  

 

I just tried SDR but it just killed my framerate in certain places; FCOM adds lots of NPCs.  I have a pretty old computer it was built in 2007.  

 

You stated that OBSE functions for the most part work, but to me they either work all the time or they don't work at all.  There is no gray area for this as far as I am concerned.  You admitted that getNumFollowers and getNthFollower are flawed and that it was even common knowledge.  It makes your mod work in ways you did not intend; that sound like and issue to me.  These two functions are pretty easy to understand on what they should do and at times they don't function as advertised.  I would agree that they do work good enough for most mods, but it I just can not bring myself to use functions that are not predictable.  

 

That all being said, maybe it is just me having these issues or that I am not doing something right.  Or maybe its not even OBSE's fault.  It could be a limitation of what can be done with the game.  Maybe the OBSE crew is banging their heads against the wall trying to figure this all out.  So I do appreciate what OBSE does; I only wish I could do what they do. 

Share this post


Link to post
Share on other sites

It's either an engine issue or the OBSE guys didn't realize that the engine does these little packages that can interfere with the followers testing. I've never had the issue you spoke about, but I don't use companions all that much either. I do know that Oblivion XP first came out, there was no companion support at all. If you had a companion and he made the kill, you got no points.

 

My use of companions is pretty much limited to summoned creatures, which work perfectly. In terms of other companions, there are some quests that involve companions and I don't recall ever having an issue. We have followers in Dark Brotherhood Chronicles (DBC) and they seemed to work fine when I was testing my code. Do you play the Dark Brotherhood questline at all? If you do, perhaps you could load DBC and get one of our murderers to follow you to see if you have the same issue with them.

Share this post


Link to post
Share on other sites

I would hope they understood how Editor and Dynamic packages interact.  The whole game is based on it.  They even have a function called GetCurrentEditorPackage which only returns Editor packages so I can assume the know the difference.  They also have functions that deal in AI Procedures, so again I assume the have pretty good knowledge on the subject.

 

I have tried summoned creatures and I haven't had that issue, but I wouldn't expect them to have the problem.  They are always following so they can't give you XP when not following, the situation can never happen.  I haven't tried to see if they get stuck in the list and dilute your XP because of party size.

 

Here is something that makes my head hurt straight from the OBSE documentation:

GetNumFollowers - returns the number of actors currently following the calling actor. Summoned creatures are excluded.

GetNthFollower - returns a reference to the nth actor currently following the calling actor. Does not include summoned creatures.

 

These are the two functions you use for companions right?  Well in their own words they say summoned creatures are not included.  Enough to drive me nuts!!  So why does it work?  I don't think anyone knows. 

 

I am in the Dark Brotherhodd but not very far along.  I will look into the DBC mod.  Again all my testing has been with creature companions.  I only use two dog companions when I play for fun.  My poor little archer need support.  I plan to test some NPC companions soon. 

Edited by Milotek

Share this post


Link to post
Share on other sites

No actually, they don't. I've worked with the OBSE guys. I used to talk to one of them on Skype all the time and he explained how it works. He also explained how to decompile the executable, so I used to decompile Skyrim for him each time Beth released a patch. It just saved him some time.

 

Anyway, they just look at the disassembly and find the function hooks. Then they expose the functions. That's how it works. The guy I worked with knew very little about Oblivion scripting, but he's created tons of OBSE plugins. So they would understand how these things work from a code perspective, but in a very localized fashion. If they were still around, they would take your findings and search through the code to find the section that's creating these temporary packages. Then they would see if they can fix their functions.

 

That's because summoned creatures are part of the summoner. :D You don't process summoned creatures with the followers functions at all - they aren't followers.

 

Wait - so you're complaining about creature followers? If that's the case, then all bets are off and I don't expect the followers functions to work for them. Creatures don't have a full AI set. I wouldn't expect the game to even flag them as followers at all, so I'm surprised you're getting any results from the followers functions. I think the OBSE guys would tell you that the functions don't work for creatures. Since creatures lack the full AI support, they aren't really supposed to be used as followers. I know people have created companion mods, but they're stretching the engine just a tad. I know people have tried to create horse mods to make them "smarter". To the best of my knowledge, nobody has gotten that to work in Oblivion. It works quite well in Skyrim because Beth made creatures "smarter". I think they saw that people wanted to do more with creatures, horses in particular, so they built in more support.

 

To demonstrate how summoned creatures work, here's my code from Oblivion XP's original kill script. Summoned creatures are an active effect on the summoner.

 

 

....
        ;loop through all references
        let i := 0
        ;let actor := getFirstRef 69 2
        ;reduce scan scope to current cell and 8 adjacent cells
        let actor := getFirstRef 69 1
        while ( actor )
            if ( actor.getDead == 0 ) && ( actor != player ) && ( actor.isEssential == 0 ) && ( actor.getObjectType == 35 || actor.getObjectType == 36 )
                ;store reference in array unless it's exceptional
                let tempShort := 0
                let tempString := actor.getName
                if eval ( tempString == "Scattered remains" || tempString == "Bloody organ" )
                    let tempShort := 1
                endif
                if eval ( tempString == "Crushed skull" || tempString == "Frozen remains" )
                    let tempShort := 1
                endif

                if eval ( sv_Find "mannequin" tempString ) > 0
                    let tempShort := 1
                endif

                ;if ( tempShort )
                    ;PrintToConsole "ObXP: Exceptional actor encountered (%z), skipping." tempString
                ;else
                if ( tempShort == 0 )
                    ; give summoners precedence when processing the kills by putting them first
                    ; in the actor array.  Use actorAttrib array as a holding tank until you determine
                    ; whether current actor has a summons or not.
                    let actorAttrib := ar_Construct Array

                    ;NPC reference
                    let actorAttrib[0] := actor

                    ;companion in combat with actor?
                    let actorAttrib[1] := 0

                    ;number of party member in combat with actor
                    let actorAttrib[2] := 1

                    ;party level
                    let actorAttrib[3] := player.getLevel

                    ; does current actor have a summoned creature?
                    ; if so, store summons as an attribute of actor - will need multiple elements for each summons

                    let k := 4
                    ForEach each <- (actor.GetActiveEffectCodes)
                        let index := each["value"]
                        if (MagicEffectUsesCreatureC index)
                            let effectKey := each["key"]
                            let actorAttrib[k] := actor.GetNthActiveEffectSummonRef effectKey                        
                            let k := k + 1
                        endif
                    Loop

                    ; If the current actor has a summons, insert the reference into the top of the array,
                    ; otherwise append to the end.
                    let arraySize := ar_Size actorAttrib
                    if ( arraySize > 4 )
                        ar_Insert arrayNPC 0 actorAttrib
                    else
                        let arrayNPC[i] := actorAttrib
                    endif

                    let i := i + 1
                endif
            endif
            let actor := getNextRef
        Loop

...

 

You used to never get credit for killing a conjurer or his summoned creatures. It was hit and miss. Usually you only got credit for killing the summoned creature when you killed the conjurer himself, which was a big difference in points at high levels. Fixing that bug is the reason I took over Oblivion XP in the first place. :P

Share this post


Link to post
Share on other sites
If they were still around, they would take your findings and search through the code to find the section that's creating these temporary packages. Then they would see if they can fix their functions.

So are you saying OBSE is no longer being worked on? I hope that's not the case. 

 

Summoned creatures are an active effect, interesting.  I would have never guessed that.   Got some bad news for you though,  There are times when I don't get XP for killing conjurers in the current release. 

 

I think I did mention once that I was using creature companions, but I am not sure.  I was creating a complex dog companion and was having some issues with the OBSE functions I mentioned in previous posts.  I halted the project, not due to OBSE, because it was getting too complicated.  Anyway, this could explain some things.  I will run the same tests on NPC companions.

 

I'm going off topic here, but I am OK with it if you are; but I am having issues with poison kills.  Sometimes I get multiple messages for one kill.  I also get the multiple amounts of XP.  In one instance, I got 10 messages for killing a hill giant and got 2000 XP.  I should have only gotten 200 XP.  I spent the weekend testing it and can make it happen at will.  I will give details latter.  I have been doing some reading and am shocked to find out Oblivion doesn't give credit for poison kills, its unbelievable!!  Your efforts to fix that issue is to be commended.  

 

Share this post


Link to post
Share on other sites

That's correct. shadeMe was the last OBSE developer and he's not around much anymore. I don't know if he's just gotten busy with RL and will be back or not.

 

I'm going to be clearing some conjurer dungeons soon, although I'm going away for Christmas on Tuesday, so I probably won't get to them until the new year. I'll keep an eye out and see if I have the same issue.

 

I think you did mention you were using creature companions, but I didn't realize the issues you were having were due exclusively to your critters. I think you'll find that things work fine with NPC companions.

 

That's odd. Are you running SDR?

Share this post


Link to post
Share on other sites

Hey I may be losing my internet account for awhile.   So don't be surprised if I don't respond to any posts.  The bill is getting way too high.  I am looking for a new provider but I don't know how long that will take.

Share this post


Link to post
Share on other sites

I am back in business.  My ISP made a billing error,  and after talking with them I got a discount for being a long and loyal customer!!!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×