CharlieChainsaw Posted April 17, 2009 Share Posted April 17, 2009 i working on a script for an ingestible and had a look at several tutorials and topics with the same problem but my script wont work.i have made an ingestible which opens a menu when used and the player can make different choices which should add or remove a token to/from the player inventory, but this wont happen, only the menu pops up.can someone please have a look at my script and try to help me the scriptscn EDeffectSCRIPT short go short Button begin ScriptEffectStart showmessage EDmenu1 player.additem EDitem 1 set go to 1 END Begin Gamemode if go == 1 set Button to GetButtonPressed set go to 0 if Button == 0 player.removeitem tokenmale 10 player.removeitem tokenfemale 10 elseif Button == 1 player.removeitem tokenfemale 1 player.additem tokenmale 1 elseif Button == 2 player.removeitem tokenmale 1 player.additem tokenfemale 1 endif endif END thanking you in anticipation Link to comment Share on other sites More sharing options...
Interfer0 Posted April 17, 2009 Share Posted April 17, 2009 I believe this is a known bug with additem and remove item in effect scripts. http://geck.bethsoft.com/index.php/AddItem I could be wrong though. I read something the other day about it, but can't seem to find it anymore. That link shows a workaround. Link to comment Share on other sites More sharing options...
Cipscis Posted April 17, 2009 Share Posted April 17, 2009 That bug in AddItem shouldn't affect the player, and I don't think it's relevant here anyway. The problem is that you're only using GetButtonPressed for only one frame - the player cannot possible press a button in the same frame as the menu appears. You also shouldn't really be using a GameMode block in an effect script. In fact, script effects shouldn't be used for menus - the blocktypes available to them just aren't suitable. Instead, you should add a token to the player's inventory that has an object effect for your menu script. Use OnAdd and GameMode blocks, like this:ScriptName EDeffectSCRIPT int iButton Begin OnAdd ShowMessage EDmenu1 player.AddItem Editem 1 End Begin GameMode set iButton to GetButtonPressed if iButton == -1 Return elseif iButton == 0 player.RemoveItem tokenmale 10 player.RemoveItem tokenfemale 10 elseif iButton == 1 player.RemoveItem tokenfemale 1 player.AddItem tokenmale 1 elseif iButton == 2 player.RemoveItem tokenmale 1 player.AddItem tokenfemale 1 endif RemoveMe End Cipscis Link to comment Share on other sites More sharing options...
CharlieChainsaw Posted April 18, 2009 Author Share Posted April 18, 2009 thank you for your helpnow it is working Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.