Page 1 of 1

Score based on killing bad guys:

PostPosted: Sun May 06, 2007 2:23 am
by d-soldier
My problem is that as badguys (who don't get killed by the player) are destroyed offscreen, and as the score is increased in their destory actor event, are increasing the score from offscreen... so how can I script something to determine weather or not the actors are destroyed by the player (and then to increase the score) versus destroyed off screen (and to not add points)... Is there an easy way?

PostPosted: Sun May 06, 2007 4:20 am
by Sgt. Sparky
make a variable called Killed(actor variable)
on the out of vision event-> script editor,
Code: Select all
Killed = 1;

when they are destroyed use this
Code: Select all
if(Killed == 0) {
other code here;
                     }

:D
I hope that helps.

so

PostPosted: Sun May 06, 2007 3:26 pm
by d-soldier
Thats seems so easy... the problem is that since the enemies are off screen before they show up, I actually have a filled region to catch them, rather then an off screen script... so I made it the badguy's collide with killzone(region)script instead... But how does it know to kill him based on "Killed=1" if only "Killed=0" is defined in the destroy actor event? Do I need something like:?

if(Killed == 0) {
CreateActor("dead_mig_l", "mig_fall_00000", "(none)", "(none)", 0, 0, false);;
CreateActor("smoke1", "smoke1_00000", "(none)", "(none)", 0, 0, false);
CreateActor("debris2", "debris2_000000", "(none)", "(none)", 0, 40, false);
CreateActor("score_25", "score_25_01", "(none)", "(none)", 0, 0, false);
}
if(Killed == 1) {
DestroyActor("Event Actor");
}

Thanks for being so helpful as always Sparky!

Re: so

PostPosted: Mon May 07, 2007 12:58 am
by Sgt. Sparky
d-soldier wrote:Do I need something like:?

if(Killed == 0) {
CreateActor("dead_mig_l", "mig_fall_00000", "(none)", "(none)", 0, 0, false);;
CreateActor("smoke1", "smoke1_00000", "(none)", "(none)", 0, 0, false);
CreateActor("debris2", "debris2_000000", "(none)", "(none)", 0, 40, false);
CreateActor("score_25", "score_25_01", "(none)", "(none)", 0, 0, false);
}
if(Killed == 1) {
DestroyActor("Event Actor");
}


Yes. :D
and for collision detection with using a filled region:
make a variable called in.
on collision,
Code: Select all
in = 1;

collision finish,
Code: Select all
in = 0;

:D
and when the player kills him,
Code: Select all
if(in == 0)kill = 1;
else kill = 0;