Jump to content

Levelled Actors (Modding)


Guest ffabris

Recommended Posts

Guest ffabris
Posted

I'm sure I'm overlooking something, but ... is there a way to determine whether an actor is levelled or not? Say I have:

Function SomeFunc (Actor anActor)
   ...
EndFunction

and inside that, I want to determine if anActor is levelled (eg, a random guard, soldier, bandit), or not. Possible?

Posted

Leveled actors all have the string "lvl" in their name, right? Can you do a string search to look for those letters?

 

Something like this maybe?

string actorbasename = anActor.getactorbase().getname()
if ( stringutil.find ( actorbasename, "lvl" ) != -1 )
    ;this actor is leveled
endif

Or getbaseobject(), I can't remember if that would work too.

Seems like a convoluted way to go about it, but it might work. There's probably an easier and better way, SKSE might have a function that does exactly what you want.

 

EDIT: Actually, now that I look at it, I'm not sure this would work after all. Getactorbase() might bypass everything all the way down to the "enc" level, but more importantly getname() returns a name, not an ID name. Derp.

Guest ffabris
Posted

It was a neat idea though, one I hadn't considered. :)  I haven't (yet) found a function that does what I need, however. I was thinking GetActorBase() vs GetLevelledActorbase()  and comparing, but I suspect that wouldn't be at all reliable.

 

(*) Function names may be wrong; I don't have the CK wiki open right now.

Posted

Maybe i'm not understanding properly what you're trying to achieve (as english isn't my first language) but isn't that exactly what actor.getlevel() is for?

Posted

It was a neat idea though, one I hadn't considered. :)  I haven't (yet) found a function that does what I need, however. I was thinking GetActorBase() vs GetLevelledActorbase()  and comparing, but I suspect that wouldn't be at all reliable.

 

(*) Function names may be wrong; I don't have the CK wiki open right now.

 

Actually, that might work just fine.

From what I understand, getleveledactorbase() will return the base object, and getactorbase() will return the leveled object (nonintuitive, but it does make sense). And if getleveledactorbase() is called on a non-leveled actor, it returns the same as getactorbase().

So if getleveledactorbase() == getactorbase(), the actor is not leveled, but if they're different the actor is leveled.

I think... my brain aches.  :P

Guest ffabris
Posted

Maybe i'm not understanding properly what you're trying to achieve (as english isn't my first language) but isn't that exactly what actor.getlevel() is for?

 

No. Levelled actors are also sometimes called "generic". They are multiple instances of a base actor. So for example, most guards, soldiers, bandits, wolves, trolls, etc, are levelled. Entire armies or levelled actors are created from a base of maybe 4 variants (the base actor).

 

 

It was a neat idea though, one I hadn't considered. :)  I haven't (yet) found a function that does what I need, however. I was thinking GetActorBase() vs GetLevelledActorbase()  and comparing, but I suspect that wouldn't be at all reliable.

 

(*) Function names may be wrong; I don't have the CK wiki open right now.

 

Actually, that might work just fine.

From what I understand, getleveledactorbase() will return the base object, and getactorbase() will return the leveled object (nonintuitive, but it does make sense). And if getleveledactorbase() is called on a non-leveled actor, it returns the same as getactorbase().

So if getleveledactorbase() == getactorbase(), the actor is not leveled, but if they're different the actor is leveled.

I think... my brain aches.  :P

 

 

Hum, I'll try it then... and cross fingers'n'toes! :D

Guest ffabris
Posted

OK, so, this seems to work:

    string aName = anActor.GetLeveledActorBase().GetName()
    
    If(anActor.GetActorBase() != anActor.GetLeveledActorBase())
        Log(aName + " is levelled; no RelRank change.")
        return
    Else
        Log(aName + " is not levelled.")
    EndIf

\o/

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

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