AndrewBGS
Member
|
Player parameters
I've had this post before but my language skills leave a lot to be desired.
To put it simply, I want to know this:
Is there a way to make Player objects have some specific parameters that NOT all character objects have? Parameters I can set from the engine, not manually in the code (that i can handle).
I want all players to have stamina, but not all character objects should have it. The stamina (example) should be an obj param I can edit in the world editor, and use it in the code.
Can I achieve this? If so, what's the right way to do it?
|
|
04-25-2013 01:04 PM |
|
Esenthel
Administrator
|
RE: Player parameters
Something like this:
Code:
class Chr : Game.Chr
{
}
class Player : Chr
{
flt stamina;
}
This is covered in Bloody Massacre tutorial, and possibly in some other tutorials.
|
|
04-25-2013 01:06 PM |
|
AndrewBGS
Member
|
RE: Player parameters
This works ok, and I already have it for some parameters. But I can't edit from the editor. There are those class elements, like OBJ_CHR and OBJ_PLAYER.
Apparently I can't seem to get parameters specific to OBJ_PLAYER class only. all I managed to got was the standard OBJ_CHR ones.
In bloody massacre, you got the bolld colour param for example.
In Bloody Massacre, the OBJ_PLAYER element class is empty however. Mine isn't, it has some parameters and i don't know how to get them in code.
I know I'm bad at explaining things... but I hope you get what I'm saying.
|
|
04-25-2013 04:30 PM |
|
Rubeus
Member
|
|
04-25-2013 04:43 PM |
|
candam
Member
|
RE: Player parameters
(04-25-2013 04:30 PM)andreim44 Wrote: This works ok, and I already have it for some parameters. But I can't edit from the editor. There are those class elements, like OBJ_CHR and OBJ_PLAYER.
Apparently I can't seem to get parameters specific to OBJ_PLAYER class only. all I managed to got was the standard OBJ_CHR ones.
In bloody massacre, you got the bolld colour param for example.
In Bloody Massacre, the OBJ_PLAYER element class is empty however. Mine isn't, it has some parameters and i don't know how to get them in code.
I know I'm bad at explaining things... but I hope you get what I'm saying.
Hello Andreim I think you can do what do you ant this way
Create new class object from the editor select your class name then add your parameters then you can actually access them through the code easily
|
|
04-25-2013 04:55 PM |
|
AndrewBGS
Member
|
RE: Player parameters
I already have the OBJ_PLAYER class, and the the tiny human on the map IS a member of that class. In the world, he is loaded like in the example:
Game.World.setObjType(Items , OBJ_PLAYER ); //among others
However, the player's class extends the character class in code. So I only manage to get parameters from OBJ_CHR. Not sure exactly where these two mingle. I'm currently checking out those tutorials, but it doesn't seem to address this particular issue. The problem is that my guy should indeed by a character, but he's also a player. Any way I can make my OBJ_PLAYER class element "extend" the OBJ_CHR? I think that should solve it.
(This post was last modified: 04-25-2013 05:12 PM by AndrewBGS.)
|
|
04-25-2013 04:59 PM |
|
Esenthel
Administrator
|
RE: Player parameters
Hello,
In the Editor an object class cannot extend another one, you can do this in following way :
Just make copy of all chr parameters to the player class
Or
In the world editor override class of your player object from character class to player class, it's possible that with this method you can automatically inherit parameters from character class, but not from player class
|
|
04-27-2013 08:38 AM |
|
AndrewBGS
Member
|
RE: Player parameters
I've tried the 2nd solution, but it didn't seem to work.
I guess I'll just edit the player specific parameters in code only. After all, all players should be created within the application, not laying around in the world.
Thanks for the help.
|
|
04-27-2013 08:52 AM |
|