another generic title about scripting problems

Post » Fri May 27, 2011 11:05 pm

I'm making a mod which requires me to change the charachter generation and I've got the name and race menus working, but I have yet to detirmine the cause of my current script failing to work, it dosen't even start even though all of the variables are fufilled, it's attached to an NPC

begin Lotr_etryanarespeakshort button; short "LOTR_ChargenState" and short "LOTR_Chargen" are globalsif ( MenuMode == 1 ) 	Returnendifif ( GetDistance, Player <= 1000 )	if ( LOTR_ChargenState == 1 ) ; returns true if chargen is in progress		if ( LOTR_Chargen == 20 )			AIWander, 0, 0, 0 ; stops her from moving			say, "Lotr\AwakenFriend.wav", "Uruk-Hai are coming, We need to get some weapons on you"			Set LOTR_Chargen to 21		elseif ( saydone == 1 )			if( LOTR_Chargen == 21 )				enableClassMenu				Set LOTR_Chargen to 22			endif		elseif ( LOTR_Chargen == 22 )			MessageBox "What is your preferred fighting class?", "Soldier", "Ranger", "Assassin", "Warrior", "Conjurer"			set LOTR_Chargen to 41		elseif ( LOTR_Chargen == 41 )			set button to GetButtonPressed			if ( button == -1 )			return			elseif ( button == 1)				MessageBox "You have been equipped with a soldier's weapon set"				player -> additem "MR_elf_spear" 1				player -> additem "MR_URKsword" 1				player -> additem "MR_URKtsword" 1				player -> additem "dwemer_shield" 1				player -> additem "dwemer_boots" 1				player -> additem "dwemer_cuirass" 1				player -> additem "dwemer_greaves" 1				player -> additem "dwemer_helm" 1				EnablePlayerControls				MessageBox "You have been equipped with a soldier's weapon set"				set LOTR_Chargen to 42			elseif ( button == 2 )				MessageBox "You have been equipped with a Ranger's weapon set"				player->additem "long bow" 1				player->additem "iron arrow" 100				player->additem "iron halberd" 25				player->additem "iron dagger" 1				player->additem "iron shortsword" 1				player->additem "chitin cuirass" 1				player->additem "chitin greaves" 1				player->additem "chitin boots" 1				player->additem "chitin helm" 1				EnablePlayerControls				MessageBox "You have been equipped with a Ranger's weapon set"				set LOTR_Chargen to 42			elseif ( button == 3 )				MessageBox "You have been equipped with an Assassin's Weapon set"				player->additem "long bow" 1				player->additem "iron arrow" 100				player->additem "iron dagger" 1				player->additem "iron shortsword" 1				player->additem "chitin cuirass" 1				player->additem "chitin greaves" 1				player->additem "chitin boots" 1				player->additem "chitin helm" 1				EnablePlayerControls				MessageBox "You have been equipped with an Assassin's Weapon set"				set LOTR_Chargen to 42			elseif ( button == 45 )				MessageBox "You have been equipped with a Warrior's Weapon set"				player->additem "glass longsword" 1				player->additem "glass war axe" 1				player->additem "goblin_club" 1				player->additem "MR_elf_spear" 1				player->additem "daedric_shield" 1				player->additem "daedric_boots" 1				player->additem "daedric_cuirass" 1				player->additem "daedric_greaves" 1				player->additem "daedric_god_helm" 1				EnablePlayerControls				MessageBox "You have been equipped with a Warrior's Weapon set"				set LOTR_Chargen to 42			elseif ( button == 5 )				MessageBox "You have been equipped with a Conjurer's weapon set"				player->additem "glass staff" 1				player->additem "glass frostsword" 1				player->additem "fur_cuirass" 1				player->additem "fur_greaves" 1				player->additem "fur_boots" 1				player->additem "LOTR_Conjurer_Robe" 1				player->equip "LOTR_Conjurer_Robe"				player->addspell "Hearth Heal"				player->addspell "Mark"				player->addspell "Recall"				player->addspell "summon Scamp"				EnablePlayerControls				MessageBox "You have been equipped with a Conjurer's weapon set"				set LOTR_Chargen to 42			endif		elseif ( LOTR_Chargen == 42 )			MessageBox "you should talk to Etyanár? before doing anything else"			journal "LOTR_WpnChoice" 20			set LOTR_Chargen to 50			AIWander 1024, 5, 0, 10, 10, 10, 10, 20, 10, 10, 10, 10, 10		endif	endifendifend


if anyone can tell me what's going wrong with it, I will be most grateful.
User avatar
Dj Matty P
 
Posts: 3398
Joined: Sat Jun 09, 2007 12:31 am

Post » Sat May 28, 2011 3:48 am

The Tolkien estate IP lawyers are causing it to fail? :P

Seriously though:
In your button section, you skip from -1 to 1. The first button is 0, then 1, then 2, etc... There is no button 5 (it's 4), and you mis-typed 4 (really 3) as 45.
You're also going to want to heavily reformat it, for speed and stability. You have far, far to many nested blocks and the GetDistance should not be a surrounding block.
Two messageboxes, or more, in a single frame may not be a good idea.

begin Lotr_etryanarespeakshort button; short "LOTR_ChargenState" and short "LOTR_Chargen" are globalsif ( MenuMode == 1 ) 	Returnendifif ( LOTR_ChargenState != 1 ) ; returns true if chargen is in progress    returnendifif ( LOTR_Chargen == 20 )    if ( GetDistance, Player <= 1000 )        AIWander, 0, 0, 0 ; stops her from moving        say, "Lotr\AwakenFriend.wav", "Uruk-Hai are coming, We need to get some weapons on you"        Set LOTR_Chargen to 21elseif ( LOTR_Chargen == 21 )    if ( saydone == 1 )        enableClassMenu        Set LOTR_Chargen to 22    endifelseif ( LOTR_Chargen == 22 )    MessageBox "What is your preferred fighting class?", "Soldier", "Ranger", "Assassin", "Warrior", "Conjurer"    set LOTR_Chargen to 41elseif ( LOTR_Chargen == 41 )    set button to GetButtonPressed    if ( button == -1 )        return    elseif ( button == 0)        MessageBox "You have been equipped with a soldier's weapon set"        player -> additem "MR_elf_spear" 1        player -> additem "MR_URKsword" 1        player -> additem "MR_URKtsword" 1        player -> additem "dwemer_shield" 1        player -> additem "dwemer_boots" 1        player -> additem "dwemer_cuirass" 1        player -> additem "dwemer_greaves" 1        player -> additem "dwemer_helm" 1        EnablePlayerControls        set LOTR_Chargen to 42    elseif ( button == 2 )        MessageBox "You have been equipped with a Ranger's weapon set"        player->additem "long bow" 1        player->additem "iron arrow" 100        player->additem "iron halberd" 25        player->additem "iron dagger" 1        player->additem "iron shortsword" 1        player->additem "chitin cuirass" 1        player->additem "chitin greaves" 1        player->additem "chitin boots" 1        player->additem "chitin helm" 1        EnablePlayerControls        MessageBox "You have been equipped with a Ranger's weapon set"        set LOTR_Chargen to 42    elseif ( button == 3 )        MessageBox "You have been equipped with an Assassin's Weapon set"        player->additem "long bow" 1        player->additem "iron arrow" 100        player->additem "iron dagger" 1        player->additem "iron shortsword" 1        player->additem "chitin cuirass" 1        player->additem "chitin greaves" 1        player->additem "chitin boots" 1        player->additem "chitin helm" 1        EnablePlayerControls        set LOTR_Chargen to 42    elseif ( button == 45 )        MessageBox "You have been equipped with a Warrior's Weapon set"        player->additem "glass longsword" 1        player->additem "glass war axe" 1        player->additem "goblin_club" 1        player->additem "MR_elf_spear" 1        player->additem "daedric_shield" 1        player->additem "daedric_boots" 1        player->additem "daedric_cuirass" 1        player->additem "daedric_greaves" 1        player->additem "daedric_god_helm" 1        EnablePlayerControls        set LOTR_Chargen to 42    elseif ( button == 5 )        MessageBox "You have been equipped with a Conjurer's weapon set"        player->additem "glass staff" 1        player->additem "glass frostsword" 1        player->additem "fur_cuirass" 1        player->additem "fur_greaves" 1        player->additem "fur_boots" 1        player->additem "LOTR_Conjurer_Robe" 1        player->equip "LOTR_Conjurer_Robe"        player->addspell "Hearth Heal"        player->addspell "Mark"        player->addspell "Recall"        player->addspell "summon Scamp"        EnablePlayerControls        set LOTR_Chargen to 42    elseif ( LOTR_Chargen == 42 )        MessageBox "you should talk to Etyanár? before doing anything else"        journal "LOTR_WpnChoice" 20        set LOTR_Chargen to 50        AIWander 1024, 5, 0, 10, 10, 10, 10, 20, 10, 10, 10, 10, 10    endifendifend

User avatar
Johnny
 
Posts: 3390
Joined: Fri Jul 06, 2007 11:32 am

Post » Sat May 28, 2011 9:32 am

Funny Peachykeen, Funny.
Thanks for that but I think there may be a problem with the SayDone, nothing happens after the NPC finishes speaking.
I suppose that their internet demons may have detected the use of uruk-hai in a script but if that were true then the MERP mod for oblivion would be long gone. :)
I figure as long as I call hobbits halflings, Ents Treeherds and Amon Hen the seeing seat I should be right.
User avatar
kyle pinchen
 
Posts: 3475
Joined: Thu May 17, 2007 9:01 pm

Post » Sat May 28, 2011 7:25 am

I did notice that you're not declaring it as a short or anything, but I'm not familiar with its syntax or use, so you'd have to review the MWSfD pages on it to see for sure. You can also try commenting that if/endif (not the middle chunk, though) out and see if that fixes anything.
User avatar
Rudy Paint fingers
 
Posts: 3416
Joined: Sun Nov 11, 2007 1:52 am

Post » Fri May 27, 2011 8:56 pm

It says in scripting for dummies that it returns true if the object it's attached to is not saying anything, it's used in the chargenclassNPC script and it isn't declared as a short, so it should work.
User avatar
des lynam
 
Posts: 3444
Joined: Thu Jul 19, 2007 4:07 pm


Return to III - Morrowind