Gamestudio Links
Zorro Links
Newest Posts
Zorro 2.70
by jcl. 09/29/25 09:24
optimize global parameters SOLVED
by dBc. 09/27/25 17:07
ZorroGPT
by TipmyPip. 09/27/25 10:05
assetHistory one candle shift
by jcl. 09/21/25 11:36
Plugins update
by Grant. 09/17/25 16:28
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
4 registered members (NewbieZorro, Grant, TipmyPip, AndrewAMD), 13,346 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
krishna, DrissB, James168, Ed_Love, xtns
19168 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Whats going on with "skills" and why bother? #221727
08/15/08 19:54
08/15/08 19:54
Joined: Oct 2007
Posts: 27
P
phmenard Offline OP
Newbie
phmenard  Offline OP
Newbie
P

Joined: Oct 2007
Posts: 27
I don't get it ... how do ENTITY skills work?? I mean if I have an ENTITY that's a dog and I do this ...

#define skill50 = Bark;

its all good as long as the ENTITY is a dog, what if the next ENTITY I create is a "Cat"??? I would then want to ...

#define skill51 = Meow;

Do all ENTITIES created have to have the same set of skills??? Why would a "Cat" "Bark" and a "Dog" "Meow". I'm migrating over from java and I very used to using classes to define my objects ... give them the most basic behaviours and then build from there with child classes and inheritance. Is there a way to implement this way of game design in Lite-c??

Re: Whats going on with "skills" and why bother? [Re: phmenard] #221734
08/15/08 21:35
08/15/08 21:35
Joined: Jan 2007
Posts: 1,619
Germany
Scorpion Offline
Serious User
Scorpion  Offline
Serious User

Joined: Jan 2007
Posts: 1,619
Germany
1st: dont use = and ; for defines!

2nd: defines just tell the compiler which words he have to replace by different ones. So you could define skill50 as bark and meow and use it as you like. Example:

Code:
#define bark skill50
#define meow skill50

action dog() {
    my.bark = 10;
}

action cat(){
    my.meow = 20;
}


Re: Whats going on with "skills" and why bother? [Re: Scorpion] #221736
08/15/08 21:41
08/15/08 21:41
Joined: Oct 2007
Posts: 27
P
phmenard Offline OP
Newbie
phmenard  Offline OP
Newbie
P

Joined: Oct 2007
Posts: 27
I apologize ... I did type it wrong, I do use it the way you typed it ... but that still doesn't answer the question ... does this now mean that skill50 for every entity I create will be defined as "Bark"??

Re: Whats going on with "skills" and why bother? [Re: phmenard] #221739
08/15/08 22:31
08/15/08 22:31
Joined: Jul 2008
Posts: 1,178
England
M
MrGuest Offline
Serious User
MrGuest  Offline
Serious User
M

Joined: Jul 2008
Posts: 1,178
England
no, that's what i used to think! =D

if you use, say...
#define parent skill50
#define child skill51

then when refering to an entity, and reading through your code, you can read
my.parent = you;
your.child = me;

makes it a lot easier on the eyes smile rather than
my.skill50 = you;
you.skill51 = me; not knowing what it was doing,

but if you have entities that don't necessarily need parents and children, then those can be saved for something else, like road_rages, or fishing_trips, for want of a better example,
#define road_rages skill50
#define fishing_trips skill51

and then use those to still store values into skill50 and skill51 for different entities
my.road_rages = 100;
my.fishing_trips = 0; //i was too busy raging

NB: but then obviously you can't query their road_rages if you've set their parent

so if you have a cat pointing to a sound file for skill50, and a dog pointing to a sound file at skill 50...
#define bark skill50
#define meow skill50
#define voice skill50

cat.meow = str_create("meow.wav");
dog.bark = str_create("bark.wav");
sound_play(my.voice); //this syntax is crap but you get the idea! laugh

hope this helps

Re: Whats going on with "skills" and why bother? [Re: MrGuest] #221814
08/16/08 16:00
08/16/08 16:00
Joined: Oct 2007
Posts: 27
P
phmenard Offline OP
Newbie
phmenard  Offline OP
Newbie
P

Joined: Oct 2007
Posts: 27
hmmm ok so what you telling me is I can do something like this....

#define bark skill50;
#define meow skill50;
#define squeal skill50;

ENTITY* dog = NULL;
ENTITY* cat = NULL;
ENTITY* mouse = NULL;

dog.bark = str_create("bark.wav");
cat.meow = str_create("meow.wav");
mouse.squeal = str_create("squeal.wav");

I can #define as many names as I want for the same skill so different entities can have different abilities?? And I can do this all in the same file without any errors

Re: Whats going on with "skills" and why bother? [Re: phmenard] #221816
08/16/08 16:22
08/16/08 16:22
Joined: Nov 2007
Posts: 1,143
United Kingdom
DJBMASTER Offline
Serious User
DJBMASTER  Offline
Serious User

Joined: Nov 2007
Posts: 1,143
United Kingdom
yes because each entity has it's own skill50, it's not a global variable.
All you are doing is referencing skill50 as a different name.

Re: Whats going on with "skills" and why bother? [Re: DJBMASTER] #221826
08/16/08 17:14
08/16/08 17:14
Joined: Jul 2008
Posts: 1,178
England
M
MrGuest Offline
Serious User
MrGuest  Offline
Serious User
M

Joined: Jul 2008
Posts: 1,178
England
but it is best to try and stick with just one keyword if you're using it to reference similar things for each entity
#define noise skill50

Re: Whats going on with "skills" and why bother? [Re: MrGuest] #221830
08/16/08 17:27
08/16/08 17:27
Joined: Oct 2007
Posts: 27
P
phmenard Offline OP
Newbie
phmenard  Offline OP
Newbie
P

Joined: Oct 2007
Posts: 27
Ok, great .. thanks for the help


Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1