The timer bit there is the issue. When you have something repeating like that, isolate it out.
short gaveSpellshort runTimerfloat timerif ( OnActivate == 1 ) ; This occurs for 1 frame, serving as an initial trigger if ( gaveSpell != 1 ) Set gaveSpell To 1 MessageBox "You rip open the skin and a putrid smell arises. It gives you a funny feeling in the back of your throat." "player"->AddSpell "01mc_poisonioustrollskinn" Activate Set runTimer To 1 Set timer To 0 ; Clear the timer endifendifif ( runTimer == 1 ) Set timer to ( timer + GetSecondsPassed ) if ( timer > 10 ) Set runTimer to 0 ; Stop it from running further "player"->RemoveSpell "01mc_poisonioustrollskinn" endifendif
The timer handling code is very simple, you're just waiting for the time to be up, so that's all you check for. Having it within the OnActivate block means it only runs for one frame, and so will never hit the time condition.
Other than that bit, your script looks pretty good. :thumbsup: Tweak it and test in game.
Short and long are stored as integers and would be generally used for when exact numbers are needed. Long can hold larger numbers than short, but I have never seen it used outside of MWSE.
Short is (-2^16, +2^16-1], I believe, with long being (-2^31, +2^31-1]. Longs are just used when you need to count up to 4 billion; they however match the memory model of Morrowind and use MWSE uses them to store C++ pointers (a total hack, which is why it breaks when you save/reload, but it works for a short time).
Floats store decimals, and are used when you need to track a value that is not whole or will almost never be exact. How much time has passed is one example since the game counts fractions of seconds. This is why a timer is stored as a float. Distance is another. You probably won't be at 256 units from object x when the part of the script that would detect it runs, so you use > 255 but < 257, which is anywhere from 255.1 to 256.9. Health may look like a whole number for example, but it isn't. You may need to detect if the player has less than < 1 instead of == 0, for example.
Correct. The "float" in floating point means the decimal place, which appears to float depending on the value and precision. There are some limits to them still, but much larger values are possible.
Unfortunately, the game can in some cases store shorts, longs and floats in floats on disk, which can hurt precision (floats have some rounding errors). If you're interested in the details, check:
http://en.wikipedia.org/wiki/Floating_point
http://en.wikipedia.org/wiki/Integer_(computer_science)
Morrowind uses 16-bit shorts and 32-bit longs and floats.