Gamestudio Links
Zorro Links
Newest Posts
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
Help with plotting multiple ZigZag
by degenerate_762. 04/30/24 23:23
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (AndrewAMD, Ayumi), 1,266 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
firatv, wandaluciaia, Mega_Rod, EternallyCurious, howardR
19050 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
"variable" : is not a member of 'ENTITY' #338736
08/21/10 03:41
08/21/10 03:41
Joined: Mar 2009
Posts: 186
V
Valdsator Offline OP
Member
Valdsator  Offline OP
Member
V

Joined: Mar 2009
Posts: 186
I'm trying to have a bullet change the enemy's variable to 1 when hit. I have a c_trace set up, and then this code.
Code:
if(you){
if(you.skill22 == 1){
you.enemydead = 1;
}
}


Then I get the error "enemydead" : is not a member of 'ENTITY' when I run the game. What am I doing wrong?

Re: "variable" : is not a member of 'ENTITY' [Re: Valdsator] #338737
08/21/10 04:02
08/21/10 04:02
Joined: Jan 2002
Posts: 300
Usa
Rich Offline
Senior Member
Rich  Offline
Senior Member

Joined: Jan 2002
Posts: 300
Usa
The error is saying that "enemydead" is not a variable of the "you" structure.

Is enemydead supposed to be a skill, or a redefined skill maybe? Where is "enemydead" from?

You cannot add your own variables to the predefined entity structures, but you can redefine their skills to reflect more user friendly names;

Code:
#define enemydead skill[99]



Now saying enemydead would be the same as saying skill[99]


A8 com / A7 free
Re: "variable" : is not a member of 'ENTITY' [Re: Rich] #338836
08/21/10 23:41
08/21/10 23:41
Joined: Mar 2009
Posts: 186
V
Valdsator Offline OP
Member
Valdsator  Offline OP
Member
V

Joined: Mar 2009
Posts: 186
enemydead is a variable definied in the enemy action. Is there a way to have the bullet change the variable to a 1, for only that specific enemy? Perhaps I have to send some sort of message to "you?"

Re: "variable" : is not a member of 'ENTITY' [Re: Valdsator] #338839
08/22/10 00:23
08/22/10 00:23
Joined: Dec 2008
Posts: 271
Saturnus Offline
Member
Saturnus  Offline
Member

Joined: Dec 2008
Posts: 271
No, it's not possible to change a function's local variable from outside it. Better use entity skills for this or something similar.

Re: "variable" : is not a member of 'ENTITY' [Re: Saturnus] #338842
08/22/10 00:39
08/22/10 00:39
Joined: Oct 2007
Posts: 5,210
İstanbul, Turkey
Quad Offline
Senior Expert
Quad  Offline
Senior Expert

Joined: Oct 2007
Posts: 5,210
İstanbul, Turkey
yes, actually skills are for just exactly that, instead of locally defining it, define it as Rich did. you have to use my.enemydead inside the action though.(instead of just variable name)


3333333333
Re: "variable" : is not a member of 'ENTITY' [Re: Rich] #338948
08/22/10 23:53
08/22/10 23:53
Joined: Mar 2009
Posts: 186
V
Valdsator Offline OP
Member
Valdsator  Offline OP
Member
V

Joined: Mar 2009
Posts: 186
Alright, it's working. Thanks to everyone. :]


Gamestudio download | chip programmers | 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