Properties

Started by Superman95, Sat 10/09/2005 04:18:40

Previous topic - Next topic

Superman95

How does one use properties on an object?

For instance, if I assign a property to a character, can I access it from code?

Also, If i create a struct how can I persist the struct when the game is save.  i.e. save the users experience points when he saves his game.  I know I can use Global Ints...but what's the point in using a struct if i have to update the global int everytime anyway.

That Guy

QuoteFor instance, if I assign a property to a character, can I access it from code?

Yes, although AFAIK properties are read-only.  You have to set them in the editor.

QuoteAlso, If i create a struct how can I persist the struct when the game is save.  i.e. save the users experience points when he saves his game.

Pretty much all of your variables are stored when you save your game, although if this extends to the values within structs I can't say for sure.

Just out of curiosity, why would you need a struct just for experience points?

Superman95

actually, I don't...the struct looks like this...

struct Statistics
{
  int Strength;
  int Intelligence;
  int Agility;
  int Vitality;
  int Luck;
  int Magic;
  int WeaponUse;
  int Parry;
  int Dodge;
  int Stealth;
.....
};

you get the idea.  I didn't really like the idea of having global ints for all of them..
What I actually wanted to do was write a OO module to handle as much of the RPG elements as I could.  the problem with global ints is collisions...the person using the module would have to know those global ints are used by this module.

What i wanted was to be able to include datablock(s) with the saved game.  which would be very handy for other things.  like tracking spells  or who knows.

Pumaman

To access a character property, just use:

cCharName.GetProperty

As for save games, all of your script data is automatically saved in the save game file. Are you having a problem with it?

Superman95

Actually, I haven't tried it yet....but I will that's cool.  And i'm guessing it doesn't matter if it's in a module or not


Superman95

while, we're on the subject, I have a suggestion related to properties.

In the editor, it would be more user friendly to have the property editor work more like Access.  Where it's like a table with an empty row at the bottom for inserting.  Perhaps a table for each type.  Like a table for the text types and another table for the int types.  It would seem faster to enter properties.

monkey0506

I have a suggestion.  For every Object/Hotspot/Character/Room in the game that has a custom property set to it, make it a writeable Property of said Object/Hotspot/Character/Room.

For example, if I have the character EGO (cEgo), then I add a custom "number" property, Health, to him, it would make it a lot easier if I could do cEgo.Health = 5; instead of a) having to use the GetProperty function and b) not being able to change the value of the property.

I realize it's not a trivial task, but it would be nice.

Rui 'Trovatore' Pires

[off-topic] Every time I look at the title of this thread my mind finishes the sentence: "...a friend of Socrates." [/off-topic]
Reach for the moon. Even if you miss, you'll land among the stars.

Kneel. Now.

Never throw chicken at a Leprechaun.

SMF spam blocked by CleanTalk