Jump to content

Need Scripting Help


KeatonMask

Recommended Posts

I'm trying to script a magic effect to attach to an enchantment to attach to a weapon that will cast either fear or frenzy on a hit target. The script successfully compiles, but nothing happens ingame when I hit an enemy. Here's what I have:

 

Scriptname BiPolarity extends activemagiceffect

 

SPELL Property Fear Auto

 

SPELL Property Fury Auto

 

INT coinflip

 

Event OnEffectStart(Actor akTarget, Actor akCaster)

 

coinflip = utility.RandomInt(1, 2)

 

IF(coinflip == 1)

Fear.cast(akTarget, akTarget)

ELSEIF(coinflip == 2)

Fury.cast(akTarget, akTarget)

ENDIF

 

EndEvent

 

Can anyone tell me what I'm doing wrong and/or how I can fix it?

PS This is only my second script ever, so please be gentle.

Edited by KeatonMask
Link to comment
Share on other sites

I'm not sure, but the culprit could be the spell.cast part.

 

Try with this http://www.creationkit.com/DoCombatSpellApply_-_Actor

 

Some like

 

Game.GetPlayer().DoCombatSpellApply(fear, akTarget)

 

That made some progress, but, as far as I can tell, only Fury is being applied. I'm seeing neither the Fear hit shader nor its its effects on targets--the latter of which I think would be evident, as I've noticed Fear tends to override Fury. I've tried inverting which integer points to each effect, i.e. 1 for Fury and 2 for Fear, and I've tried increasing the magnitude of the Fear and Fury effects beyond level resistance. Still no dice. You were right about the spell.cast part though, thanks.

Link to comment
Share on other sites

Try adding messages or notifications with the spell casts.

 

So you can know if the problem is inside the script (one spell is never casted, so maybe the randomint isn't working), or inside the magic effects (so maybe like you said one overrides the other)

Link to comment
Share on other sites

Try adding messages or notifications with the spell casts.

 

So you can know if the problem is inside the script (one spell is never casted, so maybe the randomint isn't working), or inside the magic effects (so maybe like you said one overrides the other)

 

Good idea. Fear and fury are being applied properly; the confusion stemmed from the fact that the particular spells I was using had the same hit effect. I'll differentiate them, and everything should be good to go. Thank you for your help.

Edited by KeatonMask
Link to comment
Share on other sites

It may sound silly but have you verified that the properties are set correctly? It's easy to forget that you have added a new property on the script that has to be edited on the magic effect to point to the correct spell.

 

Also, wouldn't it be easier to add the Fear and Fury magic effects directly on the enchantment using the condition GetRandomPercent? This way no script is needed.

 

So the enchantment's effects tab would look like this:

If GetRandomPercent <= 50 use Fury

If GetRandomPercent > 50 use Fear

 

I haven't tried this so I don't know if it will work, but you may want to try it instead of the script to see if it works.

 

 

Edit:

Oh, I'm late ^_^U

Edited by pauderek
Link to comment
Share on other sites

  • Recently Browsing   0 members

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