Ranokoa Posted March 8, 2009 Share Posted March 8, 2009 I am making a mod that haas kept me up for 7 hours to fine tune it, the only thing keeping me from completing this mod is a simple script. I need a script that i can put on a chest that when you activate the chest a message box will appear Messagebox= "Do you wish to buy so and so for 2,000gp", "Pay 2,000 gp", "No thanks." When you click yes you will have player.removeitem gold001 2000 player.additem 'so and so's id here' 1 Very basic, i can generally read and understand scripting to an extent and tweak very tiny scripts but i am no good at writing them. My internet is down so im using my neighbors signal which is low and goes from connected to not connected every minute so i cant take the tutorials as of now. Basically, chest on activate if yes remove gold and add item if no then nothing happens. I dont care if you make it a do once thing for the if yes all i care about is it works. I tried playing around and tweaking with various scripts to get what i want but i just cant seem to get it to work. Will give full recognition in the mods main page and readme, special thanks and all. will read something like Special thanks to "blah" for essential scripting help or something. Thanks for reading and if you help thanks for helping ~Ranokoa Link to comment Share on other sites More sharing options...
LoginToDownload Posted March 9, 2009 Share Posted March 9, 2009 Messagebox menus aren't very intuitive at all, but they're pretty simple once you get the hang of it. Essentially, you need to play the messagebox in OnActivate, record that the player is in said menu, and if they are, find out what button they pressed when they get back to GameMode. scn MyChestScript short choosing ;This variable will be 1 if the player is in the "would you like to buy?" menu, and 0 if not. short choice ;Records what button the player presses Begin OnActivate player if (player.GetItemCount gold001 >= 2000) messagebox "Would you like to buy so-and-so for 2,000 gold?", "Yes", "No" set choosing to 1 else messagebox "So-and-so costs 2,000 gold. You don't have the money to buy it." endif end Begin GameMode if (choosing == 1) set choice to GetButtonPressed ;Choice returns -1 if a button hasn't been pressed, 0 if button 1 has been, 1 if button 2 has been, etc. ;It resets to -1 once called, so we need to store it in a variable instead of checking it repeatedly. if (choice == 0) player.AddItem MySoAndSo 1 player.RemoveItem gold001 2000 set choosing to 0 elseif (choice == 1) set choosing to 0 endif endif end Link to comment Share on other sites More sharing options...
Ranokoa Posted March 9, 2009 Author Share Posted March 9, 2009 Omg thanks so much man i can finally finish my mod! I will put a great special thanks in there, and thank you for the notes inside it makes it easy for me to understand the construct of the script. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.