AmeaAya Posted October 20, 2009 Author Share Posted October 20, 2009 Oh yeah that's true about the returns. I suppose if you want them to have to offer them in that order it works. Hmm... you might try the parenthesis thing... And what exactly did you change that made it not work? Oh and are you loading through OBSE? j/k Well it worked when there was no else at the end, and just a return.However this had the also serious problem of making the entire script stop working if activated while you don't have the items. Parenthesis did nothing. Link to comment Share on other sites More sharing options...
RagnaHighArc Posted October 20, 2009 Share Posted October 20, 2009 This if player.GetIsSex Female == 1 if player.GetItemCount Apple >= 30 Should beif (player.GetIsSex Female == 1) && (player.GetItemCount Apple >= 30) the "&&" means "and". So if female is true, or 1, and itemcount is atleast 30 then the block will run /// The first "endif" in the following code needs to be removed. The "endif" closes the "if" statement. So, the "else player.getissex male" line might not run. endif else player.GetIsSex Male == 1 message "Wrong gender! Blah!" player.PushActorAway player 50 PlaySound WPNSwishLarge endif end Link to comment Share on other sites More sharing options...
paladicprince Posted October 20, 2009 Share Posted October 20, 2009 Well, you are correct ragna, but in this case I'd say the OP did it more correctly. He has several different things to test, but only if the player is a female, so he used nested if's. Which is a lot easier then typing the whole getissex thing 6 times. I thought that at first to so I copied and pasted it into notpad to add normal formatting while I looked it over. And sorr, but at this point I'm out of ideas... Link to comment Share on other sites More sharing options...
RagnaHighArc Posted October 20, 2009 Share Posted October 20, 2009 You could also run this instead at the beginning of the script. if player.GetIsSex Female == 0 message "Wrong gender! Blah!" player.PushActorAway player 50 PlaySound WPNSwishLarge return endif That says "end the script if male" "or continue if not". Link to comment Share on other sites More sharing options...
AmeaAya Posted October 20, 2009 Author Share Posted October 20, 2009 This if player.GetIsSex Female == 1 if player.GetItemCount Apple >= 30 Should beif (player.GetIsSex Female == 1) && (player.GetItemCount Apple >= 30) the "&&" means "and". So if female is true, or 1, and itemcount is atleast 30 then the block will run /// The first "endif" in the following code needs to be removed. The "endif" closes the "if" statement. So, the "else player.getissex male" line might not run. endif else player.GetIsSex Male == 1 message "Wrong gender! Blah!" player.PushActorAway player 50 PlaySound WPNSwishLarge endif end Did both of these, and it does the same. Nothing. It's an activator made from a copied Shrine of Sheogorath, with a Soul Trap effect shader on it. The only other code is a OnLoad to play the shader. It won't activate for a female or a male, with or without items. EDIT: I added a "message "activated" right after the OnActivate, and it appears to work the first time but not ever again. Link to comment Share on other sites More sharing options...
paladicprince Posted October 20, 2009 Share Posted October 20, 2009 I've had that before. It means somewhere there's a syntax error that the CS Compiler doesn't catch. The best bet it to scrutinize your code letter for lettter... Link to comment Share on other sites More sharing options...
RagnaHighArc Posted October 20, 2009 Share Posted October 20, 2009 Can you post the code exactly as you have it right now? BTW this is how i would write the code. Try it and tells us what happens and don't worry about the things i took off. We just wanna test the script. scn DoScurselearn begin OnActivate if player.GetIsSex Male == 0 message "Wrong gender! Blah!" return endif if player.GetItemCount Apple >= 30 MessageBox "Blah" Player.RemoveItem Apple 30 Player.AddSpellNS <spell> return elseif player.GetItemCount Carrot >= 50 MessageBox "Blah" Player.RemoveItem Carrot 50 Player.AddSpellNS <spell> return elseif player.GetItemCount WelkyndStone >= 10 MessageBox "Blah" Player.RemoveItem WelkyndStone 10 Player.AddSpellNS <spell> return elseif Player.GetItemCount Ratmeat >= 30 MessageBox "Blah" Player.RemoveItem Ratmeat 30 Player.AddSpellNS <spell> return elseif Player.GetItemCount IronCuirass >= 5 MessageBox "Blah" Player.RemoveItem IronCuirass 5 Player.AddSpellNS <spell> return elseif Player,GetItemCount DaedraSilk >= 5 MessageBox "Blah" Player.RemoveItem DaedraSilk 5 Player.AddSpellNS <spell> return else MessageBox "You have nothing to offer, Begone!" return endif end Link to comment Share on other sites More sharing options...
AmeaAya Posted October 20, 2009 Author Share Posted October 20, 2009 Okay I moved the check for being male to the top, and that works (over and over) but when a female touches it there's a slightly pause (lag) and then it never works again. Here's the current code: scn DoScurselearn begin OnLoad PlayMagicShaderVisuals effectSoulTrapend begin OnActivate if player.GetIsSex Female == 0 message "Wrong gender" player.PushActorAway player 50 PlaySound WPNSwishLarge return elseif player.GetIsSex Female == 1 && player.GetItemCount Apple >= 30 MessageBox "---" Player.RemoveItem Apple 30 Player.AddSpell --- return elseif player.GetIsSex Female == 1 && player.GetItemCount Carrot >= 50 MessageBox "---" Player.RemoveItem Carrot 50 Player.AddSpell --- return elseif player.GetIsSex Female == 1 && player.GetItemCount WelkyndStone >= 10 MessageBox "---" Player.RemoveItem WelkyndStone 10 Player.AddSpell --- return elseif player.GetIsSex Female == 1 && Player.GetItemCount Ratmeat >= 30 MessageBox "---" Player.RemoveItem Ratmeat 30 Player.AddSpell --- return elseif player.GetIsSex Female == 1 && Player.GetItemCount IronCuirass >= 5 MessageBox "---" Player.RemoveItem IronCuirass 5 Player.AddSpell --- return elseif player.GetIsSex Female == 1 && Player,GetItemCount DaedraSilk >= 5 MessageBox "---" Player.RemoveItem DaedraSilk 5 Player.AddSpell --- return else MessageBox "No items" player.PushActorAway player 50 PlaySound WPNSwishLarge return endif end Edited out the messages and spell names for no real good reaon. I know those aren't the problem anyways. Link to comment Share on other sites More sharing options...
paladicprince Posted October 20, 2009 Share Posted October 20, 2009 Since you checked if it was male first all the getis female checks are a tad redundant... I notice a comma at player,getitemcount daedrasilkI would assume that the compiler would catch that, but maybe it's the problem? Link to comment Share on other sites More sharing options...
AmeaAya Posted October 20, 2009 Author Share Posted October 20, 2009 I notice a comma at player,getitemcount daedrasilkI would assume that the compiler would catch that, but maybe it's the problem? ... ... GUHACK BLAH UGH.... SON OF A ... GALHDSAHRJ TJQEHTEQIHT:ODIHG:IB Goddamn. I'm seriously nearly in tears. It works now. Thanks everyone. Link to comment Share on other sites More sharing options...
Recommended Posts