2 registered members (Akow, tomaslolo),
1,536
guests, and 12
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Bullet doesen´t remove
#281146
07/25/09 17:26
07/25/09 17:26
|
Joined: Feb 2009
Posts: 3,207 Germany, Magdeburg
Rei_Ayanami
OP
Expert
|
OP
Expert
Joined: Feb 2009
Posts: 3,207
Germany, Magdeburg
|
Hello! I am programming my weapon at this time . My problem is that my bullet(plasma bullet) doesen´t remove. Here is my 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 . I don´t know why? Thanks for looking!
|
|
|
Re: Bullet doesen´t remove
[Re: Rei_Ayanami]
#281148
07/25/09 17:31
07/25/09 17:31
|
Joined: Sep 2006
Posts: 99 BS, Germany
Storm_Mortis
Junior Member
|
Junior Member
Joined: Sep 2006
Posts: 99
BS, Germany
|
try this it schould remove now! 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^^
Last edited by Storm_Mortis; 07/25/09 17:33.
it found a voice ... now it needs a body
|
|
|
Re: Bullet doesen´t remove
[Re: Rei_Ayanami]
#281151
07/25/09 17:42
07/25/09 17:42
|
Joined: Sep 2006
Posts: 99 BS, Germany
Storm_Mortis
Junior Member
|
Junior Member
Joined: Sep 2006
Posts: 99
BS, Germany
|
well, your projectile was passable, so it cant hit anythig! try this code: 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); }
it found a voice ... now it needs a body
|
|
|
Re: Bullet doesen´t remove
[Re: Rei_Ayanami]
#281162
07/25/09 18:14
07/25/09 18:14
|
Joined: Sep 2006
Posts: 99 BS, Germany
Storm_Mortis
Junior Member
|
Junior Member
Joined: Sep 2006
Posts: 99
BS, Germany
|
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^^
it found a voice ... now it needs a body
|
|
|
Re: Bullet doesen´t remove
[Re: Storm_Mortis]
#281168
07/25/09 18:31
07/25/09 18:31
|
Joined: Feb 2009
Posts: 3,207 Germany, Magdeburg
Rei_Ayanami
OP
Expert
|
OP
Expert
Joined: Feb 2009
Posts: 3,207
Germany, Magdeburg
|
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:
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);
}
Last edited by Rei_Ayanami; 07/25/09 18:31.
|
|
|
Re: Bullet doesen´t remove
[Re: Rei_Ayanami]
#281171
07/25/09 18:37
07/25/09 18:37
|
Joined: Sep 2006
Posts: 99 BS, Germany
Storm_Mortis
Junior Member
|
Junior Member
Joined: Sep 2006
Posts: 99
BS, Germany
|
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^^
it found a voice ... now it needs a body
|
|
|
|