Page 1 of 1
What the... Try and help, if you can.
#1
Posted 18 November 2009 - 06:41 AM
So I'm making a Blue Magic mod (Final Fantasy players would know what this is), and it seems I have an unexpected error on my hands.
The script I have written is meant to grant you a spell when you hit the enemy with a certain weapon, but for some reason, when I fast-travel to a location near the testing creature, it grants me the spell!
Here's the tester script:
scn aaaBlueMagicBlackBearTEST
short doonce
short buttonpressed
int button
Begin OnMagicEffectHit == BMCapturespell
if doonce == 0
MessageBox "Learn Bear Roar?", "Yes", "No", "Not right now"
set doonce to 1
set buttonpressed to 1
else
Message "You already know this spell."
endif
end
begin GameMode
if buttonpressed == 1
set button to GetButtonPressed
if button == 1
set doonce to 0
set buttonpressed to 0
Message "Ok then. Did not learn Bear Roar"
elseif button == 0
set buttonpressed to 0
player.AddSpell BMBlackBear
Message "Gained blue magic- Bear Roar!"
endif
endif
end
Any help would be greatly appreciated.
The script I have written is meant to grant you a spell when you hit the enemy with a certain weapon, but for some reason, when I fast-travel to a location near the testing creature, it grants me the spell!
Here's the tester script:
scn aaaBlueMagicBlackBearTEST
short doonce
short buttonpressed
int button
Begin OnMagicEffectHit == BMCapturespell
if doonce == 0
MessageBox "Learn Bear Roar?", "Yes", "No", "Not right now"
set doonce to 1
set buttonpressed to 1
else
Message "You already know this spell."
endif
end
begin GameMode
if buttonpressed == 1
set button to GetButtonPressed
if button == 1
set doonce to 0
set buttonpressed to 0
Message "Ok then. Did not learn Bear Roar"
elseif button == 0
set buttonpressed to 0
player.AddSpell BMBlackBear
Message "Gained blue magic- Bear Roar!"
endif
endif
end
Any help would be greatly appreciated.
#2
Posted 18 November 2009 - 09:05 AM
Probably because you have button == 0 equaling a "yes" answer. You also have some of the variables a bit funky. It might work better like:
changes are in bold
It would probably be better to just get rid of the message box format entirely, and just expect the player to not use that spell on a new creature unless they wanted to learn the spell. Or, instead of making it a 100% chance to learn from a single hit, make learning it randomized a bit.
Keep in mind that each instance of the creature that this is tied to will have its own script and its own "doonce" variable, so some sort of quest variable might be needed instead if you have more than one creature that this spell can be learned from.
You should also read the notes for http://cs.elderscrol...etButtonPressed incase the scripted effect on the spell also contains some message boxes.
scn aaaBlueMagicBlackBearTEST short doonce [b]short[/b] button Begin OnMagicEffectHit == BMCapturespell if doonce == 0 MessageBox "Learn Bear Roar?", [b]"No", "Yes"[/b] set doonce to 1 else Message "You already know this spell." endif end begin GameMode [b]if doonce == 1[/b] set button to GetButtonPressed if button ==[b] 0[/b] set doonce to 0 Message "Ok then. Did not learn Bear Roar" elseif button == [b]1[/b] [b]set doonce to 2[/b] player.AddSpell BMBlackBear Message "Gained blue magic- Bear Roar!" endif endif end
changes are in bold
It would probably be better to just get rid of the message box format entirely, and just expect the player to not use that spell on a new creature unless they wanted to learn the spell. Or, instead of making it a 100% chance to learn from a single hit, make learning it randomized a bit.
Keep in mind that each instance of the creature that this is tied to will have its own script and its own "doonce" variable, so some sort of quest variable might be needed instead if you have more than one creature that this spell can be learned from.
You should also read the notes for http://cs.elderscrol...etButtonPressed incase the scripted effect on the spell also contains some message boxes.
#4
Posted 18 November 2009 - 08:50 PM
Kaitsith, on Nov 18 2009, 09:39 AM, said:
Hmm... No, that didn't change anything.
Thanks anyway though.
Thanks anyway though.
What are you attaching this script to?
Do you have any other scripts which are calling a menubox while the thing this script is attached to is in the active area?
Are you playing with a fresh save every time, or are you re-using a save that was made after the mod, and this script was activated? Using a save made after the mod was activated can often cause scripting changes to not take effect and is one of the main reasons why some people have so many problems with scripting.
Page 1 of 1



MultiQuote