Message Board
Message Board > Fenix / Bennu / Gemix / DIV > process deleting a process isnt working right anymore |
June 27, 2012, 23:03 | |
DoctorN
Whiskered 91 posts |
Code: //being attacked if(procID = collision(type bullet_1)) say("collision!"); health-=1; signal(procID,s_kill); end if(procID = collision(type throw_1)) signal(procID,s_kill); health-=2; end if(procID = collision(type hit_wave)) if(weps.can_hurt==true) health-=1; weps.can_hurt=false; end end for some reason its not deleting procID anymore. The only thing that works is the hit_wave but unlike everything else, hit_wave is a melee object (meaning only one of its presence exsts) so itll work that way. I tried multiple structs between the processes and stuff but that was getting too tedious and still not working. Now I am confused, could you help? Thanks ____________ |
# |
June 27, 2012, 23:36 | |
PB
Defender of the faith 630 posts |
Based on looking at the code, it seems fine to me. However I'm not 100% sure about the behaviour of the collision function when used multiple times within the same frame. Maybe something goes wrong in that area. As in practices of coding style, I'd personally put an assignment outside an if-statement, but I do think this should go fine... Just to be sure though: what do you mean by "not deleting procID"? I suspect you mean killing hte process, not resetting the procID variable, as this is something you need to do manually. EDIT: Some things that might go wrong: 1. Collision only returns one process colliding with the current process at the time. If multiple processes of the same type collide, you might want to call the collision function iteratively. 2. Processes like bullet and throw, probably have some speed. It's possible that the movement of the objects is larger than the size of the area of collision detection. In this case no collision occurs and the object will appear to move through. [Edited on June 27, 2012 by PB] ____________ |
# |
June 28, 2012, 00:39 | |
DoctorN
Whiskered 91 posts |
Its not killing the process, weeks ago this worked, but for some off reason its not anymore.
____________ |
# |
June 28, 2012, 18:39 | |
DoctorN
Whiskered 91 posts |
help?
____________ |
# |
June 28, 2012, 22:53 | |
PB
Defender of the faith 630 posts |
is it not killing any process, or is it only killing some of the processes?
____________ |
# |
June 28, 2012, 23:21 | |
DoctorN
Whiskered 91 posts |
its not killing any processes at all now. Now if I set up (since were working on bullet_1, and come bullet_1's success, I can get everything else to work since they are made the same way) inside bullet_1's process that if it collides with the enemy process (lets do Enemy_A), itll delete itself. I put in console: say("collided"); when the bullet hit the enemy and the enemy took damage (this means the enemy recognized it) and say("destroyed"); when the bullet hit the enemy it would destroy itself; 19/20 times i got the destroyed message, and the enemy only has 5 health and i fired millions of shots at it. now if i take out all the collision and say() commands from the bullet, then when it touches the enemy, five "collided" messages will appear, the enemy will be destroyed, and the bullet will fly until it hits the wall or goes off screen (and then its destroyed).
____________ |
# |
June 29, 2012, 01:08 | |
PB
Defender of the faith 630 posts |
Ok, I'm not sure if I followed you there... I read bullet_1 would delete itself. I'm asuming this is done using the return statement? Also you might want to be carefull not to send a signal to an already stopped process. So if bullet_1 might have already "deleted itself", it might cause unexpected behaviour if you use the signal command on that same process instance after that. Finally, to check if the signal command is working at all, you could perhaps try something like signal(type bullet_1, s_kill); Which should kill all instances of bullet_1... EDIT: By the way, I'm responding based on my ancient DIV knowledge, not the windows variants which have say functions and all that fancy stuff... So there might be a divference in runtime behaviour there anyway... [Edited on June 29, 2012 by PB] ____________ |
# |
June 29, 2012, 01:14 | |
DoctorN
Whiskered 91 posts |
No... you misread everything. I put that in later on to test, and for some reason the bullet will delete itself. But, even if i remove the signal(procID,s_kill) in the enemy process, the bullet will still delete itself before the enemy does anything (like the bullet collided with the enemy so it will do the enemies thing first, but not the other way around). And if i put in the enemy process at all, anywhere to delete the bullet_1, it wont do it. PM me your email, ill send you the source code.
____________ |
# |
Message Board > Fenix / Bennu / Gemix / DIV > process deleting a process isnt working right anymore