Hi,I haven't started implementing my game with AGS yet, but I'm just checking out the available solutions. In my game, I'll need to store a couple more attributes [propeties] about the characters/objects/hotspots/inv items etc. Basically, what I need to know is this:
In AGS is it possible to extend the attributes of an object? ie, on this page in the manual[1], it lists all available properties. Would it be possible to add my own properties to the character type?
If not, is it possible to make a new inherited type, which the game will handle?
Cheers.
AGS supports "properties", which are read-only boolean, integer, or string values associated with game entities. You can create and change them using the "Properties" button in the editor. Properties are shared across all game entities (e.g., both rooms and characters can have the property "room label" even though it only applies to rooms).
In the script, these are accessed using entityName.GetProperty("bool/int property name") and entityName.GetPropertyText("string property name", stringToPutItIn).
Yes, these custom properties cannot be changed at runtime at the moment (tracker (http://www.adventuregamestudio.co.uk/tracker.php?action=detail&id=191)).
As for adding properties to built-in types (character, objects, etc.):
Quote from: Pumaman on Mon 28/02/2005 19:47:30
You cannot extend built-in types, no. This is a possibility for a future version.
Depending on what you want to do exactly, you could use a combination of structs and arrays:
// script header
struct MyCharacterStruct {
bool Wet; // 0 (false) by default
int Money; // 0 by default
};
// main script
MyCharacterStruct MyCharacter[AGS_MAX_CHARACTERS];
// some script
MyCharacter[cEgo.ID].Wet = true;
MyCharacter[cEgo.ID].Money = 78;
Thanks for the replies, you two.
It's a pity they're non extendable! The struct 'workaround' may suit my needs. I was thinking that if I couldn't do it, I could do something similiar. Cheers guys.