Jump to content

[LE] How to check if an NPC is summoned?


Recommended Posts

I'm trying to make a spell that only works on summoned NPCs. I have everything figured out, except how to check if the NPC is a summoned NPC or not.

I can't seem to find any unique keywords or factions on vanilla summoned NPCs, I'm not sure if there even is anything unique I can check for, but there should be SOMETHING.


I checked out the banish spells, I thought they only worked on summoned daedra, but apparently they work on ANY daedra so that didn't help any.

I appreciate any input.


Edit: Just to clarify. I've got a scripted spell. I've got it fully set up to do what I want it to do to summoned NPCs.

I just need some kinda "If Target.HasKeyword(SummonedCreature)" type of thing, but there appears to be no keyword specifically for summoned creatures, so I guess it'll have to be something else.... Just no idea what.

Edited by saintgrimm92
Link to comment
Share on other sites

It can be done with different ways, but...

What exactly you want this for? What's its fanctionality in-game?

 

I was hoping not to reveal too much but I guess this specific forum is filled more with modders than players...

 

It's not actually all summoned NPCs, it's only undead + summoned or reanimated. A spell that the player casts on summoned/reanimated undead to instantly kill the NPC and refill a % of the player's HP.

 

Right now though, it works on any and all undead NPCs, which isn't good. lol

 

If it's something I just can't do/can't figure out, I plan to change it so that the player can cast the spell on an actual dead npc, that's something I already know how to do, but that feels more like cannibalism than necromancy to me.

Link to comment
Share on other sites

You could attach a script to them which has a formlist. It can be setup so that when they spawn they can be automatically added to the formlist, and when killed or despawned, get auto-removed from the formlist

 

At anytime you can check how many actives you have, via FormlistName.GetSize()

 

There is a 128 slot limit and the slots are re-usable so unless 128 at once is not enough for you that would work well

Link to comment
Share on other sites

You could attach a script to them which has a formlist. It can be setup so that when they spawn they can be automatically added to the formlist, and when killed or despawned, get auto-removed from the formlist

 

At anytime you can check how many actives you have, via FormlistName.GetSize()

 

There is a 128 slot limit and the slots are re-usable so unless 128 at once is not enough for you that would work well

It's not specific NPCs though. I want it to work on vanilla stuff, like any NPC the reanimate spells are used on. Boneman, mistman, all those undead summons. And for compatibility reasons, I refuse to touch any vanilla assets in this mod, so I won't be able to add scripts to the vanilla NPCs. Need a way to identify if any NPC (vanilla or added by other mods) are undead and summoned, or reanimated.

 

For reanimated, I think I can just check if the target NPC has any of the reanimation magic effects running on them, haven't tried it yet to be sure. But still have no idea what to check for to see if they're a summoned NPC or not, if there even is anything like that.

Edited by saintgrimm92
Link to comment
Share on other sites

There are several ways you could go about it

 

Aliases comes to mind if you are looking to avoid record edits. It would take a little time to set that up, but once you did, you could keep a headcount there too. An array where you sweep all the aliases to see if they have a reference, or instead keep a globalvariable or Int stored which tracks when someone is aliased or cleared

 

Magic ability could possibly work too, but since mentioning aliases, that route could be appealing since that also opens more options like custom AI etc

 

There might be some quick way I am not thinking of atm but point being its very doable

Link to comment
Share on other sites

There are several ways you could go about it

 

Aliases comes to mind if you are looking to avoid record edits. It would take a little time to set that up, but once you did, you could keep a headcount there too. An array where you sweep all the aliases to see if they have a reference, or instead keep a globalvariable or Int stored which tracks when someone is aliased or cleared

 

Magic ability could possibly work too, but since mentioning aliases, that route could be appealing since that also opens more options like custom AI etc

 

There might be some quick way I am not thinking of atm but point being its very doable

Oh wow, that message is scary lol.

 

That's mostly stuff I've never worked with, I don't remember how I did it now, but I did make a mod that had weapons where power attacks cast spells through a quest that did it through aliases and arrays. lol. So what you're talking about might be a bit above my level of experience. I'll take some time to check out the respective pages on the CK wiki later on tonight and see if it's something I think can wrap my head around.

 

Even if I can't though, thank you for the help! :)

Link to comment
Share on other sites

You can do this by checking if the actor is 'commanded' or not:

*NOTE: This will not work on scripted spells that don't use the vanilla mechanics to summon or resurrect an actor.

Example:



Actor TargetActor

EVENT OnEffectStart(Actor akTarget, Actor akCaster)
TargetActor = akTarget
If ( TargetActor.IsCommandedActor() == True )

; Do My Stuff

EndIf
ENDEVENT

Edited by maxarturo
Link to comment
Share on other sites

 

You can do this by checking if the actor is 'commanded' or not:
*NOTE: This will not work on scripted spells that don't use the vanilla mechanics to summon or resurrect an actor.
Example:
Actor TargetActor
 
EVENT OnEffectStart(Actor akTarget, Actor akCaster)
     TargetActor = akTarget
     If ( TargetActor.IsCommandedActor() == True )

          ; Do My Stuff

 EndIf
ENDEVENT

 

 

So if that'll work, would the condition on the Magic effect "isCommandedActor" work? I saw that when I was looking through conditions trying to find something for this, but I thought that would be for a follower that you're currently "commanding" to do something. (i can't remember what it's actually called, I THINK it's command? When you have a follower and tell them you need them to do something in their dialogue, I've just never actually used it in-game, except by accident lol)

 

 

Also, thank you very much! That's much more within my ability to do lol.

 

 

EDIT: I also noticed that you said "or resurrect an actor"... Does that mean this is all I need for reanimated NPCs too? Or do I still need to check if the NPC has any of the Reanimate spell effects?

 

Are reanimated NPCs considered undead? Originally I was looking for conditions to put into the magic effect, I was looking for "Isundead AND summoned OR reanimated" But I resorted to script because I couldn't find a condition for summoned or reanimated.

 

So IF isCommandedActor includes reanimated NPCs, I need to know if they're marked as undead when reanimated, if not, then a condition of "isUndead AND isCommandedActor" would make it not work on reanimated NPCs, but I can just use a script instead.

 

 

You've both already helped so much, I won't expect an answer to this one :P If you do answer, amazing <3, but if not, no problem, I'll find out when I get to the testing/fixing my broken crap phase lol

Edited by saintgrimm92
Link to comment
Share on other sites

'IsCommandedActor()' is the Papyrus function to recognize an actor that has been summon/conjure or reanimated using the default vanilla system (hard coded).


To distinguish an actor if he is undead, vampire, etc... you combine the function with retrieving the keywords that the actor has in his 'Race', for example:



KeyWord Property KeyWordVampire Auto
Actor TargetActor

EVENT OnEffectStart(Actor akTarget, Actor akCaster)
TargetActor = akTarget
If ( TargetActor.IsCommandedActor() == True ) && ( TargetActor.HasKeyWord(KeyWordVampire) )

; Do My Stuff

EndIf
ENDEVENT



* I don't remember the exact name of the keywords, I just added the first thing it came to my head, I'm too tired...

Edited by maxarturo
Link to comment
Share on other sites

  • Recently Browsing   0 members

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