Jump to content

DOWNLOAD MODS

Are you looking for something shiny for your load order? We have many exclusive mods and resources you won't find anywhere else. Start your search now...

LEARN MODDING

Ready to try your hand at making your own mod creations? Visit the Enclave, the original ES/FO modding school, and learn the tricks of the trade from veteran modders...

JOIN THE ALLIANCE

Membership is free and registering unlocks image galleries, project hosting, live chat, unlimited downloads, & more...

script problems


Darthkenobi
 Share

Recommended Posts

I'm curently haveing a problem with a scrpit i figured out how to make what it does is check the charecters gender and if the gender is the wrong one it unequips the item however i ran into a small problem when i added in another irem to be checked for and unequiped however it is now saying that there is a few problems with already existing lines i also included a pic to show the problems i'm having if anybody could help me with this i would apreciate it

scriptproblem.jpg

Link to comment
Share on other sites

You might try something like this.


SCN FemaleOnlyCloths


Begin OnEquip Player

     If Player.GetIsSex Male == 1

          If Player.GetEquipped Clothing01 == 1 || Player.GetEquipped Clothing02 == 1 || Player.GetEquipped Clothing03 == 1

               ;message box

               ;Unequip all the possible items

          EndIf

     EndIf

End

Link to comment
Share on other sites

You have to be careful to match If and Endif blocks whenever you're scripting. If you prefer to keep the structure your currently using rather than the one _echo is suggesting it's just a matter of matching up your blocks correctly. Let's look at your code.


If Player.GetIsSex Male == 1 ; 'everything from this untill the next endif or elseif will happen if the player is male'
Elseif GetIsID MiddlePants02Female == 1 ; 'This only happens if the above is NOT true, so if the player is female'
Player.UnEquipItem MiddlePants02Female
MessageBox "This is girls clothing, I am not wearing this"
...
[/code] You need two separate IF statements. One to check if the player is male, and inside that so it only happens if the player is male, one to find and remove the right piece of clothing.
[code]
If Player.GetIsSex Male == 1 ; 'If statement one begins, the stuff inside it only happens if the player is male'

If GetIsID MiddlePants02Female == 1 ; 'If statement two begins checking for specific clothes'
Player.UnEquipItem MiddlePants02Female
MessageBox "This is girls clothing, I am not wearing this"
Elseif GetIsID MiddlePants01Female == 1 ; 'If statement two continues only IF the first piece of clothing was not found'
Player.UnEquipItem MiddlePants01Female
MessageBox "This is girls clothing, I am not wearing this"
; 'You cary on like this untill you have all the clothing you want to check for listed then END your second IF statement still INSIDE the first one'
EndIf ; 'If statement two ends'

EndIf ; 'If statement one ends'

If you're still having trouble just post back.

Good Luck,

WT

Link to comment
Share on other sites

script 1

 scriptName femalonly




begin OnEquip Player


if Player.GetIsSex Male == 1

	elseif GetIsID Middlepants02female == 1

	Player.UnequipItem Middlepants02female

	MessageBox "This is girl's clothing i'm not wearing this."

elseif GetIsID Middlepants01female == 1

	Player.UnequipItem Middlepants01female

	MessageBox "This is girl's clothing i'm not wearing this."

elseif GetIsID Middleshirt01female == 1

	Player.UnequipItem Middleshirt01female

	MessageBox "This is girl's clothing i'm not wearing this."

elseif GetIsID Middleshirt02female == 1

	Player.UnequipItem Middleshirt02female

	MessageBox "This is girl's clothing i'm not wearing this."

elseif GetIsID UpperPants01female == 1

	Player.UnequipItem UpperPants01female

	MessageBox "This is girl's clothing i'm not wearing this."

elseif GetIsID UpperShirt02female == 1

	Player.UnequipItem UpperShirt02female

	MessageBox "This is girl's clothing i'm not wearing this."

endif

End
script 2
SCN AAFemaleOnlyCloths


Begin OnEquip Player

     If Player.GetIsSex Male == 1

          If Player.GetEquipped MiddlePants01female == 1 || Player.GetEquipped Middlepants02female == 1 || Player.GetEquipped MiddleShirt01female == 1

               ;message box

               ;Unequip all the possible items

     EndIf

End
script 3
SCN FemaleOnlyCloths


Begin OnEquip Player

     If Player.GetIsSex Male == 1

     If GetIsID MiddlePants02Female == 1

	Player.UnEquipItem MiddlePants02Female

      ;message box this is grils clothing i'm not wearing this

EndIf

End

on script 3 i'm also having these errors see pic below

scripterrors.jpg

Link to comment
Share on other sites

OK, is the script attached to each of the objects?? If not you need to make it a quest script. Do you want the messages to be displayed when your inventory is open??

yes the script is run by the objects that use it the script was also set up as a object script as far as the messages i just want them to be displayed or if it helps to cut out the message all together that's alright to

Edited by Darthkenobi
Link to comment
Share on other sites

script 1

 scriptName femalonly




begin OnEquip Player


if Player.GetIsSex Male == 1

	elseif GetIsID Middlepants02female == 1

	Player.UnequipItem Middlepants02female

	MessageBox "This is girl's clothing i'm not wearing this."

elseif GetIsID Middlepants01female == 1

	Player.UnequipItem Middlepants01female

	MessageBox "This is girl's clothing i'm not wearing this."

elseif GetIsID Middleshirt01female == 1

	Player.UnequipItem Middleshirt01female

	MessageBox "This is girl's clothing i'm not wearing this."

elseif GetIsID Middleshirt02female == 1

	Player.UnequipItem Middleshirt02female

	MessageBox "This is girl's clothing i'm not wearing this."

elseif GetIsID UpperPants01female == 1

	Player.UnequipItem UpperPants01female

	MessageBox "This is girl's clothing i'm not wearing this."

elseif GetIsID UpperShirt02female == 1

	Player.UnequipItem UpperShirt02female

	MessageBox "This is girl's clothing i'm not wearing this."

endif

End
script 2
SCN AAFemaleOnlyCloths


Begin OnEquip Player

     If Player.GetIsSex Male == 1

          If Player.GetEquipped MiddlePants01female == 1 || Player.GetEquipped Middlepants02female == 1 || Player.GetEquipped MiddleShirt01female == 1

               ;message box

               ;Unequip all the possible items

     EndIf

End
script 3
SCN FemaleOnlyCloths


Begin OnEquip Player

     If Player.GetIsSex Male == 1

     If GetIsID MiddlePants02Female == 1

	Player.UnEquipItem MiddlePants02Female

      ;message box this is grils clothing i'm not wearing this

EndIf

End
on script 3 i'm also having these errors see pic below scripterrors.jpg
OK, is the script attached to each of the objects?? If not you need to make it a quest script. Do you want the messages to be displayed when your inventory is open??
For script three, try this; script 3
SCN FemaleOnlyCloths


Begin OnEquip Player


If Player.GetIsSex Male == 1

     If GetIsID MiddlePants02Female == 1

	Player.UnEquipItem MiddlePants02Female

      ;message box this is grils clothing i'm not wearing this

     Endif

EndIf


End

End

But there are better ways of writing it, as you have above.

Link to comment
Share on other sites

For script three, try this;

script 3

SCN FemaleOnlyCloths


Begin OnEquip Player


If Player.GetIsSex Male == 1

     If GetIsID MiddlePants02Female == 1

	Player.UnEquipItem MiddlePants02Female

      ;message box this is grils clothing i'm not wearing this

     Endif

EndIf


End

End

But there are better ways of writing it, as you have above.

i tried that and this is what i got i did however remove one of the endif and end lines

scripterror2.jpg

onfortuneitly i still don't really understand script i do plan on learning scripting but the fact that i made the first script even compile is pretty much on sheer luck alone

Edited by Darthkenobi
Link to comment
Share on other sites

i tried that and this is what i got i did however remove one of the endif and end lines

scripterror2.jpg

onfortuneitly i still don't really understand script i do plan on learning scripting but the fact that i made the first script even compile is pretty much on sheer luck alone

Before I try fixing script 3, do you actually need it?? :P

Are you just going to use the one script?? If so use 2 or 3, depending on your preference.

EDIT:

This one compiles;

SCN DELETETHISSCRIPT



Begin OnEquip Player


If Player.GetIsSex Male == 1

     If GetIsID MiddlePants02Female == 1

        Player.UnEquipItem MiddlePants02Female 1

      ;message box this is grils clothing i'm not wearing this

     Endif

EndIf


End

Edited by AliTheLord
Link to comment
Share on other sites

Looks like you have an extra "End" for a non existent block.

SCN FemaleOnlyCloths


Begin OnEquip Player


	If Player.GetIsSex Male == 1


		If GetIsID MiddlePants02Female == 1

			Player.UnEquipItem MiddlePants02Female

			messagebox "This is girls' clothing! I'm not wearing this!"

		Endif

	EndIf


End


Link to comment
Share on other sites

i tried that and this is what i got i did however remove one of the endif and end lines

scripterror2.jpg

onfortuneitly i still don't really understand script i do plan on learning scripting but the fact that i made the first script even compile is pretty much on sheer luck alone

Too many Ends there on script three. Delete one of the Ends.

I've never been able to get multiple If's to work like what you have. Just for testing-sake, try adding the If's together and deteling the extra Endif, like:


SCN FemaleOnlyCloths 


Begin OnEquip Player 


  If Player.GetIsSex Male == 1 && If GetIsID MiddlePants02Female == 1 

       Player.UnEquipItem MiddlePants02Female 

      ;message box this is grils clothing i'm not wearing this 

  Endif 


End


You may have to put parentheses in the If statement.

Edited by lonewolf_kai
Link to comment
Share on other sites

Your first script is still wrong. Windmill pointed out the error, but you must not have understood what he was saying.

begin OnEquip Player
if Player.GetIsSex Male == 1
elseif GetIsID Middlepants02female == 1
Player.UnequipItem Middlepants02female
MessageBox "This is girl's clothing i'm not wearing this."
elseif GetIsID Middlepants01female == 1
Player.UnequipItem Middlepants01female
MessageBox "This is girl's clothing i'm not wearing this."[/code] Your script ignores male players and only checks when your a female player. You need to have an "IF' after the first 'IF'.
[code]begin OnEquip Player
if Player.GetIsSex Male == 1
if GetIsID Middlepants02female == 1
Player.UnequipItem Middlepants02female
MessageBox "This is girl's clothing i'm not wearing this."
elseif GetIsID Middlepants01female == 1
Player.UnequipItem Middlepants01female
MessageBox "This is girl's clothing i'm not wearing this."

Link to comment
Share on other sites

Before I try fixing script 3, do you actually need it?? :P

Are you just going to use the one script?? If so use 2 or 3, depending on your preference.

EDIT:

This one compiles;

SCN DELETETHISSCRIPT



Begin OnEquip Player


If Player.GetIsSex Male == 1

     If GetIsID MiddlePants02Female == 1

        Player.UnEquipItem MiddlePants02Female 1

      ;message box this is grils clothing i'm not wearing this

     Endif

EndIf


End

that script works somewhat however it seems that the cs is and the game are refuseing to change the name of the clothing and for those who do ask yes i did make a new forum and change the name of the clothing however while it shows the name i asigned it in the cs it shows what it used to be in the game and also it seem to berining the scipt on the clothing from the first line of my script however it refuses to run on the second clothing in the script and refuses to run the message box on both
Your first script is still wrong. Windmill pointed out the error, but you must not have understood what he was saying.
begin OnEquip Player

if Player.GetIsSex Male == 1

elseif GetIsID Middlepants02female == 1

        Player.UnequipItem Middlepants02female

        MessageBox "This is girl's clothing i'm not wearing this."

elseif GetIsID Middlepants01female == 1

        Player.UnequipItem Middlepants01female

        MessageBox "This is girl's clothing i'm not wearing this."
Your script ignores male players and only checks when your a female player. You need to have an "IF' after the first 'IF'.
begin OnEquip Player

if Player.GetIsSex Male == 1

        if GetIsID Middlepants02female == 1

                Player.UnequipItem Middlepants02female

                MessageBox "This is girl's clothing i'm not wearing this."

        elseif GetIsID Middlepants01female == 1

                Player.UnequipItem Middlepants01female

                MessageBox "This is girl's clothing i'm not wearing this."
thanks also willie i'm definetly after graduating basics going to be taking your class on scripting to show you what my script now is this code segment should help you see what i've done to it
SCN femaleonlyscript2



Begin OnEquip Player


If Player.GetIsSex Male == 1

     If GetIsID MiddlePants02Female == 1

        Player.UnEquipItem MiddlePants02Female 1

      	;message box "this is girls clothing i'm not wearing this"

     elseIf GetIsID MiddlePants01Female == 1

        Player.UnEquipItem MiddlePants01Female 1

      	;message box "this is girls clothing i'm not wearing this"

			Endif

EndIf


End

also for some strange reason i have this reoucoring thought in the back of my mind that this should be called the script of frankenstein

Edited by Darthkenobi
Link to comment
Share on other sites

Looks like you have an extra "End" for a non existent block.

SCN FemaleOnlyCloths


Begin OnEquip Player


	If Player.GetIsSex Male == 1


		If GetIsID MiddlePants02Female == 1

			Player.UnEquipItem MiddlePants02Female

			messagebox "This is girls' clothing! I'm not wearing this!"

		Endif

	EndIf


End


if i remove any of the endif staments on line 13 or 14 it automtaicly says there is a problem with no matching begin statement and then says there is a problem with line 6 see code segment in the post before this one

Edited by Darthkenobi
Link to comment
Share on other sites

Your message box is "commented out". The semi-colon ";" is Oblivion scripting's comment mark meaning that everything on that line after the ; is ignored. It's a useful feature for adding notes to your script that get ignored by the script compiler. Otherwise the script as you have it now looks good. :yes:

If it's not removing the clothing I'd say either you have the ID wrong (does it match what you changed your new Form's ID too?), or your not testing from a clean save. If your changing the name in the CS and it's not showing up ingame that may be the most likely. Whenever testing a mod you need to do it from a save made BEFORE your mod was activated, otherwise old data from your save may overwrite the changes you make in the CS.

WT

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...