Jump to content

[LE] get actor type or id


Recommended Posts

What i want to do is create a spell that does a ability on a dead npc but gives a item to player based on the dead npcs actor type.. what i mean by that is.. if the npc is a dead witch or a vampire or werewolf or bandit etc.. dunno if this is possible it looks like its alot of work as there are various types of witches an vampires.. im wanting to do something for all types.. like if the dead npc is a witch if its fire or ice or whatever it will do something because its a witch .. not what type of witch... i looked in creation kit wouldnt didnt find too much... any ideas???


I dunno if id use a template or actor base or id or what id need... the effect would work on a witch..for example regaurdless of what type of witch it is.. just as long as it is a witch... i want to do this with multiples but i guess im trying to say i need to find out how to determine the base of it.. like the id of a witch or am i gonna have to make if statements for every single type of witch??

Link to comment
Share on other sites

I think best way to do this is to make unique magic effects and spells, and use the spell conditions GetIsRace, GetFactionRank, or HasKeyword when adding the magic effects. For instance, for witches put the condition GetIsRace HagravenRace == 1. For vampires: GetFactionRank VampireFaction >= 0. Make sure your magic effects have the No Death Dispel box ticked. Also put the condition GetActorValuePercent Health < 0.1 which is less than 10%. Then attach a script to each magic effect that looks like this:

 

 

 

Actor Property PlayerRef Auto
MiscObject Property SomeItem Auto
Actor CurrentTarget


Event OnEffectStart(Actor akTarget, Actor akCaster)
    If akTarget.IsDead()
        PlayerRef.AddItem(SomeItem, 1) ;If target is dead, add item to player
    Else
        CurrentTarget = akTarget ;saves target to use in OnUpdate event
        RegisterForSingleUpdate(3) ;if not dead, check again in 3s
    EndIf 
EndEvent 


Event OnUpdate()
    If CurrentTarget.IsDead()
        PlayerRef.AddItem(SomeItem, 1) ;If target is dead, add item to player
        CurrentTarget = none ;clears target
    Else
        RegisterForSingleUpdate(3) ;if not dead, check again in 3s
    EndIf 
EndEvent

 

 

 

You can change the SomeItem and MiscObject type to whatever you want.

Edited by dylbill
Link to comment
Share on other sites

  • Recently Browsing   0 members

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