viking99 Posted January 31, 2011 Share Posted January 31, 2011 Hi I want to make a collection script to update a quest after I find a certain number of an item. I have used the function getItemCount on quest items with a script attatched to them. In this case however I will use generic non quest items. I cannot attached the script to a certain trigger zone since there are many ways for the player to attain these items. I am thinking a script that only runs when the player picks up an item and then checks for a certain generic item to update the quest. Is that possible and how would I make the script and the trigger? Viking99 Link to comment Share on other sites More sharing options...
evertaile Posted January 31, 2011 Share Posted January 31, 2011 (edited) Hi I want to make a collection script to update a quest after I find a certain number of an item. I have used the function getItemCount on quest items with a script attatched to them. In this case however I will use generic non quest items. I cannot attached the script to a certain trigger zone since there are many ways for the player to attain these items. I am thinking a script that only runs when the player picks up an item and then checks for a certain generic item to update the quest. Is that possible and how would I make the script and the trigger? Viking99 Create a separate quest that is start game enabled and give it a script with no begin block and that only states the variables you want. ie. SCN aaGetStuff Short GotStuff01Short GotStuff02 name the quest something similar, ie. aaGetStuffQ Then using a stage result script block from the collection quest you want these items for (YOURQUEST) use the GetQuestVariable function in combination with GetItemCount. Example: If player.GetItemCount SurgicalTubing == 1set aaGetSTuffQ.GotStuff01 to 1elsereturnendif Or if you want multiples of the same item: If player.GetItemCount SurgicalTubing == 1set aaGetSTuffQ.GotStuff01 to 1elseIf player.GetItemCount SurgicalTubing == 2set aaGetSTuffQ.GotStuff01 to 2elseIf player.GetItemCount SurgicalTubing == 3set aaGetSTuffQ.GotStuff01 to 3elsereturnendif or the above can be condensed to only check if the player has a certain number of items: If player.GetItemCount SurgicalTubing == 3set aaGetSTuffQ.GotStuff01 to 1elsereturnendif {---- or, don't know if this works: If player.GetItemCount SurgicalTubing 1 > 1set aaGetSTuffQ.GotStuff01 to (aaGetStuffQ.GotStuff01 + 1)elsereturnendif ----} or if you want the player to collect a single occurence of various items, create a GotStuff for every item you want the player to get, and in the result script set it out to: If player.GetItemCount SurgicalTubing == 1set aaGetStuffQ.GotStuff01 to 1elseif player.GetItemCount SurgicalScissors == 1set aaGetStuffQ.GotStuff02 to 1elsereturnendif Then also set out how many you need to progress: If aaGetStuffQ.GotStuff01 == 3SetStage YOURQUEST 30elsereturnendif or if you had multiple varied items that needed collecting: if aaGetStuffQ.GotSTuff01 == 1 && aaGetStuffQ.GotStuff02 == 1SetStage YOURQUEST 30elsereturnendif Edited January 31, 2011 by evertaile Link to comment Share on other sites More sharing options...
viking99 Posted January 31, 2011 Author Share Posted January 31, 2011 Thanks for the quick reply i´ll try it out. Link to comment Share on other sites More sharing options...
evertaile Posted January 31, 2011 Share Posted January 31, 2011 How did you get on? Link to comment Share on other sites More sharing options...
viking99 Posted February 1, 2011 Author Share Posted February 1, 2011 I haven´t had time yet but I´ll defininitely keep you posted thanks again. Link to comment Share on other sites More sharing options...
evertaile Posted February 1, 2011 Share Posted February 1, 2011 I use the same technique for counting the deaths of creatures. I create a script which updates the count for each death then a cerain number of logged deaths will stage up the quest. I also use it for counting dialogue topics and the like. Link to comment Share on other sites More sharing options...
viking99 Posted February 3, 2011 Author Share Posted February 3, 2011 Hi evertaile I have tried the script but can´t make it work. Maybe you could see what I have missed. I have checked the scripts in Cipscis script validator and can´t find any obvious mistakes but maybe I have missed something. I have made a small quest named HMGetStuff set it to start game enabled priority 50 and no special conditions. I have attached a questscript called HMGetStuffSCRIPT.The script looks like this: SCN HMGetstuffSCRIPT Short GotCoyoteHideShort GotGoldenGeckoSKinShort GotAntMeat I have chosen that my quest ( HMQ1) should update after getting 2 coyote hides. I plan to add the other variables as well when I can make it work. Guest stages: 10 Talk to Quest giver20 collect 2 coyote hides30 return to quest giver. I did test the quest with a quest item with a script attach to it and it worked fine, so the problem must be somwhere with the collection script or trigger. Under quest stage 30 i have used the following script: If player.GetItemCount NVCoyoteHide == 1set HMGetStuff.GotCoyoteHide to 1elseIf player.GetItemCount NVCoyoteHide == 2set HMGetStuff.GotCoyoteHide to 2elsereturnendif If HMGetstuff.GotCoyoteHide == 2 SetObjectiveCompleted HMQ1 20 1SetObjectiveDisplayed HMQ1 30 1SetStage HMQ1 30AddTopic HMQ1Return elsereturnendif Can you see what I have missed? Link to comment Share on other sites More sharing options...
evertaile Posted February 3, 2011 Share Posted February 3, 2011 (edited) This should be the result script for stage 20, not 30 - if collecting the hide is the prerequisite to stage up from 20 to 30 as this script will only run during the stage it is needed for when implemented as a stage result script. Also, unless you want something different to occur each time the player collects 1 coyote hide, you can optimize the if block to If player.GetItemCount NVCoyoteHide == 2SetObjectiveCompleted HMQ1 20 1SetObjectiveDisplayed HMQ1 30 1SetStage HMQ1 30AddTopic HMQ1Returnelsereturnendif If you are wanting to collect 2 hides and 1 medical brace for example, then this... If player.GetItemCount NVCoyoteHide == 2 && player.getItemCount medicalbrace == 1SetObjectiveCompleted HMQ1 20 1SetObjectiveDisplayed HMQ1 30 1SetStage HMQ1 30AddTopic HMQ1Returnelsereturnendif ...would also suffice. However, if you wanted to make it more complex, ie. setting up preperations for lead into multiple quests etc. or quest paths, then still under stage 20 you would use the quest variables. -- You don't need the extra quest variables at all if this all you wanted to do with collection. You would only need to implement the extra quest variables if this was a recurring collection quest with different outcomes per number of items. Also, if you only wanted the player to collect 2 Coyote hides, then setting the variable to 2 is pointless. Simply stating that 2 hides is the quest variable at 1 is enough. Edited February 3, 2011 by evertaile Link to comment Share on other sites More sharing options...
viking99 Posted February 5, 2011 Author Share Posted February 5, 2011 I have added the script to stage 20 which makes perfect sense but I still can´t trigger it. I have a problem undestanding what actually triggers the script and how it works. The variables are defined in the quest HMGestuff. I have added a questscript, made it start game enabled, set priority to 50, but not added anything else. The questscript defining the variables: SCN HMGetstuffSCRIPT Short GotCoyoteHideShort GotGeckoGoldenHideShort GotAntMeat Then in HMQ1 stage 20 I have added the following stage result script: If player.GetItemCount NVCoyoteHide == 2 && player.getItemCount GeckoGoldenHide == 2 SetObjectiveCompleted HMQ1 20 1SetObjectiveDisplayed HMQ1 30 1SetStage HMQ1 30AddTopic HMQ1Return elsereturnendif I also tried the following: If player.GetItemCount NVCoyoteHide == 2 && player.getItemCount GeckoGoldenHide == 2 If HMGetstuff.GotCoyoteHide == 2If HMGetstuff.GotGeckoGoldenHide == 2 SetObjectiveCompleted HMQ1 20 1SetObjectiveDisplayed HMQ1 30 1SetStage HMQ1 30AddTopic HMQ1Return elsereturnendifendifendif Do I have to refer to the Getstuff / variable script?How does the game se the connection between the defined variable and the actual ref id if it is not stated int the Geststuff quest. Link to comment Share on other sites More sharing options...
davidlallen Posted February 5, 2011 Share Posted February 5, 2011 It makes your script easier to read if you use [ code ] tags, otherwise the indentation is lost. If I read this correctly, you are checking to see if the player has enough items in the *result* script for stage 20. This will not work. The result script is executed once the stage is completed, so you cannot check for completion here. Is there any place where you are executing "setstage HMQ1 20"? The way most collection scripts work is to add a script to the items being collected with a "begin onadd" block. Trace out the egg collection script that Ruby has, and focus on the item scripts. Link to comment Share on other sites More sharing options...
Recommended Posts