Jump to content

Script help needed


cscottydont

Recommended Posts

I'm working on a custom summon spell that (because of the way I'm doing it) doesn't give any skill xp on cast.

So I gave a contact spell to my summons (via their attack data) that fires a script to give skill xp.

 

I want to increase Conjuration xp a small amount every time the creature attacks and give a more substantial boost if it manages to kill something.

 

Heres the script:

Scriptname csd_conj_MinionXPScript extends activemagiceffect  
{Script attached to all minion attacks to level conjuration}

Import Game

Actor property PlayerRef auto

Actor CastActor 
Float PlayerSkill

Event OnEffectStart(Actor akTarget, Actor akCaster)

CastActor = akCaster
PlayerSkill = PlayerRef.GetAV("Conjuration") 

     ;This Part Works 
Float SkillAdv = (PlayerSkill * (PlayerSkill / 30))
AdvanceSkill("Conjuration", SkillAdv)

EndEvent

Event OnDying(Actor akKiller)

       Debug.Notification("OnDying Happened")
    ;This Part Does Not Work
if akKiller == CastActor

	AdvanceSkill("Conjuration", (PlayerSkill * 2))
	Debug.Notification("Familiar killed.")

endif

EndEvent

 

The OnEffectStart block works but the OnDying block never happens. It compiles fine, so why does akKiller not equal CastActor

Edited by cscottydont
Link to comment
Share on other sites

it won't work unless the really the caster killed the creature. if i kill this creature of yours the killer will be PlayerRef. caster is what summoned the creature as far as i understand right? so if it is killed by anyone else it won't work

 

PS:this was edited after i reviewed the script well

Edited by hfiani
Link to comment
Share on other sites

the OnDying() even must be put on the creature itself. not the spell. this is might be the reason why it is not working. make a new script having this OnDying() and put it on the summoned creature. i never tried OnDying() on an effect that applied on a creature
Link to comment
Share on other sites

this isn't a script attached to a summon spell. it is attached to a spell that the creature is casting and applying to another actor via combat hits.

 

EDIT: added a notification to the OnDying so now I know the event is firing but akKiller still != akCaster even though the summoned creature is the only thing doing damage.

Edited by cscottydont
Link to comment
Share on other sites

the OnDying() even must be put on the creature itself. not the spell. this is might be the reason why it is not working. make a new script having this OnDying() and put it on the summoned creature. i never tried OnDying() on an effect that applied on a creature

 

I don't think so...

If you look at Dawnbreaker script, the explosion is called onDying() even though it is activemagiceffect script...

Link to comment
Share on other sites

Is there any "duration" in the spell, or enchantment attached to the attack?

The Dawnbreaker works in similar way, but its effect has duration.

If I were you I would try using onEffectStart, onHit, and onDying and give very long duration to the magic effect,

so that the function works when the enemy is hit. (You should have something like, if akAggressor == CastActor)

 

As far as I can remember,

 

at first hit, onEffectStart will be called. onHit won't be called because the script is attached after the hit.

From second hit, onHit will be called.

When dying, onDying will be called.

Link to comment
Share on other sites

A long duration spell is unnecessary as the script is working right now all except for the akCaster/akKiller thing.

 

OnEffectStart is happening, OnDying is happening.

 

EDIT: akKiller is the player for some reason.

 

I'm assuming that is due to SetPlayerTeammate, though that effect is not listed on the wiki.

Edited by cscottydont
Link to comment
Share on other sites

  • Recently Browsing   0 members

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