my.skill.. confused.

Posted By: gagamBRYAN

my.skill.. confused. - 02/04/09 18:00

confused at my.skill... what it does? is it predefined? i dont used WED, is that means i cant use it?.. i'd check the manual but it is not ckear to me.

hope anyone can enlighten me.

tnx in advance!
Posted By: EvilSOB

Re: my.skill.. confused. - 02/04/09 18:04

It IS pre-defined. Every entity 100 defined var's called .skill1 to .skill100
Thay are ALSO called .skill(0) to .skill(99), two ways to access the same data,
that is available for every entity...
Look in atypes.h in the include folder of A7, youls fund the structures there.
(just dont change anything, weird sh*t happens then, but I learned!)
Posted By: garv3

Re: my.skill.. confused. - 02/04/09 18:08

Any entity got some parameters (skill1 ... skill100).
You may set these parameters by doing something like
Code:
entity.skill3 = 23.578
The min and max allowed values for each skill are -999999.999 ... +999999.999
Additionally entities have 8 Flags calles flag1 ... flag8. These flags can only be set to ON or OFF.

You may define other "names" for these skills and flags. To do so use something like.
Code:
#define health skill2

Now you can set the entities health (==skill2) by using code like
Code:
entity.health = 93

You can use skills and flags as normal variables. But you must use them as a parameters of the specific entity.
Posted By: gagamBRYAN

Re: my.skill.. confused. - 02/04/09 18:14

so it is okay if in the "ent_animate(bagoboenemy, "run", anim_percentage, ANM_CYCLE);" i used varable anim_percentage to all these ent_animate rather than using the my.skill values?
Posted By: Xarthor

Re: my.skill.. confused. - 02/04/09 18:20

If anim_percentage is a global variable it means that every entity has the same animation speed and every entity is for example at the 4th frame of its animation cycle.

I would recommend to define a skill as anim_percentage and use it for each entity individually:
Code:
#define anim_percentage skill50;

Posted By: Quad

Re: my.skill.. confused. - 02/04/09 18:27

skill is an array of 100 vars in the entity struct.

normall they are used lik

entity.skill[0]
or
entity.skill[1] ...

skill1,skill2 are aliases for these.

you can also rename/realies them like the way Xarthor shows
Posted By: gagamBRYAN

Re: my.skill.. confused. - 02/04/09 18:40

tnx guys!.. i'll just explore on that matter
Posted By: heinekenbottle

Re: my.skill.. confused. - 02/04/09 18:44

A skill is a variable that is similar to a local variable. However, instead of being specific to a function, it is specific to an entity. So if you want an entity to have a certain parameter, unique to that entity, you use a skill.

For example, .skill11 could be health. You could have player.skill11 = 100; and this won't effect enemy.skill11.

Skills can also be defined, as has already been stated to improve readability. #define health skill1

Skills can also be vectors. If skill3 is used as a vector, than skill4 and skill5 take the y and z components automatically (so take care when you use a skill as a vector, to not do anything with the two consecutive skills).

Skills are accessed by the entity[dot]property method such as player.health = 100; or you.speed = 75;

Last, a skill can also hold two numbers like this:

my.ammo = 100.25;

integer(my.ammo) = numOfBullets; //take the integer of my.ammo, assign that to numOfBullets
frx(my.ammo) = numOfClips; //take the fraction of my.ammo, assign that to numOfClips

what this does, is it holds two values in one spot (this is useful if you exceed the number of skills.) In this example, we have 100 bullets and 25 clips.

You can do this trick with any variable by the way, but since you can run out of skills, this trick is usually seen with skills.

Posted By: dracula

Re: my.skill.. confused. - 02/04/09 20:27

For my clarification please:

I'm assuming we are not using WED here.

1. A single entity can have 100 skills.
2. A skill can be attached using dot notation as in object oriented programmming
3. They are effectively variables that are used exclusively with entities
4. They can be aliased for clarity

local/global or both kind of "variables" ????

Could someone list the properties of flags please. I know they are boolean but I still get confused by them.

Thanks
Posted By: Quad

Re: my.skill.. confused. - 02/04/09 21:02

well

1. yeah
2. they are not attached, they are always there, you just access them using dot.(like you are using a element in a struct)
3. entites can store variables, in fact entites consistes from diffren type of variables/arrays, it has 100 vars(skills) a model(the visual apperance of entity) x,y,z,pan,tilt,roll and so on. If your entity is global(like you defined a Global ENTITY*) you can use them globally. Like you can use player.skill1 on another action. if you use me.skill# then it refers to skill of the entity that is running the action. Multiple entites running same action, can have diffren skill values, i mean:

action random_num(){
my.skill1 = random(1000);
}

all entites using thsi action will have diffrent number stored in their skill1.

4. yeah
Posted By: heinekenbottle

Re: my.skill.. confused. - 02/05/09 05:30

Quote:

local/global or both kind of "variables" ????


Neither really. They are similar to local variables, but there is a slight difference. A local variable is scoped to a function and a skill is scoped to an entity. So if you have a local variable in the action of an entity, you can't use it in another function. But a skill can be used in an outside function, provided that the pointer is not invalid.

I guess it would be more accurate to say that skills are members of an entity.


Quote:
Could someone list the properties of flags please. I know they are boolean but I still get confused by them.


Flags are a bit weird now, but with the macros they aren't too difficult.

flags are defined in the same manner as skills:

Code:
//pulled out of my game's code
#define stealG FLAG1			//if this flag is set, the player must take care that no one sees her take the coins.
#define doorState FLAG2		//open and closed.
#define AWARE FLAG2			//AI state, AWARE means the AI knows Suzetta is around AND is actively trying to get to her, but not necessarily in combat
#define COMBAT FLAG3			//AI and player state, COMBAT means that Suzetta and an AI are currently fighting


Flags are set in game in this method:


entity.flags |= (AWARE | COMBAT); //set the combat and aware flags on
entity.flags &= (AWARE | COMBAT); //set the combat and aware flag off

Alternatively, there are the macros, which are more intuitive in my opinion:

set(obj,flag); //sets an objects flag (can be an entity, panel, anything that uses flags)
reset(obj,flag); //turns off all listed flags
toggle(obj,flag); //toggles all listed flags

note that if you use multiple flags in these macros, they are separated by an OR symbol "|"

Using flags in conditionals:

if(my.flags & AWARE) { //do stuff }

Or use the is(obj,flag) macro:

if(is(my,AWARE) { //go find the player and kill him }

There are also several types of flags:
emask is for enable_event flags
eflags is for material effects I believe
flags is your general purpose, 32 max, flags
and not sure what flags2 or smasks is.

C-Script flags were more intuitive IMO, but what can ya do?
© 2024 lite-C Forums