Jump to content

Applying Script Through Ability on Race


Recommended Posts

I'm trying to attach an ability-type spell into the race record that runs a script.

 

The script itself is very, very simple:

Scriptname TestScript:AbilityTestScript extends Actor

Message Property Message1 Auto Const

Keyword Property Keyword1 Auto Const

Event OnItemEquipped(Form akBaseObject, ObjectReference akReference)

	If akBaseObject.HasKeyword(Keyword1) == True

		Message1.Show()

	endIf

endEvent

This script is then applied to a MagicEffect entry of the "Script" archetype. This MagicEffect is then fed into an ability-type spell. And this ability-type spell is then added to the HumanRace record as an ability.

 

However, when I try equipping a weapon with Keyword1 (which I added to its keyword list) it displays no message, which I think means that the script isn't getting fired.

 

What am I doing wrong?

The script is extends Actor and the OnItemEquipped is meant for actors so it should fire, no? Likewise, because it applies to humanrace and PC is humanrace, then it should hold, no?

Link to comment
Share on other sites

I'm pretty sure you should have "extends ActiveMagicEffect" instead of "extends Actor".

 

Ahhh, so I can't switch them around? Stupid me, I thought they could be switched.

 

So if I want to run the script above, which extends an actor, I would need to RegisterRemoteEvent during an OnInit event and then run the event using Actor.OnItemEquipped, right? Or would it work as it stands?

 

Okay, just answered my own question through testing. So I guess I understood script extension even less than I thought.

Edited by paulatreides0
Link to comment
Share on other sites

  • Recently Browsing   0 members

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