Unlockables

brixujel
would anyone be able to tell me how to write a code for unlocking certain stuff once you get to a certain point in the game? i know that i have to use
[
<<if:[passage] is true>>
]
but after that point i don't know how to set it up

HegemonKhan
the general concept is to use Attributes for "state flagging", and for a simple example (using an Integer Attribute for this example):

(this is a very stupid-lame and poor example, but I think it explains the concept well)

we've got a teleporter doorway, and depending on your character's level, takes you to different areas of difficulty in the game:

player.level = 0 ----> tutorial area-stage-level
player.level = 1 ----> easiest area-stage-level
player.level = 2 ----> a little harder area-stage-level
etc etc etc

so, the 'teleporter doorway' Object's 'teleport' Verb, would need this (for an example in code --- its quick and easy to do-show you with it):

if (player.level = 0)
{
MoveObject(player, stage0)
}
else if (player.level = 1)
{
MoveObject(player, stage1)
}
// etc etc etc
if (player.level = 99)
{
MoveObject(player, stage99)
}


and, as I've already revealed, we need an attribute which is checked, and which is changed as you progress in the game, which in this case is:

(Object Name: player)
Attribute Name: level
Attribute Type: int (integer)
Attribute (initial) Value: 0 // or 1

and, let's say instead of your 'level' raising through 'experience' gained from killing monsters in the normal leveling up system, it instead raises as you complete missions~tasks~objectives in the game.

so, let's say in the tutorial area, you kill the tutorial boss, upon doing so, your 'level' Attribute gets raised from '0' to '1', which now allows you to use the teleporter doorway to go to the next area of the game.

--------

that's the concept of 'state flagging',

but as to what exactly you want to do, and how you want to implement it, we'll need more communication and information between us, for that, in order to help you with it, we need to know more about what and how you want to do, to give you instructions on setting it up in your game.

TinFoilMkIV
As HK said above, the basic idea is an attribute somewhere you use as a 'flag' that lets the game know when whatever requirements you choose have been met.

You can really store the attribute anywhere as long as it's not on something that could be potentially destroyed or removed from the game during play. Personally I like creating organization objects outside the play area for such things. For example I would make an object called 'controller objects' then inside that another object called 'unlocks', and all my specific unlock flags would belong to the 'unlocks' object so I know exactly where they are at all times and can avoid any complications with unnecessary interactions.

Anyways then you just need the event in question to alter the attribute on the object to the "unlocked" state. For example when the player completes a puzzle, at some point in the code for completing it you say 'unlocks.PuzzleClear = 1' in this case 1 is the value that indicates it was completed. So when you then have something that needs this puzzle cleared to unlock you use 'if (unlocks.PuzzleClear = 1) //do whatever you needed to unlock here'.

So basically you need the "flag" that lets the game know if the requirements were met, then an if statement that looks at this value before the player is allowed to do whatever it is you wanted unlocked.

This topic is now closed. Topics are closed after 60 days of inactivity.

Support

Forums