|Creating Links based on values in Nested Datamaps and Arrays
|Page 1 of 1|
|Author:||ruskle [ Fri Sep 29, 2017 1:00 pm ]|
|Post subject:||Creating Links based on values in Nested Datamaps and Arrays|
I'm setting up a fight system in my game. There is the potential for a lot fighting within the premise of the game, so, rather than having a set of passages for each potential fight sequence, I thought it would be better to have a single set of passages that could be accessed from anywhere in the game.
The set of passages will be;
Fight Init - where any fight-specific variables are set and calculations made.
Fight Screen - where the actual fighting will take place.
Spoils - where the user will collect gold, items, etc.
and a link to the Game Over passage.
The actual fighting-part works fine, and the links to the 'game-over' and 'spoils' passages work fine, and I believe i can use a combination of arrays and datamaps to allow me to change the variables going into the fight. But what i am struggling with is the spoils screen itself.
Each enemy will have a random amount of gold and possibly weapons, armour or items. These will be preset in a datamap within an array, e.g.
(set: $enemy01 to (datamap: "Name", 'A Slaver', "Gold", 10, "Strength", 4, "Item01", $item01, "Item02", 'n/a'))
The items and weapons will also be datamaps, e.g.
(set: $item01 to (datamap: "Name", 'Small Health Potion', "Ability", 'HP + 25', "Qty", 0, "Value", 25))
What i want the spoils screen to do is recognise that the enemy is carrying items and display the items with options to 'take'-(update the user inventory) or 'leave'. So, if enemy01 was defeated, the spoils screen would show that they were carrying $item01 and would have a link to allow the user to + 1 to the Item01 'Qty' in their inventory.
|Page 1 of 1||All times are UTC - 6 hours [ DST ]|
|Powered by phpBB® Forum Software © phpBB Group