Jump to content

Recommended Posts

Posted
Hello all! Is there a way to dynamically attach a script to a newly created object? Say, I cast a magelight, but I want it to do something when I hit it with a spell or a weapon. Is such a thing possible?
Posted
That sounds like a pretty interesting solution. I'm not very familiar with using referencealias though. Do you have any tutorials or links to sample applications of referencealias?
Posted

Well, there's http://www.creationkit.com/Dynamically_Attaching_Scripts

 

but I didn't care very much for it. I probably don't know enough yet to, uh, properly appreciate the samples.

 

I was thinking along the lines of having script A on the player to handle OnSpellCast that would call out to the ReferenceAlias script B passing the spell, which would do a Self.ForceRefTo(passedInSpell), at which point script B is now attached to the spell just cast.

 

I don't know if that's how it actually works or not, it's just an idea.

Posted (edited)
Why not make a custom magelight spell instead? An easy way might be to make a custom magelight spell that uses a *copy* of the vanilla magelight effect/object, then simply attach your script to the copied effect/object. That way your custom magelight orb will always have the script on it and you won't need to mess about with referencealiases oy dynamically attached scripts. Edited by steve40
Posted
Oh... that's surprisingly simple haha. How can the magelight projectile tell if it's hit with something though? If I'm not mistaken, casting magelight places a magic effect on the caster. So if I use the onhit event, it'll read it as the player being hit and not the magelight itself.
  • Recently Browsing   0 members

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