Posted By: Reconnoiter
Error E1516: Invalid memory area - 04/16/14 13:03
Hey all,
Lately I got this invalid memory area error popping up, never had it before. A bit frustrating cause I wanted to release a demo of my project soon on this site .
The error happens only when I create an item after an enemy dies. E.g. I can create tons of items when the enemy is alive and when there is no enemy etc and get no error. And the strange thing is that it is kindy random, but does seem to always happen when killing a large group of enemies.
I will try to keep the code as short as possible here.
First the code after the enemy dies:
The code that creates item (when I write 'NULL' for the actions of the items, I get no error):
And the code of the item (I added the Sys_marker after the errors began, don't really no if it has any effect at the moment):
I runned in diag, below is the acklog file:
Thanks for taking the time! I more code or info is needed, I can add it (I tested alot already).
Lately I got this invalid memory area error popping up, never had it before. A bit frustrating cause I wanted to release a demo of my project soon on this site .
The error happens only when I create an item after an enemy dies. E.g. I can create tons of items when the enemy is alive and when there is no enemy etc and get no error. And the strange thing is that it is kindy random, but does seem to always happen when killing a large group of enemies.
I will try to keep the code as short as possible here.
First the code after the enemy dies:
Code:
//update monsters left if ((connection & CONNECT_SERVER) || connection == 0) { monsters_left -= 1; send_var(monsters_left); } //drop item if ((connection & CONNECT_SERVER) || connection == 0) enemy_createitem(); //decay ... you = ent_createlocal("MDL_BloodSplatGreen.mdl",vector(my.x,my.y,my.z-16),bloodsplat); wait(-15); var decay_time = 0; while (1) { my.z -= 0.1; decay_time += time_step; if (decay_time >= 100) break; wait(2); } ent_remove(me);
The code that creates item (when I write 'NULL' for the actions of the items, I get no error):
Code:
function enemy_createitem() { var i; for(i = 1; i < 9; i++) { if (pointer_player[i]) { if (random(100) >= 66) you = ent_create("MDL_BonusHealth.mdl",vector(my.x,my.y,my.z+40),item_healthbonus); else { if (random(100) >= 50) you = ent_create("MDL_BonusArmor.mdl",vector(my.x,my.y,my.z+40),item_armorbonus); else { you = ent_create("MDL_BonusSpeed.mdl",vector(my.x,my.y,my.z+40),item_speedbonus); } } you.STATE = i; send_skill_to(pointer_player[i],you.STATE,0); } } }
And the code of the item (I added the Sys_marker after the errors began, don't really no if it has any effect at the moment):
Code:
action item_speedbonus() { sys_marker("ITS"); if (connection & CONNECT_SERVER) my.smask |= NOSEND_FRAME | NOSEND_ANGLES | NOSEND_ALPHA | NOSEND_AMBIENT | NOSEND_COLOR | NOSEND_FLAGS | NOSEND_SCALE | NOSEND_SKIN; while(connection != 0 && my.client_id < 0) wait(1); ent_sendnow(my); wait(1); my.smask |= NOSEND_Z; set(my,INVISIBLE | PASSABLE); my.group = 5; //world and items while(my.STATE == 0) wait(1); //make item visible for only one player while(!player) wait(1); if (player == pointer_player[my.STATE]) reset(my,INVISIBLE); vec_scale(my.scale_x,0.8); if (!is(my,INVISIBLE)) my.material = mtl_specBump; while(1) { if (!is(my,INVISIBLE)) { ... } if (my.STATE != 0) { if (pointer_player[my.STATE]) { if (vec_dist(my.x, pointer_player[my.STATE].x) < 100) { if (connection == 2) { ... } if ((connection & CONNECT_SERVER) || connection == 0) { ... break; } } } } wait(1); } ent_remove(me); }
I runned in diag, below is the acklog file:
Html:
Log of A8 Engine 8.40.3 run at Wed Apr 16 14:22:41 2014 SKYNET on Windows NT/2000/XP version 6.1 Build 7601 Options Test.c -diag -te App: D:\Tools\GStudio8\acknex.exe in D:\Tools\GStudio8\SKYNET's games\TEST\ MM mixer opened DSOUND device opened DI interface opened Start Window opened(c) Conitec - www.3dgamestudio.com A8 Engine - Commercial Edition V8.40.3 - Sep 2 2012 Development version Registered to: SKYNET, ALL YOUR CODE BELONG TO US Mouse found Speakers (Realtek High Definition Audio) opened NVIDIA GeForce 310M pure T&L device 1ff9 detected D3D device NVIDIA GeForce 310M 1ff9 selected. PATH data\ ackAR.dll opened acknet.dll opened ackoal.dll opened ackphysx.dll opened ackwii.dll opened Compiling TEST.C - [Esc] to abort.. PATH D:\Tools\GStudio8\code\ PATH D:\Tools\GStudio8\templates\images\......... PATH D:\Tools\GStudio8\data\ PATH D:\Tools\GStudio8\data\.. PATH D:\Tools\GStudio8\data\................................................... 3.622 sec Running TEST.C. 38 objects Main started at 4.866 D3D_Init Window: 720x480 -> Window: 1x720x480x32 Video memory found: 1734 MB D3D_Resize Screen: 1366x768 -> Screen: 1x1366x768x32 LevelInit at 5.253 275 entities 0 cameras 3 lights 0 sounds 0 paths 50 lmaps 12 textures 530 meshes 809 submeshes 28361 faces Nexus overflow at 34592200...ok LevelReady at 6.378 mtlfx_startup started def_startup started Pointers_startup started Interface_startup started globalvars_startup started Main loop at 6.770.... 1st frame with 1734 MB.. at 7.922 HEADRELATIVE sound: 1 Malfunction W1516: Invalid memory area def_debug Program aborted
Thanks for taking the time! I more code or info is needed, I can add it (I tested alot already).