AmeaAya Posted October 19, 2009 Share Posted October 19, 2009 The most difficult part about getting hep on this, that that I can't post the exact script due to it being on a computer that has no internet access. However here's what it, down to the basics: Begin OnActivate if Player.GetIsSexFemale == 2 if Player.GetItemCount {Item1} >= 30 Player.AddSpellNS {spell} Player.RemoveItem {Item1} 30 Return elseif Player.GetItemCount {Item2} >= 20 Player.AddSpellNS {another spell} Player.RemoveItem {Item2} 20 Return else MessageBox "You have no items!" Return endif else MessageBox "No boys allowed!" endifend That's it in it's simplest form. Don't ask why I check for gender, it's just an example.Anyways I'm somewhat new at this, so it's probably just a quirk I have yet to know about. Oh, and, in the *real* script there a bunch more item check. They're all the same at those two, however.They total 6 different checks on the real script. And what's the problem? It breaks.At first it would accept all the items if you had them all, but then activating it without them would make it stop working. Now I messed around a bit (Added the "No items" warning and return) and it won't work even if you have the items. Thanks in advance for any assistance! EDIT: Bad, the spaces before the lines went away. That makes it slightly harder to read. Hopefully it's not a problem though. I also neglected to mention something: There's a messagebox when a spell is added (or, rather, just before it is) Link to comment Share on other sites More sharing options...
DagonTheranis Posted October 19, 2009 Share Posted October 19, 2009 You don't appear to have a reference for the "endif" commands. Link to comment Share on other sites More sharing options...
AmeaAya Posted October 19, 2009 Author Share Posted October 19, 2009 You don't appear to have a reference for the "endif" commands. Sorry, I'm not sure what you mean. Both of the endifs have an if with them (one having an if with many elseifs and a else) Link to comment Share on other sites More sharing options...
stars2heaven Posted October 19, 2009 Share Posted October 19, 2009 The only thing that I found wrong was if Player.GetIsSexFemale == 2 should be if Player.GetIsSex Female == 2 sorry I cant offer more than that, heh Link to comment Share on other sites More sharing options...
DagonTheranis Posted October 19, 2009 Share Posted October 19, 2009 You don't appear to have a reference for the "endif" commands. Sorry, I'm not sure what you mean. Both of the endifs have an if with them (one having an if with many elseifs and a else) Shouldn't there be a condition for it to end? So it should end when something happens. Currently there's nothing to trigger it ending. Link to comment Share on other sites More sharing options...
paladicprince Posted October 20, 2009 Share Posted October 20, 2009 I'm going to suggest that you copy the original script onto a USB Drive or a CD or something so you can paste it for us to see it exactly. Because chances are it's a small syntax error, and without seeing it exactly as it's typed it's a bit hard to help you out. Link to comment Share on other sites More sharing options...
AmeaAya Posted October 20, 2009 Author Share Posted October 20, 2009 I'm going to suggest that you copy the original script onto a USB Drive or a CD or something so you can paste it for us to see it exactly. Because chances are it's a small syntax error, and without seeing it exactly as it's typed it's a bit hard to help you out. Luckly I can post it now do to situation change! Yay! scn DoScurselearn begin OnLoad PlayMagicShaderVisuals effectSoulTrapend begin OnActivate if player.GetIsSex Female == 1 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!" player.PushActorAway player 50 PlaySound WPNSwishLarge return endif else player.GetIsSex Male == 1 message "Wrong gender! Blah!" player.PushActorAway player 50 PlaySound WPNSwishLarge endif end And before you say it: Yes, I AM running OBSE. Also edited out the spell names and proper messages. Shouldn't matter. Link to comment Share on other sites More sharing options...
paladicprince Posted October 20, 2009 Share Posted October 20, 2009 haha making an adult mod are we? At any rate since you edtted those thing it's up to you to check spelling and such. Though here's the first thing I see: player.PushActorAway player 50 How is the player supposed to push himself away from himself? That might be the cause of your problems. Leave the second player as you want the player to be pushed, but change the first one to who he's being pushed away from. But note that the player cannot be pushed away from a door or other object, it has to be an NPC or creature. So if it is a door positioning an NPC somewhere on the other side would work. Currently if you have 30 apples and 50 carrots it would take them both and add the respective spells (I don't know if they're the same spell or different spells.) If they're different spells this works, except it will only show you the... second messagebox I believe because it will over write the first one. If you wanted to choose what to offer you'd need to add a messagebox with the options carrots, apples, etc. Then another messagebox depending on your selection that will remove the appropriate items and give the spell. Doing that however you might change the "You have nothing to offer" message to "You do not have enough of what I require" on the condition that the player selects apples but has less than 30. Also I don't see any particular reason for the returns, but I don't think they hurt anything. More that they just don't do anything. It may or may not make a difference, but I find it good practice to wrap all if conditions in parenthesis. It helps avoid certain syntax errors and seems a bit easier to read. It would look like this: If (Player.GetisSex Female == 1) Other than that PlaySound is the only thing I'm unsure of as I've never used it. But the syntax looks correct as far as I can tell. Link to comment Share on other sites More sharing options...
AmeaAya Posted October 20, 2009 Author Share Posted October 20, 2009 haha making an adult mod are we? At any rate since you edtted those thing it's up to you to check spelling and such. Though here's the first thing I see: player.PushActorAway player 50 How is the player supposed to push himself away from himself? That might be the cause of your problems. Leave the second player as you want the player to be pushed, but change the first one to who he's being pushed away from. But note that the player cannot be pushed away from a door or other object, it has to be an NPC or creature. So if it is a door positioning an NPC somewhere on the other side would work. Currently if you have 30 apples and 50 carrots it would take them both and add the respective spells (I don't know if they're the same spell or different spells.) If they're different spells this works, except it will only show you the... second messagebox I believe because it will over write the first one. If you wanted to choose what to offer you'd need to add a messagebox with the options carrots, apples, etc. Then another messagebox depending on your selection that will remove the appropriate items and give the spell. Doing that however you might change the "You have nothing to offer" message to "You do not have enough of what I require" on the condition that the player selects apples but has less than 30. Also I don't see any particular reason for the returns, but I don't think they hurt anything. More that they just don't do anything. It may or may not make a difference, but I find it good practice to wrap all if conditions in parenthesis. It helps avoid certain syntax errors and seems a bit easier to read. It would look like this: If (Player.GetisSex Female == 1) Other than that PlaySound is the only thing I'm unsure of as I've never used it. But the syntax looks correct as far as I can tell. The push actor away was always there (in the wrong gender bit) and worked fine (shot them up in the sky) since the object is an activator, there's not much other choice. As for the reutnrs, I thought that would make the script stop there and reset. So if you have apples and carrots, it does apples stops, then next time it skips apples and does carrots. Currently it won't do anything no matter what items you have. PS: It's not exactly adult. There's a good reason for the gender check, but I won't get into that. Link to comment Share on other sites More sharing options...
paladicprince Posted October 20, 2009 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 Link to comment Share on other sites More sharing options...
Recommended Posts