@wandering_eye
Glad you found the populate script of use. Let's see what can be done for your additional questions.
Although it is ultimately up to the game developer to craft his game, I'll give you some guidance along the lines you request.
In order to fully implement what you want, you'll need to do the following:
1. populate your levels with the random items.
2. declare a variable by use of a declare variables script.
3. assign a pickup script to each random item.
4. assign a script to determine if the needed items have been gathered.
Let's start with the script that will declare a variable to be used in your levels. The value that is held in this variable should be passed from level to level. For example, if the value of "items" is 4 upon leaving level 2, it will be 4 upon beginning level 3. Here is a sample script to declare a variable:
;Artificial Intelligence Script
;Header
desc = Declare Variables
;Triggers
:state=0:dimvar=items,dimvar=othervariables... (you can declare many variable for use in your
game.)
:state=0:suspend
;End of Script
You might name this script DeclareVariables.fpi then attach it to a trigger zone of dynamic light so that the script activates at the beginning of the level. Variables MUST be declared before any action can be taken on that variable.
Now that we have a variable declared, in this case "items", we can create a script that will be attached to each random item that the player must gather. The script should be assigned to the "Main" of the random entities. You might name this script TakeItem.fpi. Here are a couple examples.
The first is quite simple:
;Artificial Intelligence Script
;Header
desc= Pick up item and increment variable.
;Triggers
:state=0,plrdistwithin=40:addvar=items
1,playertake,coloff,plrsound=audiobank\items\pickup.wav,suspend
;End of Script
The first script simply checks to see if the player is within close proximity to the item. If so, the item is taken and the variable is incremented.
This second script is somewhat more complicated and makes uses of the mouse button (note that you also can use the action key, which is the "ENTER" key, simply by editing the code:
;Artificial Intelligence Script
;Header
desc= Pick up item and increment variable.
;Triggers
:state=0,pickobject=1,plrdistwithin=60,mousestate=1:etimerstart,plrdisable=100000,state=3
:state=3:fpgcrawtextsize=24,fpgcrawtextfont=verdana,fpgcrawtextr=150,fpgcrawtextg=150,fpgcrawtextb=150,fpgcrawtextx=50,fpgcrawtexty=60
:state=3:fpgcrawtext=Press <LEFT> to take item or <RIGHT> to leave it here.
:state=3,etimergreater=500,mousestate=1:state=5
:state=3,mousestate=2:plrdisable=0,state=0
:state=5:playertake,coloff,plrsound=audiobank\items\pickup.wav,plrdisable=0,addvar=items 1,suspend
;End of Script
When using the second script, the player is given a choice whether to pick up an item or not.
Note, however, that if the player carries a weapon, the script must be edited to put away the player weapon and disable its selection until a choice has been made concerning the item. Note further that when using a script such as the second example that the use of a small hand hud or some other hud assists in acquiring the item in the exact center of the screen. The hand hud would be assigned to the center of the screen so that he player can see when he has placed the hand directly over the item.
Okay, now we have a means to pick up items and to add the value of 1 each time an item is acquired. Next, we need to have a script check to see if the required items have been gathered.
You could name this script CheckCount.fpi:
;Artificial Intelligence Script
;Header
desc= Check count.
;Triggers
:state=0,varequal=items 10:state=3
:state=3:(any instructions you want, such as displaying text that the level is complete and to head for the exit.)
;End of Script
Hope all this makes sense and will be of help. You can improve your scripting skills by reading the community guides and script syntax guides that are available. Watch the forums closely. Much can be learned from the responses to others questions. Good luck.
Life is about living.