Jump to content

trigger for a collection script.


viking99

Recommended Posts

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

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 GotStuff01

Short 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 == 1

set aaGetSTuffQ.GotStuff01 to 1

else

return

endif

 

Or if you want multiples of the same item:

 

If player.GetItemCount SurgicalTubing == 1

set aaGetSTuffQ.GotStuff01 to 1

elseIf player.GetItemCount SurgicalTubing == 2

set aaGetSTuffQ.GotStuff01 to 2

elseIf player.GetItemCount SurgicalTubing == 3

set aaGetSTuffQ.GotStuff01 to 3

else

return

endif

 

or the above can be condensed to only check if the player has a certain number of items:

 

If player.GetItemCount SurgicalTubing == 3

set aaGetSTuffQ.GotStuff01 to 1

else

return

endif

 

{---- or, don't know if this works:

 

If player.GetItemCount SurgicalTubing 1 > 1

set aaGetSTuffQ.GotStuff01 to (aaGetStuffQ.GotStuff01 + 1)

else

return

endif ----}

 

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 == 1

set aaGetStuffQ.GotStuff01 to 1

elseif player.GetItemCount SurgicalScissors == 1

set aaGetStuffQ.GotStuff02 to 1

else

return

endif

 

Then also set out how many you need to progress:

 

If aaGetStuffQ.GotStuff01 == 3

SetStage YOURQUEST 30

else

return

endif

 

or if you had multiple varied items that needed collecting:

 

if aaGetStuffQ.GotSTuff01 == 1 && aaGetStuffQ.GotStuff02 == 1

SetStage YOURQUEST 30

else

return

endif

Edited by evertaile
Link to comment
Share on other sites

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

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 GotCoyoteHide

Short GotGoldenGeckoSKin

Short 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 giver

20 collect 2 coyote hides

30 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 == 1

set HMGetStuff.GotCoyoteHide to 1

elseIf player.GetItemCount NVCoyoteHide == 2

set HMGetStuff.GotCoyoteHide to 2

else

return

endif

 

If HMGetstuff.GotCoyoteHide == 2

 

SetObjectiveCompleted HMQ1 20 1

SetObjectiveDisplayed HMQ1 30 1

SetStage HMQ1 30

AddTopic HMQ1Return

 

else

return

endif

 

Can you see what I have missed?

Link to comment
Share on other sites

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 == 2

SetObjectiveCompleted HMQ1 20 1

SetObjectiveDisplayed HMQ1 30 1

SetStage HMQ1 30

AddTopic HMQ1Return

else

return

endif

 

If you are wanting to collect 2 hides and 1 medical brace for example, then this...

 

If player.GetItemCount NVCoyoteHide == 2 && player.getItemCount medicalbrace == 1

SetObjectiveCompleted HMQ1 20 1

SetObjectiveDisplayed HMQ1 30 1

SetStage HMQ1 30

AddTopic HMQ1Return

else

return

endif

 

...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 by evertaile
Link to comment
Share on other sites

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 GotCoyoteHide

Short GotGeckoGoldenHide

Short 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 1

SetObjectiveDisplayed HMQ1 30 1

SetStage HMQ1 30

AddTopic HMQ1Return

 

else

return

endif

 

I also tried the following:

 

If player.GetItemCount NVCoyoteHide == 2 && player.getItemCount GeckoGoldenHide == 2

 

If HMGetstuff.GotCoyoteHide == 2

If HMGetstuff.GotGeckoGoldenHide == 2

 

SetObjectiveCompleted HMQ1 20 1

SetObjectiveDisplayed HMQ1 30 1

SetStage HMQ1 30

AddTopic HMQ1Return

 

else

return

endif

endif

endif

 

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

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

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...