Help with a test mod

Post » Thu Jul 28, 2011 4:22 pm

Hello!

I'm trying to understand the basic concept of modding and scripting, making a simple test mod just for fun. Unfortunately, I'm stuck with a damn messagebox that repeats again and again. No help found in the wiki nor googling.

The story is short: I've added a spell to a mage who sells spells. When I buy the spell, I should receive a messagebox, and stop there. And indeed so it is. The problem is that this messagebox repeats again and again. This is the script:

scn TestMod

ref PowerSpell

begin gamemode
set PowerSpell to aaPSpell
if ( Player.HasSpell PowerSpell == 1 ) && ( Player.IsInCombat == 0 )
MessageBox "I got a very powerful spell!"
endif

end


Please, can someone of you experienced modders suggest how can I solve this problem?

Cheers,
User avatar
Lance Vannortwick
 
Posts: 3479
Joined: Thu Sep 27, 2007 5:30 pm

Post » Thu Jul 28, 2011 1:05 pm

scn TestMod

short once
ref PowerSpell

begin gamemode
set PowerSpell to aaPSpell

if ( Player.HasSpell PowerSpell == 1 ) && ( Player.IsInCombat == 0 ) && once == 0
MessageBox "I got a very powerful spell!"
set once to 1
endif

end
User avatar
Dalia
 
Posts: 3488
Joined: Mon Oct 23, 2006 12:29 pm

Post » Thu Jul 28, 2011 6:04 pm

How nice you are, aellis! Thank you very much!
And now I'm beginning to understand what kind of "reasoning" a modder should use in scripting... Thank you again!
User avatar
Nina Mccormick
 
Posts: 3507
Joined: Mon Sep 18, 2006 5:38 pm


Return to IV - Oblivion