Bullet doesen´t remove

Posted By: Rei_Ayanami

Bullet doesen´t remove - 07/25/09 17:26

Hello!
I am programming my weapon at this time smile. My problem is that my bullet(plasma bullet) doesen´t remove. Here is my Code:
Code:
function blaster_shoot()
{
	wait(3);
	my.pan = player.pan;
	set(my, INVISIBLE | PASSABLE);
	reset(my, VISIBLE);
	my.emask |= (ENABLE_IMPACT | ENABLE_ENTITY | ENABLE_BLOCK); 
	my.event = remove_plasma_ball;
	plasma_effect();
	plasma_effect();
	plasma_effect();
	plasma_effect();
	plasma_effect();
	plasma_effect();
	plasma_effect();
	plasma_effect();
	plasma_effect();
	plasma_effect();
	plasma_effect();
	plasma_effect();
	plasma_effect();
	plasma_effect();
	plasma_effect();
	plasma_effect();
	plasma_effect();
	plasma_effect();
	plasma_effect();
	plasma_effect();
	c_setminmax(me);
	while(my != NULL)
	{
		you = player;
		c_move(me, vector(10*time_step,0,0), nullvector, 0);
		wait(1);
	}
}


I know that I call the function plasma_effect 8 times, but I need this for the plasma effect wink.

I don´t know why?

Thanks for looking!
Posted By: Storm_Mortis

Re: Bullet doesen´t remove - 07/25/09 17:31

try this it schould remove now!
Click to reveal..

function remove_plasma_ball()
{
my.skil1 = 1;
return;
}

function blaster_shoot()
{
var counter = 0;
wait(3);
my.pan = player.pan;
set(my, INVISIBLE | PASSABLE);
reset(my, VISIBLE);
my.emask |= (ENABLE_IMPACT | ENABLE_ENTITY | ENABLE_BLOCK);
my.event = remove_plasma_ball;
while(counter < 10)
{
plasma_effect();
counter += 1;
}
c_setminmax(me);
while(my.skill1 == 0)
{
you = player;
c_move(me, vector(10*time_step,0,0), nullvector, 0);
wait(1);
}
ptr_remove(me);
}


basicle i would say, the error is in your event function, but you dount show it, so , i dont really know^^
Posted By: Rei_Ayanami

Re: Bullet doesen´t remove - 07/25/09 17:34

Here is my Remove code:

Code:
function remove_plasma_ball()
{
	if(you == player) return;
	printf("Yeha", NULL);
	if(event_type == EVENT_BLOCK)
	{
		effect(hit_block_effect, 0, target, normal);
	}
	ptr_remove(me);
}


Posted By: Storm_Mortis

Re: Bullet doesen´t remove - 07/25/09 17:42

well,
your projectile was passable, so it cant hit anythig!

try this code:
Click to reveal..

function remove_plasma_ball()
{
if(you == player) {return; printf("Yeha", NULL);}

if(event_type == EVENT_BLOCK)
{
effect(hit_block_effect, 0, target, normal);
}
my.skill1 = 1;
}

function blaster_shoot()
{
var counter = 0;
wait(3);
my.pan = player.pan;
set(my, INVISIBLE);
reset(my, VISIBLE);
my.emask |= (ENABLE_IMPACT | ENABLE_ENTITY | ENABLE_BLOCK);
my.event = remove_plasma_ball;
while(counter < 10)
{
plasma_effect();
counter += 1;
}
c_setminmax(me);
while(my.skill1 == 0)
{
you = player;
c_move(me, vector(10*time_step,0,0), nullvector, IGNORE_ME|IGNORE_YOU|IGNORE_PASSABLE|IGNORE_PASSENTS);
wait(1);
}
ptr_remove(me);
}

Posted By: Rei_Ayanami

Re: Bullet doesen´t remove - 07/25/09 17:55

Well,I don´t like to take code from others, because of that and because you gave me the hint that my projectile is passable - so I removed that. But now it shows a Error in my blaster_shoot function...
Posted By: Rei_Ayanami

Re: Bullet doesen´t remove - 07/25/09 18:07

Okay, managed that with a skill1, but my effect doesen´t work - I mean it isn´t shown:
Code:
function remove_plasma_ball()
{
	if(you == player) return;
	effect(hit_block_effect, 100, target, normal);
	my.skill1 = 1;
	ptr_remove(me);
}


Posted By: Storm_Mortis

Re: Bullet doesen´t remove - 07/25/09 18:14

well maybe because you assume that an anime is getting hit.
if you hit a wall the folloing line will crash.
if(you == player)...

you need to check bevore if you hit an entity or a wall!
you need something like this:

if(event_type == event_entity && you == player){return;}
if(event_type == event_entity && you != player){you.health -= xx;return;}
ifevent_type == event_block && you == player){effect(hit_block_effect, 0, target, normal);return;}

i wrote small even things that schould be tall , so you dont need to take code from others, but i hope you get an idea reading thes^^
Posted By: Rei_Ayanami

Re: Bullet doesen´t remove - 07/25/09 18:31

Thanks, but hmm, doesne´t work, not even when i´m take the player == you from event_block - this will never happen ;):
Here is the Code - even with the particle effect:
Code:
function hit_block_effect(PARTICLE *p)
{
	if(random(10) < 5) p.bmap = plasma_blue;
	else p.bmap = plasma_red;
	p.flags |= (BRIGHT | MOVE | TRANSLUCENT);
	p.vel_z = random(2)-1;
	p.vel_x = random(2)-1;
	p.vel_y = random(2)-1;
	p.lifespan = 5;
	p.size = 3;
	p.alpha = 50;
	p.event = plasma_fade;
}
function remove_plasma_ball()
{
	if(event_type == EVENT_ENTITY && you == player) { return; }
	if(event_type == EVENT_BLOCK) { effect(hit_block_effect, 1, target, normal); }
	my.skill1 = 1;
	ptr_remove(me);
}


Posted By: Storm_Mortis

Re: Bullet doesen´t remove - 07/25/09 18:37

i will look at this lather more intensive, but at the moment ive no time for this...

but your problem is, that you dont see any effect now, right?

look at your code - you are creating one particle of a size of 3 and a lifespan of 5 ... ich would say, first for testing increase the size and number.
tham check if the are to slow in movement (1 to -1 is slow) and play with the lifespan/fade off.

this could solve your problem^^
Posted By: Rei_Ayanami

Re: Bullet doesen´t remove - 07/25/09 18:46

thanks! I´ll look later !

Aber ich seh ja du sprichst deutsch, das is einfacher, naja ich guck später...
Posted By: Nowherebrain

Re: Bullet doesen´t remove - 07/25/09 22:07

but others do not speak german, if you want to use Deutsch I suggest a new thread....americans may have a similar problem...just advice...
Posted By: Rei_Ayanami

Re: Bullet doesen´t remove - 07/25/09 22:30

I have written it in Englsih and German
© 2024 lite-C Forums