Talk:GetSex - ActorBase

From the CreationKit Wiki
Revision as of 19:37, 15 March 2013 by imported>Jbezorg
Jump to navigation Jump to search

Wrong return values?

Hey there, I got some problems with this function. It always returns 0, regardless of what I use and what gender the target is. Example:

ActorBase targetBase = target.getbaseobject() as ActorBase
if(targetBase.getsex() == 0)
  ; do stuff
endif

I also tried this:

ActorBase targetBase = target.getbaseobject() as ActorBase
if(targetBase.getsex() != -1) && (targetBase.getSex() != 1)
  ; do stuff
endif

And as I expected it's the same result. "Target" is a valid actor, excluding this as a error source.

Can anyone confirm this? --Kahmul 18:46, 4 May 2012 (EDT)

It worked fine with this script:
Scriptname fg109TestMEScript extends ActiveMagicEffect

Event OnEffectStart(Actor akTarget, Actor akCaster)
	Debug.Notification(akTarget.GetActorBase().GetSex())
EndEvent

--Fg109 19:36, 4 May 2012 (EDT)

Still doesn't work. But when I use the console ("getissex") it returns the right value. Strange.
Notification("sex = " + target.getactorbase().getsex())

The only error source, that makes sense, could be that target = none. But I get it through gettargetactor() and all other functions are working.

Maybe there's a problem with getbaseobject() or getactorbase()? But that cannot be, because it is working for you but not for me. --Kahmul 07:40, 5 May 2012 (EDT)


If this is being used on an actor from a leveled list it looks like it will go down the template chain to the root actor and check that gender. ~jbezorg 08:43, 15 Mar 2013 (EDT)