Drasler Posted December 7, 2009 Share Posted December 7, 2009 For all you script experts out there. Here's quick script I wrote that will carry out when a player picks recieves a mudcrab egg (custom ingredient). Basically I wanted to see if there might be a way to simplify this script that I am overlooking, or if it will even work at all. scn gotegg short eggsshort questshort doonce Begin OnAdd player ;begins when egg is added to inventory set doonce to 0 ;to make sure this will run only once set quest to GetQuestStage JM01 ;sets quest to the current quest stage If quest == 20 ;run this if you are on stage 20 of JM01 set eggs to Player.GetItemCount "JMMudCrabEggs" ;sets eggs to inventory count If eggs == 1 ;first egg picked up MessageBox "I found a mudcrab egg. I should continue searching for more" set doonce to 1 EndIf If eggs >= 20 ;after collecting 20 or more eggs SetStage JM01 30 ;advances the quest MessageBox "I have enough eggs. I should return." set doonce to 1 EndIf EndIf End Thanks in advance. Link to comment Share on other sites More sharing options...
Vagrant0 Posted December 7, 2009 Share Posted December 7, 2009 Instead of attaching a script to the items, you are normally always better off performing this check by means of a quest script. Scripts on inventory items can occasionally cause problems and savegame bloat. Within a quest script, the whole process can be simplified. begin gamemode if getstage <quest> == 20 && player.getitemcount <eggID> >= 1 setstage <quest> 25;; journal entry telling them to get more elseif getstage <quest> == 25 && player.getitemcount <eggID> >= 20 setstage <quest> 30;; journal entry saying they have enough eggs endif end For linear quests that aren't repeated, queststages are usually the best way to go. Messages and item scripts only make sense if you intend to have portions of that quest repeatable, and even then you are best off using a quest script or single token item to handle the scripting instead of the item to be gathered. Link to comment Share on other sites More sharing options...
Drasler Posted December 7, 2009 Author Share Posted December 7, 2009 :thumbsup: Thank you. I had a feeling there was a better way to do this. Link to comment Share on other sites More sharing options...
Recommended Posts