pulling skills and flags into event function possible?

Posted By: Trooper119

pulling skills and flags into event function possible? - 08/17/08 21:23

I have a "interesting" issue, I've written the following code:
Quote:
#define health skill1
... //and so on
#define invincible FLAG1 //EDIT: Updated to what is shown in code

...

action makeGuard();

function modelHit()
{
if (event_type == EVENT_IMPACT)
{
if (my.invincible == ON) //Looks like flags and such don't transpher over, move back to global struct?
{
...
}
}

...

//uses: health, velX, velY, velZ, state, damage, invincible, onGround
action makeGuard()
{
...
my.emask |= ENABLE_IMPACT;
my.event = modelHit;
...
}
...


But I get an error saying that "flag1 is not a member of ENTITY" since I know you can call certain values like my.pan into the event function and it work just fine, can you not pull skill's and flags into it as well? If this is so I can just transfer everything into a struct and it will work that way, I simply wanted to know if I could use skills and flags of an ENTITY to make it a bit easier.

Any clarification would be nice. Thanks guys smile
Posted By: MrGuest

Re: pulling skills and flags into event function possible? - 08/17/08 21:55

needs to be FLAG1 now ... we love you conitec! =D
Posted By: Trooper119

Re: pulling skills and flags into event function possible? - 08/18/08 00:20

Brilliant, now that I know what to look for it's rather simple. Seems weird they kept skill1 and so on lowercase though. Appreciate the help, as always.

In the debuggers infinite wisdom though it keeps giving me "Syntax Error" once I corrected the "flag1" issue, for example in action makeGuard(); I have the following code that all gives a syntax error (gives it in many places, but this is a bit simpler to analyze).

Quote:
//define skills and flags
#define health skill1
#define velX skill2
#define velY skill3
#define velZ skill4
#define state skill5
#define damage skill6
#define invincible FLAG1
#define onGround FLAG2

//define player states
#define inactive -1
#define idle 0
...

//uses: health, velX, velY, velZ, state, damage, invincible, onGround
action makeGuard()
{
my.health = 0;
my.state = idle;
my.invincible = OFF;
...
}

EDIT: Only the flag's show an error now

It's as if the skills and flags aren't defined correctly or the my is pointing somewhere funky. I simply don't know what's wrong, sorry for the vague request but please feel free to ask for more code if you'd like, I simply didn't want to dump a large block of it and walk away saying "duhhh, please help :/"

Sorry for the lame request but I've been looking through the manual for a while now with no success.
Posted By: MrGuest

Re: pulling skills and flags into event function possible? - 08/18/08 00:38

yeah lose the ; after defines aswell =D bow before the might of Conitec! :P

Code:
#define health skill1

Posted By: Trooper119

Re: pulling skills and flags into event function possible? - 08/18/08 01:17

I really do appreciate your help. Unfortunately removing the semicolon didn't remove the error, I updated the code I referenced with the new code.

EDIT: Change that, only the flags don't work now, trying to fix now, let me know if you know anything

EDITx2: Alright, found the error, looks like my.invincible = OFF; doesn't work for some reason, changing everything so it uses the flag functions like is(), set() and reset(), these seem to work
Posted By: MrGuest

Re: pulling skills and flags into event function possible? - 08/18/08 02:11

can you put your code up, how are you referencing the flags?
Posted By: Trooper119

Re: pulling skills and flags into event function possible? - 08/18/08 15:10

I apologize, everything works, and I didn't think anyone would really want anything as a reference for future problems, my code now works, I'm working on a run-time issue now that is completely unrelated, so sorry for the delay but here is what I did:

Quote:
//define skills and flags
#define health skill1
#define velX skill2
#define velY skill3
#define velZ skill4
#define state skill5
#define damage skill6
#define invincible FLAG1
#define onGround FLAG2

...

function modelHit()
{
if (event_type == EVENT_IMPACT)
{
if(is(my,invincible)) //changed from my.invincible == ON
{ ... }
if(is(my,onGround)) //Changed from my.onGround == ON
{ ... }
}
...
}

//uses: health, velX, velY, velZ, state, damage, invincible, onGround
action makeGuard()
{
...
reset(my,invincible); //changed from my.invincible = OFF;
...
}

Posted By: MrGuest

Re: pulling skills and flags into event function possible? - 08/18/08 15:35

ok i've just done a quick test and it's working the way it should...

looking at that part your code you haven't set the flag to on anywhere
Code:
	set(me,invincible); //turns on
	reset(me,invincible); //turns off

Posted By: Trooper119

Re: pulling skills and flags into event function possible? - 08/18/08 16:03

Yea I realize that, I appreciate the help, but my invincible/guard state isn't implemented yet, (shhh, don't tell anyone.) Thanks for all the help, I'm mainly trying to get my characters to react to each other and the environment, I simply but a invincible flag up to detect for my guard state, however much like the rest of my code, it's unfinished.
© 2024 lite-C Forums