 |

 How to create an item?
In the editor, create a dynamic object with the desired tile, set an unique id and the class property to item.
Don't forget to set a name for it in the script.
The default template behaviour will automatically let you pick it up and drop it down.
For more info, read the Items Objects chapter from the DizzyAGE book.
 How to name an item?
You must name the items you can pick in the game, so they will be correctly displayed in the inventory.
Set the item's name in the game.gs file,
in the ObjectsSetNames() function.
Use the ObjSetName() function to set an item's name.
During the game, you can modify items names any time.
For the items you change names during the game, you must add code in
the LoadUserData() callback and set their correct
names, depending on the status of the associated puzzle. That's because the
load game feature doesn't store items names.
For more info, read the Items Objects chapter from the DizzyAGE book.
 How to make an item appear or dissapear?
To make an item appear, it should be placed as disabled, from the editor.
When the associated puzzle is solved, like when someone must give this item to you,
enable it by setting it's O_DISABLE property to 0.
To make an item dissapear set it's disable property to 1.
For more info, read the Items Objects chapter from the DizzyAGE book.
 How to refuse picking or dropping an item?
To do so, use the PickupObject_ID() and the DropObject_ID()
callbacks for your item.
In these callbacks, you can reffuse picking or dropping the item, by doing nothing.
You can still pick or drop the item, by using DoPickupObject() and the DoDropObject()
functions, with it's index.
More info in the Reference chapters from the DizzyAGE book.
 How to have a weight limit in the inventory?
The inventory has a limit of MAXINVENTORY items, that you can carry at the same time.
You can extend this behaviour by having a weight value for each item, stored in one of their user properties.
You will have to modify the behaviour of the DoPickupObject() function from
action.gs file to support this.
Basically, if the weight of item you must pick, added to the sum of weights of the items currently in the
inventory, exceeds a certain value then you must reffuse the item and display a text message.
If you only need to deal with the weight of one or two objects you can use their pick and drop callbacks
to refuse picking them under certain conditions.
 How to set the number of coins?
Set the default number of coins in the gamedef.gs file,
by changing the MAXCOINS define.
This number is only used when you collect a coin, to say if it's the last one to find.
Usually, you should match it with the number of coin class objects placed from the map editor.
However, scripted puzzles can grow or decrease the number of coins as they like.
This number is stored in the players P_COINS property.
 How to change the name of coins?
Since the collectable coins can be cherries or diamonds in your game, you may want to change
the message displayed when you pick one.
This message is in the action.gs file, in the DoPickupObject() function.
|
 |