Jump to content

Need help fixing a script


ABVXYzackattack

Recommended Posts

Hey, I really need help making this script effect work in my game. I've made it and everything seems fine, but it doesn't work!!!! :(

 

Here is a copy of it:

 

scn ZSmejhxScript

 

float Timer

short Active

short Withdrawl

 

Begin ScriptEffectStart

 

Set Withdrawl to 0

Set Timer to 0

player.removespell ZSmejhxWithdrawl

Set Active to 1

 

End

 

Begin ScriptEffectUpdate

 

If Active == 1

 

Player.Addspell ZSmejhxHigh

Set Timer to (Timer + ScriptEffectElapsedSeconds)

 

endif

 

If Timer >= 120

 

Set Active to 0

Set Withdrawl to 1

 

endif

 

end

 

Begin ScriptEffectUpdate

 

If Withdrawl == 1

 

MessageBox "Your body begins to feel crippled as the Smejhx withdrawl takes place..."

player.removespell ZSmejhxHigh

player.addspell ZSmejhxWithdrawl

 

endif

 

end

 

I've made sure it's a spell effect script, and that the duration of the effect matches the timer variable, so what's wrong?

Link to comment
Share on other sites

My guess is that when you remove the high spell, it immediately terminates the script so that the withdrawal spell never gets added. Also, you need two scripteffectupdate blocks but I don't think that's causing the problem. Edited by documn
Link to comment
Share on other sites

hmmmmm......that would make sense. but the problem is is that it never removes the high spell. it just stays there after the timer is gone. i made it an ability so that it wouldn't be affected by a resist magic or weakness to magic. i think it has something to do with the timer variable, like it can't read it or it never achieves the destined value. also, where would i put the 2 scripteffectupdate blocks at? where the withdrawl effect starts?
Link to comment
Share on other sites

Ooops, I meant that you DON'T need two scripteffectupdate blocks. I don't foresee any problems if you stick your code into one block.

 

Also, it may be helpful to add a printtoconsole command after you update your timer to see if it's working as intended. Just under your "set timer to timer + scripteffectelapsedseconds" line, put this line:

printc "timer = %g" timer

 

This should show you what your timer variable is if you open your console. If the numer isn't constantly increasing, then yes, there is something wrong with your timer.

Link to comment
Share on other sites

I don't know what's wrong with the timer. Personally I would just do

set timer to timer + scripteffectelapsedseconds

but I don't see why your parenthesis would mess with it. Alternatively, you could just set your high spell to be 120 seconds long and add the withdrawal spell in a scripteffectfinish block. Another option is to add a scripted token in the scripteffectstart block, and let the token run the timer, and when the timer's up you can remove the high, add the withdrawal, and then remove the token.

Link to comment
Share on other sites

Alright. I feel ya on ur first idea. But how would the scripteffectfinish block fit in there without a timer variable? Could I do like two script effects on the same potion? Like have one that serves only as a timer with no effects, and thus the second one would have the high and withdrawl? Like automatically start off with the high, and the second the timer script effect spell wears off, the withdrawl kicks in? Does this make any sense?
Link to comment
Share on other sites

  • Recently Browsing   0 members

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