2 registered members (AndrewAMD, SBGuy),
987
guests, and 3
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
poison dart help!!!!!
#327292
06/05/10 18:02
06/05/10 18:02
|
Joined: Jan 2006
Posts: 2,157 Connecticut, USA
Blink
OP
Expert
|
OP
Expert
Joined: Jan 2006
Posts: 2,157
Connecticut, USA
|
Hello all, I have a poison dart code, modified from a turret code that George created in an old AUM. I modified it so it will hurt the A6 plBiped template player, but my problem is, I want to be able to block it with another model, so it cant kill me. this is an education/adventure project for my students. my player has to solve a math problem and hit the right numbered trigger. i want it to trigger a shield or wall to move in front of the poison dart statue, no prevent it from "killing" the player. can anyone help? my problem here with this code is, how to stop the darts from going through the model in its way.
function destroy_turret();
function move_bullet();
function remove_bullet();
//////////////////////////////////////////////////////////////
var bullet_speed;
//////////////////////////////////////////////////////////////
sound explode_snd = "boom.wav";
sound dart_snd = <poisondart.wav>;
//////////////////////////////////////////////////////////////
string bullet_mdl = <dart.mdl>;
entity* plBiped01_entity;
//////////////////////////////////////////////////////////////
action dartstatue
{
if (my.skill1 == 0) {my.skill1 = 500;} // set the range with skill1, default = 1000 quants
if (my.skill2 == 0) {my.skill2 = 180;} // default viewing angle in front of the turret = 180
my.enable_impact = on;
my.event = destroy_turret;
while (plBiped01_entity == null) {wait (1);}
while (my != null && plBiped01_entity != null)
{
my.skill10 = abs(ang(plBiped01_entity.pan) - ang(my.pan));
if (vec_dist (my.x, plBiped01_entity.x) < my.skill1)
{
if ((my.skill10 > 180 - my.skill2 / 2) && (my.skill10 < 180 + my.skill2 / 2))
{
vec_set (temp.x, plBiped01_entity.x);
vec_sub (temp.x, my.x);
vec_to_angle (my.pan, temp);
ent_create (bullet_mdl, my.pos, move_bullet);
snd_play (dart_snd, 30, 0);
}
}
wait (8); // fires 2 bullets a second
}
}
function destroy_turret()
{
wait (1);
if (you == plBiped01_entity) {return;} // can't be destroyed by running into it
snd_play (explode_snd, 70, 0);
ent_remove (me);
}
function move_bullet()
{
wait (1);
my.enable_entity = on;
my.enable_block = on;
my.event = remove_bullet;
my.passable = on;
my.pan = you.pan;
my.lightred = 250;
my.lightgreen = 150;
my.lightrange = 200;
bullet_speed.x = 100;
bullet_speed.y = 0;
bullet_speed.z = 0;
bullet_speed *= time_step;
while (my != null)
{
if (you == null) {return;}
if (vec_dist (my.x, you.x) < 100) // don't collide with the turret
{
my.passable = on;
}
else
{
my.passable = off;
}
ent_move (bullet_speed, nullvector);
wait (1);
}
}
function remove_bullet()
{
wait (1);
if (you == plBiped01_entity) {
plBiped01_entity = you;
plBiped01_entity._armor__003 -= 2; // decrease player's health
if(you._armor__003 < 0)
{
// flesh damage after armor damage
you._health__003 += you._armor__003;
you._armor__003 = 0;
PlBiped_Damage_Reaction(); // display damage panel
wait(-1);
}
}
ent_remove (me);
}
//////////////////////////////////////////////////////////////////////////////////////
My Famous Quotes: "Hip hop is like a virus, infecting everyone and everything around it. Every form of media has some way,shape or form, assimilated hip hop into it." It has also mutated into other strains like, trip hop, house, rap, gangster, and conscious forms. Once you are infected with it, its with you for life."
|
|
|
Re: poison dart help!!!!!
[Re: Blink]
#327463
06/06/10 14:34
06/06/10 14:34
|
Joined: Jan 2006
Posts: 2,157 Connecticut, USA
Blink
OP
Expert
|
OP
Expert
Joined: Jan 2006
Posts: 2,157
Connecticut, USA
|
is there something i can add to my script that will prevent the darts from getting past the model? thats all i need to know.
My Famous Quotes: "Hip hop is like a virus, infecting everyone and everything around it. Every form of media has some way,shape or form, assimilated hip hop into it." It has also mutated into other strains like, trip hop, house, rap, gangster, and conscious forms. Once you are infected with it, its with you for life."
|
|
|
Re: poison dart help!!!!!
[Re: Blink]
#327597
06/07/10 14:47
06/07/10 14:47
|
Joined: Dec 2005
Posts: 116
tD_Datura_v
Member
|
Member
Joined: Dec 2005
Posts: 116
|
At a first glance... It looks like the turret and poison dart use ent_move, not c_move, and the dart is PASSABLE when near the turret.
*try using c_move instead with POLYGON flag ON or proper bounding box settings for the obstacle wall? *keep the obstacle wall and the player some distance from the turret? *change the distance the poison dart is PASSABLE when fired (maybe use turret.max_x * 1.05 instead of 100)?
|
|
|
Re: poison dart help!!!!!
[Re: Pappenheimer]
#327689
06/07/10 21:17
06/07/10 21:17
|
Joined: Jan 2006
Posts: 2,157 Connecticut, USA
Blink
OP
Expert
|
OP
Expert
Joined: Jan 2006
Posts: 2,157
Connecticut, USA
|
@pappenheimer, so, in my move bullet function add if(EVENT == EVENT_BOUNCE){ent_remove(me);}?
My Famous Quotes: "Hip hop is like a virus, infecting everyone and everything around it. Every form of media has some way,shape or form, assimilated hip hop into it." It has also mutated into other strains like, trip hop, house, rap, gangster, and conscious forms. Once you are infected with it, its with you for life."
|
|
|
Re: poison dart help!!!!!
[Re: Pappenheimer]
#327716
06/08/10 02:27
06/08/10 02:27
|
Joined: Jan 2006
Posts: 2,157 Connecticut, USA
Blink
OP
Expert
|
OP
Expert
Joined: Jan 2006
Posts: 2,157
Connecticut, USA
|
Thanks, i will give it a try tommorow. off to bed.
My Famous Quotes: "Hip hop is like a virus, infecting everyone and everything around it. Every form of media has some way,shape or form, assimilated hip hop into it." It has also mutated into other strains like, trip hop, house, rap, gangster, and conscious forms. Once you are infected with it, its with you for life."
|
|
|
Re: poison dart help!!!!!
[Re: Blink]
#327867
06/08/10 22:19
06/08/10 22:19
|
Joined: Jan 2006
Posts: 2,157 Connecticut, USA
Blink
OP
Expert
|
OP
Expert
Joined: Jan 2006
Posts: 2,157
Connecticut, USA
|
well, it didnt work, the darts still penetrate the shield and kills the player. any other ideas?
My Famous Quotes: "Hip hop is like a virus, infecting everyone and everything around it. Every form of media has some way,shape or form, assimilated hip hop into it." It has also mutated into other strains like, trip hop, house, rap, gangster, and conscious forms. Once you are infected with it, its with you for life."
|
|
|
|