Jump to content

[LE] Tieing two actors by life


AslanKebab

Recommended Posts

Hello Everyone!

 

I have been trying to create a spell, where a new minor actor appears near the targeted actor (when hit by a spell projectile), the targeted actor Ai gets turned off Similiar to the (TCAI/TAI commands) for the duration of the spell and when the minor actor is killed, (for example a skeever) a significant chunk of the targeted actor´s health is taken away, alternatively have their AI turned off indefinitely.

 

Now, I have done a few attempts and understand that I would need one or more scripts. (I do not have access for SKSE for this mod btw)

 

One alternative I´ve considered is storing the actor information I need an in a conditional quest script and to monitor whether or not the minor actor has died and if the targeted actor´s ai is turned off. (I have yet to find away to do that in script or through the editor.)

 

The issue I´ve had is figuring out how to transfer this information to the quest script or alternatively how to store it in the Active Magic Effect script instead.

 

so far

 

 

the GetTargetActor Function does not want to compile when put within an OnHit event

Scriptname Spellname extends activemagiceffect  Conditional

Actor Property PLayeREF auto
Spell Property ActiveFireEffect Auto

Actor Function GetCasterActor() native

Event OnHit(ObjectReference akAggressor, Form akSource, Projectile akProjectile, bool abPowerAttack, bool abSneakAttack, bool abBashAttack, bool abHitBlocked)

  Actor target = ActiveFireEffect.GetTargetActor()

EndEvent

if you can spot anything wrong with this syntax or give an alternative solution.

 

I am open to hearing it.

Edited by AslanKebab
Link to comment
Share on other sites

The problem there with GetTargetActor is that you are running it on a spell form and that's not the script it belongs to, it's an ActiveMagicEffect function. That is a running instance of an spell/enchantment effect on an actor. For example you could do "self.GetTargetActor()" and it would give you the actor in which that instance of SpellName script is running on*. It's very different from a spell property which is the equivalent of writing the spell's formID in pre-skyrim scripting. Not sure if that's clear.

 

You also don't need to declare functions like: "Actor Function GetCasterActor() native"

 

What I'm not completely sure is what want to do, what is the "ActiveFireEffect" filled with?

 

*there are other ways to get that, for example in an OnEffectstart event one of the arguments is the target actor and other the caster and you can save it to a variable outside the event to use it in other events or functions.

Edited by FrankFamily
Link to comment
Share on other sites

Hello Frank Family

 

Sorry, the Actor Function GetCasterActor() native was there when I was trying to get things to compile to begin with.

Thanks for the segestion on using "self.GetTargetActor()" instead

 

I will segment this post into questions that I have trouble finding an answer to, maybe that clears upp some of the fog:

 

- Using an OnEffectStart Event, would that event fire when the target get´s hit with the projectile or when it was cast?

it is not clear to me when it comes to aimed spell hence I was using the OnHit event.

 

- is there a way of turning off the actor´s AI from a script?

Where should that go? in the magic effect script or the Quest script?

 

- How do I place an actor near the target actor instead of the near the player?

PlaceActorAtMe or PlaceAtMe seem to need markers to place at a custom location, can I use another actor as a marker then?

 

The last and sort of irrelevant this spell question

- What is the best way to have a script distinguish between Concentration spells and Fire and Forget Spells?

 

 

Thanks in advance

Edited by AslanKebab
Link to comment
Share on other sites

1) When it hits him. In a simple fire effect thst's when he woukd start burning, same thing here.

 

2) Theres this function: https://www.creationkit.com/index.php?title=EnableAI_-_Actor

I dont see why you'd need a quest for it. Could perfectly well be run from the magic effect.

 

3) Yes, you'd use those (if you use placeactoratme check the notes in the wiki: https://www.creationkit.com/index.php?title=PlaceActorAtMe_-_ObjectReference). Both are run in an object reference which can be a marker or anything else, another actor is fine.

 

4) I would just make a bool property and set it yourself in ck with whether its conc or fire and forget.

Edited by FrankFamily
Link to comment
Share on other sites

Thanks to your answers, with a little tweaking and some added Bells and whistles this spell turned out great. :D

 

I am super Happy with the results, thank you!

 

As for the fourth question that was not exactly what I was looking for.

I was looking for a way for a magic effect script to dynamically know whether other spells being cast are FF or Conc spells.

 

As onSpellCast() only fires once during concentration/rapid fire spells it is not possible to re-assign Magicka cost to a different actor value on the fly.

 

Sorry If I was not clear enough.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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