Jump to content

[LE] custom spell to identify target actor (even leveled actors)


Archny

Recommended Posts

Objective

A custom spell that when hit, it identify the target if it is for example a Wolf, an Ice Wolf or a Pit Wolf. The goal is to identify only creatures, not humans.

 

 

So far

Getting the target race doesn't work well, a good example would be the wolves since all of them are of the same race WolfRace. Also I can't compare them to baseActors since there are several of them for the wolf alone and my mod is currently working with 98 creatures so, it is not a good approach. So currently I'm trying the code below to identify the target by his name instead, which was working well until I found out that some wolves were NOT being identified by their name and I think it is because these wolves were leveled actors and this code apparently doesn't worked for them, I think it's because in creation kit under menu Actors will see that leveled actors don't have names, i'm not sure.

Event OnEffectStart(Actor akTarget, Actor akCaster)
    ActorBase mActorBase = akTarget.GetBaseObject() as Actorbase
    string actorName = mActorBase.getName();
EndEvent

I have already at the end of my mod, and this issue is preventing me from releasing the mod since this functionality is a big feature of the mod.

 

Please if anyone could help me with this issue I would be deeply grateful. Any ideas on how to identify each creature would be awesome.

 

Here is a full list of all the creatures roaming Skyrim that I wish to identify with the spell

 

fox; iceFox; mudCrab; giantMudCrab; mudcrabSolstheim;


skeever; venomfangSkeever; wolf; redWolf; iceWolf;


dog; huskie; deathHound; sabreCat; iceSabreCat;


valeSabreCat; horker; bear; caveBear; iceBear;


troll; iceTroll; armoredTroll; armoredIceTroll; Udefrykte;


frostbiteSpider; frostbiteSpiderSnow; giantFrostbiteSpider; giantFrostbitSpiderSnow; spriggan;


sprigganMatron; BurntSpriggan; sprigganEarthMother; chaurus; chaurusReaper;


frozenChaurus; chaurusHunter; chaurusHunterFledgling; mamoth; giant;


frostGiant; flameAtronach; frostAtronach; stormAtronach; ancientStormAtronach;


ashAtronach; AshHopper; AshSpawn; NetchCalf; Netch


Bristleback; Lurker; Seeker; Ice Wraith; Fire wyrm;


gargoile; gargoileBrute; gargoileSentinel; darkGargoile; StoneGargoile; 


DwarvenSpider; DwarvenSphere; DwarvenBallista; DwarvenCenturion; ForgeMaster


skeleton; boneman; mistman; wrathman; soulCairnKeeper;


corruptedShade; corruptedShadeImperial; corruptedShadeStormCloak; skeletonPriest; The Reaper;


draugr; draugrOverlord_restlesDraugr; draugrWight_Lord; draugrScourge_Lord; draugrDeathLord_draugrDeathOverLord; hulkingDraugr;


whispMother; werewolf; werebear; Hagraven; VampireLord


dragon priest; skeletalDragon; dragon; bloodDragon; frostDragon; 


elderDragon; ancientDragon; reveredDragon; legendaryDragon; serpentineDragon; 


MagicAnomaly; pectralDog; HollowedDead
Edited by Archny
Link to comment
Share on other sites

Hello,

 

Get actor base will get the base actor of a leveled actor. So if it is a leveled list it will be the template actor. The first one on the list. This is where you could run into some issues. Some may be flagged to not use the name of the actorbase. And some may get thier name from the template before the actual actor base. I am not sure getbaseobject will work on an actor.

 

 

Give this a try and see what it returns.

Event OnEffectStart(Actor akTarget, Actor akCaster)
string ABN = akTarget.GetActorBase().getName()

Form f = akTarget.Getbaseoobject() As form

If f
Debug.Notification("Get Base Object Returned")
String ABO = f.getname()
  If ABO
Debug.Notification("ABO" + ABO)
Debug.Notification("We have actors name")
  EndIf
else
Debug.Notification("Get Base Object Did Not Return")
EnIf



If ABN
Debug.Notification("ABN" + ABN)
Debug.Notification("We have base actor name")
EndIf


EndEvent
Edited by SurfsideNaturals
Link to comment
Share on other sites

 

Hello,

 

Get actor base will get the base actor of a leveled actor. So if it is a leveled list it will be the template actor. The first one on the list. This is where you could run into some issues. Some may be flagged to not use the name of the actorbase. And some may get thier name from the template before the actual actor base. I am not sure getbaseobject will work on an actor.

 

 

Give this a try and see what it returns.

Event OnEffectStart(Actor akTarget, Actor akCaster)
string ABN = akTarget.GetActorBase().getName()

Form f = akTarget.Getbaseoobject() As form

If f
Debug.Notification("Get Base Object Returned")
String ABO = f.getname()
  If ABO
Debug.Notification("ABO" + ABO)
Debug.Notification("We have actors name")
  EndIf
else
Debug.Notification("Get Base Object Did Not Return")
EnIf



If ABN
Debug.Notification("ABN" + ABN)
Debug.Notification("We have base actor name")
EndIf


EndEvent

Hi SurfsideNaturals, thanks for replaying and helping :D

 

hmm interesting idea to get it as form but it didn't work either.

 

I got the message "Get Base Object Returned" but no name was printed, getName() on the form didn't returned anything.

Link to comment
Share on other sites

You would use as form because that is what it is and you are only using it to get the name. Also this is a form function. It would have little to do with why this would be working or not working.

 

Do you have SKSE installed? Have you been able to return the name of an actor base?

Edited by SurfsideNaturals
Link to comment
Share on other sites

If you can not get this to return on a leveled actor then you would have to try to get the actor base to return a name. What dose this return?

Event OnEffectStart(Actor akTarget, Actor akCaster)

string ABN = akTarget.GetActorBase().getName()

If ABN
Debug.Notification("ABN" + ABN)
Debug.Notification("We have base actor name")
EndIf

EndEvent
Edited by SurfsideNaturals
Link to comment
Share on other sites

Already tried that but it didn't work, BUT I have just found another function that is specifically for leveledActors, and it also works for non leveledActors which is perfect to me.

GetLeveledActorBase()
Event OnEffectStart(Actor akTarget, Actor akCaster)
    string actorName = akTarget.GetLeveledActorBase().getName()
EndEvent

And it is finally working :dance:

 

Thanks for the help man

Link to comment
Share on other sites

Alright,

 

Here is a script that will help the game decide which one to go with. You could put in some of the other safeguards that I included in the script above.

 

Do you see how this script is only getting the second string if the first one does not return a name? BTW My name is Susan. You could also create a string function that would return the name.

Event OnEffectStart(Actor akTarget, Actor akCaster)

  string ABN = akTarget.Getbaseobject().getName()

  If ABN 
    Debug.Notification("ABN" + ABN ) ; Do what you are going to do here
    Return 
  EndIf 
  
  string LAN = akTarget.GetLeveledActorBase().getName()

    If LAN
      Debug.Notification("LAN" + LAN ) ; Do what you are going to do here
      Return 
    EndIf 

EndEvent
Edited by SurfsideNaturals
Link to comment
Share on other sites

Hi Susan,

 

My name is Rony, pleasure :happy:, yes I always add the checks for "none" for safety.

 

yes I see, because of the return statement the second check is ignored. I have a separated method that does the checking for names depending on the actor passed as argument :laugh:

 

 

But there is no need for doing both conditions since GetLeveledActorBase() does that it self, check the link below for more information.

 

https://www.creationkit.com/index.php?title=GetLeveledActorBase_-_Actor

Link to comment
Share on other sites

  • Recently Browsing   0 members

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