Skills Question

Posted By: Dooley

Skills Question - 01/14/18 17:11

I am wondering if there is any way to sort through an entity's skills without writing a separate line for each skill. Here is what I have in mind, but I'm certain this will not work in this format. Is there a way to write a script like this?

Quote:

while(my.skill# < 100)
{

//check the number stored in this skill and do something with it

my.skill# += 1;
wait(1);
}


I guess I'm wondering if skills can be used as an array?
Posted By: Superku

Re: Skills Question - 01/14/18 18:29

It's possible, at least when you're using lite-C. Have a look at GStudio8/include/atypes.h:

Code:
typedef struct ENTITY {
	C_LINK link;
	char	*type;		// entity file name
	...
	var	skill[100];	// entity skills
	...
} ENTITY;



Skills are actually just var array entries, probably defined somewhere like this:
#define skill1 skill[0]
...
#define skill100 skill[99]

As a result, you can loop over skills just as you guessed:

Code:
for(i = 0; i < 100; i++) my.skill[i] = i;

Posted By: Dooley

Re: Skills Question - 01/14/18 19:15

Yes, I just did a search and it's in compat.h

Thank you! That will help a lot laugh
© 2024 lite-C Forums