Gamestudio Links
Zorro Links
Newest Posts
New FXCM FIX Plugin
by flink. 06/04/24 07:30
AlpacaZorroPlugin v1.3.0 Released
by kzhao. 05/22/24 13:41
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (Akow, tomaslolo), 1,536 guests, and 12 spiders.
Key: Admin, Global Mod, Mod
Newest Members
AemStones, LucasJoshua, Baklazhan, Hanky27, firatv
19058 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
crash in entities,. help! #239127
12/02/08 20:20
12/02/08 20:20
Joined: Nov 2008
Posts: 42
Philippines
gagamBRYAN Offline OP
Newbie
gagamBRYAN  Offline OP
Newbie

Joined: Nov 2008
Posts: 42
Philippines
guys, need your help,. what seems to be the problem in this code? the error message is "invalid arguments in entity" referring to function func_backselectenemy(), the entity mangyanenemy. i can't remove it! The simplified code are shown below:

function func_startbagobo_mangyan()
{
pan_backselectenemy=pan_create("
pos_x = 0;
pos_y = 0;
button ( 50, 550, \"cancel.pcx\", \"cancel.pcx\", \"cancel_over.pcx\", func_backselectenemy, NULL, NULL);
flags = OVERLAY | VISIBLE;
",11);

bagobo_walk.z=60;

ent_animate(bagobo_walk, "steady", anim_percentage, ANM_CYCLE);

townlevel=ent_create("town.hmp", vector(0,0,-10),NULL);

camera.z = 1;
camera.tilt = -10;
vec_set(camera.x, vector(-500, 0, 100));
mangyanenemy = ent_create("mangyan.mdl", vector(0,-100,-10),NULL);
mangyanenemy.pan=-90;

mangyanenemy.z=60;

mangyanenemy.x=-175;
mangyanenemy.y=-150;

ent_animate(mangyanenemy, "steady", anim_percentage, ANM_CYCLE);




}




function func_backselectenemy()
{ ent_remove(mangyanenemy);
pan_remove(pan_backselectenemy);
ent_remove(townlevel);

}


can you tell me what is the problem?. thank you so much,. why sometimes the entity won't remove.


Secrets are stolen from deep inside..
Re: crash in entities,. help! [Re: gagamBRYAN] #239130
12/02/08 20:29
12/02/08 20:29
Joined: Nov 2008
Posts: 25
M
MrTwiggy101 Offline
Newbie
MrTwiggy101  Offline
Newbie
M

Joined: Nov 2008
Posts: 25
While, I MAY be wrong. These are a few things that might be going wrong.

First, you didn't define the entity. So you should put ENTITY* mangyaenemy at the top if you didn't already.

Also, if you are going to be using mangyaenemy for that function, you should just make it from:

mangyanenemy = ent_create("mangyan.mdl", vector(0,-100,-10),NULL);

to

ent_create("mangyan.mdl", vector(0,-100,-10),func_backselectenemy);

and then turn the mangyaenemy to my.

Also, pan_backselectenemy=pan_create(" doesnt see, to be complete...

Also, remember. Sometimes the engine will point at random lines of code even if there is something else wrong with a different time, like if you forgot to put ; at the end of a line.

Re: crash in entities,. help! [Re: MrTwiggy101] #239134
12/02/08 20:50
12/02/08 20:50
Joined: Nov 2008
Posts: 42
Philippines
gagamBRYAN Offline OP
Newbie
gagamBRYAN  Offline OP
Newbie

Joined: Nov 2008
Posts: 42
Philippines
thanks for the time MrTwiggy smile ahmmm,. yup, i declared the mangyanenemy as ENTITY* at the top.

i cant make the mangyanenemy = ent_create("mangyan.mdl", vector(0,-100,-10),NULL);

to

ent_create("mangyan.mdl", vector(0,-100,-10),func_backselectenemy);

because the entity will be loaded in the environment and the there is a button cancel where i'll put the func_backselectenemy so that it will be back again in the main menu.


Secrets are stolen from deep inside..
Re: crash in entities,. help! [Re: gagamBRYAN] #239139
12/02/08 21:26
12/02/08 21:26
Joined: Feb 2008
Posts: 3,232
Australia
EvilSOB Offline
Expert
EvilSOB  Offline
Expert

Joined: Feb 2008
Posts: 3,232
Australia
To make your code a bit more bulletproof, change your entity declares to this
ENTITY* mangyanenemy = NULL; or ENTITY* mangyanenemy = 0;
PANEL* pan_backselectenemy = NULL; or PANEL* pan_backselectenemy = 0;
Now you can test if the entity is in use or not.

To see this test in action, and to possibly fix your problem, change the following too.
Code:
function func_backselectenemy()
{  if(mangyanenemy!=NULL) ent_remove(mangyanenemy);                 mangyanenemy=NULL;
   if(pan_backselectenemy!=NULL) pan_remove(pan_backselectenemy);   pan_backselectenemy=NULL;
   if(townlevel!=NULL) ent_remove(townlevel);                       townlevel=NULL;
}

let us know how it goes.


"There is no fate but what WE make." - CEO Cyberdyne Systems Corp.
A8.30.5 Commercial

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

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