The Nexus Forums: What the... - The Nexus Forums

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

What the... Try and help, if you can.

#1 User is offline   Kaitsith 

  • Stranger
  • Pip
  • Group: Members
  • Posts: 4
  • Joined: 25-October 09

Post icon  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.
0

#2 User is offline   Vagrant0 

  • Veterinarian
  • Icon
  • Group: Staff
  • Posts: 5,795
  • Joined: 14-June 06

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:

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.
0

#3 User is offline   Kaitsith 

  • Stranger
  • Pip
  • Group: Members
  • Posts: 4
  • Joined: 25-October 09

Posted 18 November 2009 - 09:39 AM

Hmm... No, that didn't change anything.
Thanks anyway though.
0

#4 User is offline   Vagrant0 

  • Veterinarian
  • Icon
  • Group: Staff
  • Posts: 5,795
  • Joined: 14-June 06

Posted 18 November 2009 - 08:50 PM

View PostKaitsith, on Nov 18 2009, 09:39 AM, said:

Hmm... No, that didn't change anything.
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.
0

#5 User is offline   Kaitsith 

  • Stranger
  • Pip
  • Group: Members
  • Posts: 4
  • Joined: 25-October 09

Posted 02 December 2009 - 06:47 AM

I'm attaching it to the creature, and I'm using a fresh save every time.
0

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users


Skin by Skinbox
Quality & cheap IPB skins, premade vBulletin styles, cheap Web templates and more! - Skinbox