Gamestudio Links
Zorro Links
Newest Posts
Help with plotting multiple ZigZag
by degenerate_762. 04/30/24 23:23
M1 Oversampling
by 11honza11. 04/30/24 08:16
Trading Journey
by howardR. 04/28/24 09:55
Zorro Trader GPT
by TipmyPip. 04/27/24 13:50
Data from CSV not parsed correctly
by jcl. 04/26/24 11:18
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (AndrewAMD, SBGuy), 987 guests, and 3 spiders.
Key: Admin, Global Mod, Mod
Newest Members
firatv, wandaluciaia, Mega_Rod, EternallyCurious, howardR
19050 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 2 1 2
poison dart help!!!!! #327292
06/05/10 18:02
06/05/10 18:02
Joined: Jan 2006
Posts: 2,157
Connecticut, USA
Blink Offline OP

Expert
Blink  Offline 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.

Code:
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 Offline OP

Expert
Blink  Offline 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
T
tD_Datura_v Offline
Member
tD_Datura_v  Offline
Member
T

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: tD_Datura_v] #327607
06/07/10 15:50
06/07/10 15:50
Joined: Aug 2007
Posts: 1,922
Schweiz
Widi Offline
Serious User
Widi  Offline
Serious User

Joined: Aug 2007
Posts: 1,922
Schweiz
@tD-Datura: this is the WDL section and Blink use also wdl code and not lite-c. There is no c_move, so ent_move is right.

Re: poison dart help!!!!! [Re: Blink] #327631
06/07/10 17:17
06/07/10 17:17
Joined: Sep 2003
Posts: 5,900
Bielefeld, Germany
Pappenheimer Offline
Senior Expert
Pappenheimer  Offline
Senior Expert

Joined: Sep 2003
Posts: 5,900
Bielefeld, Germany
@Blink:
Maybe, you can use a map entity as shield, and then add something like

if(IN_SOLID){ent_remove(me);}

or

if(EVENT == EVENT_BOUNCE){ent_remove(me);}

right in the beginning of the function.
You have to look into the manual of your version of A6 for the proper terms, because I don't remember them right now.

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 Offline OP

Expert
Blink  Offline 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: Blink] #327714
06/08/10 02:10
06/08/10 02:10
Joined: Sep 2003
Posts: 5,900
Bielefeld, Germany
Pappenheimer Offline
Senior Expert
Pappenheimer  Offline
Senior Expert

Joined: Sep 2003
Posts: 5,900
Bielefeld, Germany
In:
function remove_bullet()
{
if(EVENT == EVENT_BLOCK){ent_remove(me);}Take EVENT_BLOCK instead of EVENT_BOUNCE (not sure if EVENT_BOUNCE even exists, sorry)
...

Or in the while loop of function move_bullet():

if(IN_SOLID){ent_remove(me);}

Sorry, my former answer was a bit unspecific.

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 Offline OP

Expert
Blink  Offline 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 Offline OP

Expert
Blink  Offline 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."
Re: poison dart help!!!!! [Re: Blink] #327885
06/09/10 04:08
06/09/10 04:08
Joined: Apr 2006
Posts: 624
DEEP 13
badapple Offline
User
badapple  Offline
User

Joined: Apr 2006
Posts: 624
DEEP 13
you could always create a global variable , we'll call it "blocked" and set it to zero

inside its event function it could check whether blocked is true or not when it hits , if blocked is true , dont cause poison damage and remove , maybe play a deflecting sound or something

else damage normally , know what i mean

Page 1 of 2 1 2

Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1