Scriptname phiTameBeastTriggerS extends ActiveMagicEffect Spell Property phiTaming autoSpell Property phiTamed autoEvent OnEffectStart(Actor akTarget, Actor akCaster) if akTarget.HasSpell(phiTamed) != 1 && akTarget.HasSpell(phiTaming) != 1 akTarget.AddSpell(phiTaming) Debug.Notification( "phiTaming Added" ) endifEndEvent
This checks to see if the creature is being tamed or already tamed. (phiTaming and phiTamed are disease spells that get added as placeholders to the creature in question depending on whether they are, you guessed it, tamed or being tamed.) If this check passes and the target creature is neither tamed nor in the process of being tamed, the tame process starts by adding the phiTaming disease spell to the creature.
This part seems to work, and I get the "phiTaming Added" notification. This phiTaming disease spell itself has a spell effect with a script that is SUPPOSED to track the tame progress. Since it is a disease, OnEffectStart SHOULD work. That script looks like this:
Scriptname phiTameBeastTimerS extends ActiveMagicEffect phiTameBeastTracker1S Property phitrackerquest autoMagicEffect Property phiTameBeastSet autoSpell Property phiTaming autoActor Property phiSpellTarget autoint timer1 = 0int timer2 = 0Event OnEffectStart(Actor akTarget, Actor akCaster) phiSpellTarget = akTarget Debug.Trace("Effect started on " + akTarget) RegisterForUpdate(1)EndEventEvent OnUpdate() timer1 += 1 if (phiSpellTarget.HasMagicEffect(phiTameBeastSet)) Debug.Notification( "Hit by spell..." ) timer1 = 0 timer2 += 1 if timer2 >= 10 phitrackerquest.phiTameBeastRef1 = phiSpellTarget phitrackerquest.phitargeted = 1 phiSpellTarget.RemoveSpell(phiTaming) Debug.Notification( "Sent to quest..." ) endif else if timer1 >= 5 timer2 = 0 phiSpellTarget.RemoveSpell(phiTaming) Debug.Notification( "Tame reset..." ) endif endifEndEventHOWEVER, it appears the script is totally ignoring the magic effect and script on this placeholder ability spell. I never get the notification "Effect started on..." which seems to indicate the OnEffectStart block is never run.
(The first line "phiTameBeastTracker1S Property phiTameBeastTracker1 auto" is needed to "plug in" to my quest script phiTameBeastTracker1S where I want to keep track of the reference variable and also set an int. I have declared the variables I want to use for this as properties in that quest script (see below.)
The OnUpdate event is supposed to increment a timer. If the target creature goes for more than 5sec without being hit by the player's spell (with the phiTameBeastSet effect on it), the script should remove the ability placeholder spell. The odd thing is, that appears to work.
However, I never get the "Hit by spell..." "Sent to quest..." or "Tame reset..." notifications.
The 'send to quest' part is basically supposed to set the reference and int variables I set as properties (to make them accessable by other scripts) in my quest script to the current tame target and 1 so I know I got a target. This is supposed to happen if the player casts the tame spell at the target for a sustained 10sec without losing the tame by going 5sec or more without casting it at them. (Again this is a very early model.)
Just to test I was trying to have the quest disable the target creature if this int value was set to 1, which never happened either. Just for the record though, here's that quest script;
Scriptname phiTameBeastTracker1S extends QuestActorBase property phiTameBeastBase1 autoActor property phiTameBeastRef1 autoint property phitargeted autoEvent OnInit() RegisterForUpdate(1)EndEventEvent OnUpdate() if phitargeted == 1 phiTameBeastRef1.Disable() endifEndEvent
EDIT: I realized I was declaring the same names in my quest script as both variables and properties which was not needed. Corrected, but that wasn't the problem.


