So I am doing a treasure hunter game, you can raid ruins and such.
I want to implement treasure map pieces.
when you have 4 pieces either you can take the 4 pieces to an npc, who will take the 4 pieces and give you a random map, depending on a chance pre-set by myself.
Not sure if there is anything out there can do this already?
or if you need more information on I will try explain better 🙂
Checking the inventory for an item of a certain name or id is one line of code, checking the quantity can also be on the same line.
Determine how you want the items to be carried, then check the inventory, and contain the reward maps for an area in a hash table or array.
map_rewards = [id1, id2, id3, id4], then use: [SIZE=13.63636302948px]map_rewards [/SIZE]= rewards[rand(rewards.size)] to get the id of the reward for the map.
To make it easier to scale you can include another variable for a reward tree id, to check an area's item ids inside of an array of arrays.
#reward_id => [item_id,item_id]
area_rewards = {
0 => [id1,id2,id3],
1 => [id1,id2,id3,id4,id5]
}
[SIZE=13.63636302948px]area_rewards[/SIZE][reward_id][rand([SIZE=13.63636302948px]area_rewards [/SIZE][[SIZE=13.63636302948px]reward_id[/SIZE]].size)]
If this didn't help, you need to provide more information.
If you want no script involved you can make key items, like map pieces if there will be not many, but I guess that's not the case.
So you can use non consumable normal items that do nothing but exist in the inventory (to stack a lot).
Then you can event an NPC to check if your pieces are more than 4. If yes he can ask the user to give him 4 to take a random map.
YES/NO, on YES you remove 4 pieces and add a map.
Now what do you mean by map? Do you mean an item that might send you on a certain game map?
If so, you can make the item call a common event that will teleport you randomly somewhere.
Scripting is not essential here BUT it would make your life pretty more neat and easy.
Event Commands have everything you might need to do what you wanna do.
Of course as the maps become more and more, you have to add stuff to the event or script or at least slightly modify it.
I suggest you make all the maps first THEN create the Random Map item Event.
Cheers.
Since it's just a give NPC 4 of the item and he will give a random item to you in return, this is easily eventable...