Jump to content

Scripting help needed


Recommended Posts

Hi,

 

I need support on an issue with papyrus scripting and I think you are the one that can help me out :)

 

Basically, I have a script that extends ActivemagicEffect

 

In the InHit Event, I try to cast a spell, says a Fasthealing spell to the player.

 

Here's a sample code:

 

 

1 Scriptname mySuperPower Extends ActiveMagicEffect

...

9 Spell Property FastHealing Auto

...

18 Actor me

...

20 Event OnEffectStart(Actor aktarget, Actor akCaster)

21 me = akTarget

...

29 EndEvent

...

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

...

107 FastHealing.Cast(me, me)

...

150 EndEvent

 

 

Very simple and straightforward. But the problem is that targetting the player don't work. here's is a trace log:

 

06/20/2012 - 07:01:33PM] error: Cannot call Cast() on a None object, aborting function call

stack:

[Active effect 1 on (00000014)].mySuperPower.OnHit() - "mySuperPower.psc" Line 107

 

From what I know, when the ActiveMagicEffect triggered from the player ref (0x00000014), it can't cast on itself. But when the ActiveMagicEffect triggered from an NPC, everything work pretty well.

 

So I replace the line 107 with the following:

 

107 FastHealing.Cast(Game.GetPlayer(), Game.GetPlayer())

 

And same error code.

 

Then I tried Game.GetForm(0x00000014) as Actor, or Game.GetForm(0x00000007) as Actor.. but same error.

 

I can't figure out how to cast a spell to affect the player.. any idea?

Link to comment
Share on other sites

More info about this issue:

 

Here's the trace when player hit a Draugr, and Draugr got targetted by the spell:

 

 

[06/20/2012 - 10:40:21PM] hit recorded

[06/20/2012 - 10:40:21PM] Try to cast a spell from akAggressor to me

[06/20/2012 - 10:40:21PM] mySuperPower property: [sPELL < (92002038)>]

[06/20/2012 - 10:40:22PM] try to damageAV me

 

And here's what is traced when Draugr hit player:

 

 

[06/20/2012 - 10:40:03PM] hit recorded

[06/20/2012 - 10:40:04PM] Try to cast a spell from akAggressor to me

[06/20/2012 - 10:40:04PM] mySuperPower property: None

[06/20/2012 - 10:40:04PM] error: Cannot call Cast() on a None object, aborting function call

stack:

[Active effect 1 on (00000014)].mySuperPower.OnHit() - "mySuperPower.psc" Line 109

[06/20/2012 - 10:40:04PM] try to damageAV me

 

 

So, property binding don't work when Magic Effect is linked to Player. But it work when binded on a monster or an NPC.

 

..now, we have to figure out why this is happening... any clue?

Link to comment
Share on other sites

  • Recently Browsing   0 members

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