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 2 of 2 1 2
Re: poison dart help!!!!! [Re: badapple] #327913
06/09/10 09:49
06/09/10 09:49
Joined: Jan 2006
Posts: 2,157
Connecticut, USA
Blink Offline OP

Expert
Blink  Offline OP

Expert

Joined: Jan 2006
Posts: 2,157
Connecticut, USA
greetings Bad, i like that idea, but as usual, i have no idea how to implement that. an example will be helpful if you dont mind. i was going to change the temp in vec to angle to bounce, but i didnt think that would work.


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] #327923
06/09/10 10:59
06/09/10 10:59
Joined: Dec 2005
Posts: 116
T
tD_Datura_v Offline
Member
tD_Datura_v  Offline
Member
T

Joined: Dec 2005
Posts: 116
The following is a mutilated derivative of the code posted at the beginning of this thread.
It is an incomplete example which MAY be used to help determine what, or what not to do.
The snippet was tested and seemingly working with A6.60 + A6Templates.
*Turret / statue shoots and damages A6T biped player -> CHECK
*Model blocks shots from turret to A6T biped player -> CHECK
*Some non-essential improvements attempted -> CHECK
*Some flaws (re)introduced -> CHECK
Code:
/****************
	snippet from _helpy.wdl
	(c)opyright dummy collective
	may only be used without permission
****************/
DEFINE _range, skill1;
DEFINE _sightangle, skill2;
DEFINE _hitEntity, skill99;
ENTITY* eHit;

function destroy_turret();
function move_bullet();
function remove_bullet();

var bullet_speed[3];

sound explode_snd = "boom.wav";
sound dart_snd = <poisondart.wav>;

string bullet_mdl = <dart.mdl>;
entity* plBiped01_entity; 

action dartwall {
	wait(1);
	c_setminmax(me);
}

action dartstatue {
	wait(1);
	c_setminmax(me);

	if (my._range == 0) { my._range = 1000; } // set the range with skill1, default = 1000 quants
	if (my._sightangle == 0) {my._sightangle = 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) {
	
		if (vec_dist (my.x, plBiped01_entity.x) < my._range) {
			vec_diff(temp, plBiped01_entity.x, my.x);
			vec_to_angle(temp, temp);
			if (abs(ang(temp.pan - my.pan)) <= abs(my._sightangle) / 2) {
				// turn the turret toward the player
				vec_set(my.pan, temp);
				// try to create the dart outside of the turret bounding box
				temp.x = my.max_x * 1.25;		// <- IMPORTANTE
				temp.y = 0;
				temp.z = 0;
				vec_rotate(temp, my.pan);
				vec_add(temp, my.x);
				ent_create (bullet_mdl, temp, move_bullet);
				snd_play (dart_snd, 30, 0);
			}
		}
		wait(-0.5); // 1 bullet every 0.5 seconds
	}
}

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);
	c_setminmax(me);
	my.enable_entity = on;
	my.enable_block = on;
	my.event = remove_bullet;
	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;
	while (me != null) {
		//if (you == null) { break; }	// you is the turret
		if (my._hitEntity != 0) { break; }
		c_move (me, vector(bullet_speed.x * time_step, 0, 0), nullvector, IGNORE_PASSABLE);
		wait (1);
	}
	if (my._hitEntity != -1) {
		eHit = ptr_for_handle(my._hitEntity);
		if (eHit == plBiped01_entity) {
			eHit._armor__003 -= 2; // decrease player's health
			if(eHit._armor__003 < 0) {
				// flesh damage after armor damage
				eHit._health__003 += eHit._armor__003;
				eHit._armor__003 = 0;
				PlBiped_Damage_Reaction(); // display damage panel
			}
		}
	}
	if (me != NULL) {
		ent_remove(me);
	}
}

function remove_bullet() {
	my._hitEntity = -1;	// hit block
	if (you != NULL) {
		my._hitEntity = handle(you);
	}
	my.event = NULL;
}







Re: poison dart help!!!!! [Re: tD_Datura_v] #328016
06/09/10 22:16
06/09/10 22:16
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 tD, i will give it a try. i think it might be possible to make to wall move by way of a trigger to block the darts from hitting the player, keeping him alive.

update...it works perfectly!!! thanks t_d.

Last edited by Blink; 06/09/10 23:25. Reason: resolved

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."
Page 2 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