Jump to content

[LE] Skyrim: Scripting NPC combat animation


Scythe42

Recommended Posts

I thought I try to ask here as search efforts lead nowhere so far:

 

I have some script that randomly spawns NPCs at various locations. I want these NPCs to do some kind of cast at an object. Just a custom spell at an xmarker or another reference as a target. The object's FormID might be different at each location, but I am able to pass is as a parameter to whatever Papyrus functions are involved / or the coordinates where the object is.

 

How do I script this? The NPC is there but I did not really find info how to continue from here to make the NPC do stuff.

 

Only examples I found are examples of pre-scripted stuff at specific locations as a quest with a fragment for individual locations. And that is not what i am looking for as everything is setup dynamically. So I cannot really provide fixed locations.

 

Can anyone point me in the right direction here how to proceed?

Edited by Scythe42
Link to comment
Share on other sites

Packages and Idle Markers will not work in my scenario as it is fully setup dynamically depending on the presence of the NPC itself and a potential target. Script is attached to the NPCs to set them up and start what they are supposed to be doing.

 

I just having problem to get SetLookAt() and DoCombatSpellApply() to work properly with my NPCs and my custom spell.

 

NPC will just idle or not firing the spell at all and sitting with it equipped there. The thing is I do not seem to have full control over what the NPC does. In my tries so far the NPC just idles with the spell equipped often or doesn't even equip it.

 

Ah well, guess I dig more into it this evening. Just thought someone might have done this before and has a working example.

Edited by Scythe42
Link to comment
Share on other sites

The creation kit wiki page on the Cast function recommends using an AI package with the UseMagic procedure if you want a character to really visibly cast something.

 

If that doesn't work for you, a completely scripted workaround that may work would be to simultaneously use the Cast function to cast the spell, and the SendAnimationEvent function to make the character play a spellcasting animation. May be difficult to time them correctly though. Might be possible to start playing animation first, and find a good timing for the Cast function using OnAnimationEvent to detect when a certain point in the animation is reached.

Link to comment
Share on other sites

Packages and Idle Markers will not work in my scenario as it is fully setup dynamically depending on the presence of the NPC itself and a potential target. Script is attached to the NPCs to set them up and start what they are supposed to be doing.

 

I just having problem to get SetLookAt() and DoCombatSpellApply() to work properly with my NPCs and my custom spell.

 

NPC will just idle or not firing the spell at all and sitting with it equipped there. The thing is I do not seem to have full control over what the NPC does. In my tries so far the NPC just idles with the spell equipped often or doesn't even equip it.

 

Ah well, guess I dig more into it this evening. Just thought someone might have done this before and has a working example.

 

Well that sounds like a lot of fun...and way above my pay grade. Anyone who can code anything in my game gets +5 cookies from me; I read papyrus as well as I read Sanskrit. I wish I had more help to offer..so I will make more virtual cookies for you instead.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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