4 registered members (ozgur, Ayumi, VHX, monarch),
1,161
guests, and 4
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
acknex .exe crashing on ent_remove!!!
#245797
01/12/09 00:04
01/12/09 00:04
|
Joined: Sep 2008
Posts: 5
Bullshark
OP
Newbie
|
OP
Newbie
Joined: Sep 2008
Posts: 5
|
Hello! I´m having a serious problem that I haven´t been able to solve, whenever I use ent_remove or ptr remove acknex.exe crashes (Windows diplays a "acknex.exe has stopped working" sign). Any ideas on how to fix this? Here's an example code, just in case I'm using them wrong:
///////////////////////////////
#include <acknex.h>
#include <default.c>
#include <mtlFX.c>
///////////////////////////////
ENTITY* star_ent;
function star_event()
{
switch (event_type)
{
case EVENT_ENTITY:
beep();
ent_remove(me);
wait(1);
return;
case EVENT_BLOCK:
beep();
ent_remove(me);
wait(1);
return;
}
}
action star_fall()
{
my.emask |= IGNORE_PASSABLE | ENABLE_BLOCK | ENABLE_ENTITY ;
my.event = star_event;
}
function main()
{
level_load("Test.WMB");
wait(2);
star_ent = ent_create("star.mdl",vector(0,0,300),star_fall);
phent_settype(star_ent, PH_RIGID, PH_POLY);
phent_setgroup( star_ent, 1 );
phent_setmass(star_ent,0.1,PH_BOX);
phent_setdamping (star_ent, 15, 0 );
phent_enable( star_ent, 1 );
ph_setgravity(vector(0,0,-100));
ph_selectgroup( 1 );
while(1)
{
wait(1);
}
}
The wmb file only has a block to act as the ground for collision. Thanks in advance for your help. ---------------------------- System: * Windows Vista Pro 64 bits * Core 2 Duo 2.13 Ghz Processor * 5 Gb RAM * nvidia 8800GTS video card ----------------------------
|
|
|
Re: acknex .exe crashing on ent_remove!!!
[Re: Bullshark]
#245806
01/12/09 02:59
01/12/09 02:59
|
Joined: Oct 2004
Posts: 1,655
testDummy
Serious User
|
Serious User
Joined: Oct 2004
Posts: 1,655
|
Some or all of following may be inaccurate or erroneous. ...wait(1) before ent_remove(ENTITY*) in event (else instance = dangerous instruction)? ......wait(1); ......if (me != NULL) { ent_remove(me); } ...(below) removal in action not event
///////////////////////////////
#include <acknex.h>
#include <default.c>
#include <mtlFX.c>
///////////////////////////////
#define _hit skill38
ENTITY* star_ent;
function star_event()
{
switch (event_type)
{
case EVENT_ENTITY:
beep();
my._hit = 1;
my.event = NULL;
return;
case EVENT_BLOCK:
beep();
my._hit = 1;
my.event = NULL;
return;
}
}
action star_fall()
{
my.emask |= IGNORE_PASSABLE | ENABLE_BLOCK | ENABLE_ENTITY ;
my.event = star_event;
while(me != NULL) {
if (my._hit == 1) {
break;
}
wait(1);
}
if (me != NULL) {
phent_enable(me, 0);
ent_remove(me);
}
}
function main()
{
level_load("Test.WMB");
wait(2);
star_ent = ent_create("star.mdl",vector(0,0,300),star_fall);
phent_settype(star_ent, PH_RIGID, PH_POLY);
phent_setgroup( star_ent, 1 );
phent_setmass(star_ent,0.1,PH_BOX);
phent_setdamping (star_ent, 15, 0 );
phent_enable( star_ent, 1 );
ph_setgravity(vector(0,0,-100));
ph_selectgroup( 1 );
}
|
|
|
Re: acknex .exe crashing on ent_remove!!!
[Re: Pappenheimer]
#245834
01/12/09 09:45
01/12/09 09:45
|
Joined: Aug 2005
Posts: 343 Germany
HPW
Senior Member
|
Senior Member
Joined: Aug 2005
Posts: 343
Germany
|
... There shouldn't be any wait(1); in an event function. I guess those are the reason for the crash. ... This is not true. You can have wait(1) in your event functions. To avoid crashes you should set the wait(1) before the ent_remove. This info was posted by JCL long time ago and I used it many times this way without crashes. And here I found the description in the manual: If for some reason the event function must perform such 'critical instructions', they must be preceded by a wait(1) for delaying them to the next frame. Then it's safe.
Last edited by HPW; 01/12/09 09:48.
Evil Blood (v. 0.52) RPG Commport.de (Social Network Community)
|
|
|
|