Gamestudio Links
Zorro Links
Newest Posts
Newbie Questions
by fairtrader. 12/06/23 11:29
Zorro Trader GPT
by TipmyPip. 12/04/23 11:34
Square root rule
by Smallz. 12/02/23 09:15
RTest not found error
by TipmyPip. 12/01/23 21:43
neural function for Python to [Train]
by TipmyPip. 12/01/23 14:47
Xor Memory Problem.
by TipmyPip. 11/28/23 14:23
Training with command line parameters
by TipmyPip. 11/26/23 08:42
Combine USD & BTC Pairs In Asset Loop
by TipmyPip. 11/26/23 08:30
AUM Magazine
Latest Screens
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Tactics of World War I
Who's Online Now
7 registered members (3run, miwok, AndrewAMD, Quad, TipmyPip, fairtrader, 1 invisible), 637 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
fairtrader, hus, Vurtis, Harry5, KelvinC
19019 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 2 of 2 1 2
Re: Lenkrakete - wie steuern? | Homing Missile - How to contoll? [Re: EvilSOB] #292719
10/06/09 11:22
10/06/09 11:22
Joined: Mar 2008
Posts: 2,247
Baden Württemberg, Germany
Espér Offline
Expert
Espér  Offline
Expert

Joined: Mar 2008
Posts: 2,247
Baden Württemberg, Germany
Skill1 = below 10 means rocket is alive. Above means the rocket has been exploded.
Skill2 & 4 = Distances
Skill3 = "See" Range of the rocket.


Selling my Acknex Engine Editions (A7 Com & A8 Pro):
>> click here if you are interested <<
Re: Lenkrakete - wie steuern? | Homing Missile - How to contoll? [Re: Espér] #292727
10/06/09 12:35
10/06/09 12:35
Joined: Feb 2008
Posts: 3,232
Australia
EvilSOB Offline
Expert
EvilSOB  Offline
Expert

Joined: Feb 2008
Posts: 3,232
Australia
Give this a try and see how it feels
Code:
function rocket_event() 
{	if (event_type == EVENT_DETECT)		//event runs once for every Entity within range.
	{	if((you.skill99>=5)&&(you.healthpoints>0))	//if THIS scan-target(you) is enemy & "alive"
		{	//check if target is set yet. "parent" property of ME is the existing target
			if(!me.parent)		me.parent = you;	//no target yet, so set it to THIS
			//check if THIS target is closer than the existing closest target
			if(vec_dist(me.x, your.x)<vec_dist(me.x, me.parent.x))	me.parent = you;
	}	}
	else if(event_type == EVENT_ENTITY)	//rocket hit something
	{	me.skill1 = 10;		}	//explode !!!	
}
//
//
action my_rocket()
{	//tweakables
	my.skill1 = 1;		// below 10 means rocket is alive. Above means the rocket has been exploded.
	my.skill2 = 0;		// ??? distance
	my.skill3 = 500;	// "See" Range of the rocket in quants.
	my.skill4 = 0;		// ??? distance
	my.skill5 = 50;		// rockets speed in quants-per-second
	/////////////////////////////////////////////////////////////////////////////////////
	my.emask |= ENABLE_DETECT|ENABLE_ENTITY;
	my.event = rocket_event;
	while(my.skill1<10)
	{	//find nearest living target
		my.parent = NULL;	
		c_scan(my.x, nullvector, vector(360,360,my.skill3), SCAN_ENTS|IGNORE_ME);
		//turn towards current target
		if(my.parent)
		{	vec_set(target, my.parent.x); 	
			vec_to_angle(my.pan, vec_sub(target, my.x));
			//OPTIONAL/DEBUGGING :: draw tracer to target
				draw_line3d(my.x,0,0);	draw_line3d(my.x,vector(0,0,255),50);	
				draw_line3d(my.parent.x,vector(0,0,255),50);
		}
		//move towards target
//		c_move(me, vector(my.skill5*time_step,0,0), NULL, IGNORE_PASSABLE);
		//
		wait(1);
	}
	//target reached
	/////////////////////////////////////////////////////////////////////////////////////
	// TODO: Sound-effect
	// TODO: Damage things. Hit object is pointed to by pointer YOU
	// TODO: BUT, if YOU is null, then hit terrain or block at "target.x, .y, .z"
	ent_remove(me);
}



Last edited by EvilSOB; 10/06/09 12:58. Reason: added tracer beam for de-bugging

"There is no fate but what WE make." - CEO Cyberdyne Systems Corp.
A8.30.5 Commercial
Re: Lenkrakete - wie steuern? | Homing Missile - How to contoll? [Re: EvilSOB] #292759
10/06/09 17:47
10/06/09 17:47
Joined: Mar 2008
Posts: 2,247
Baden Württemberg, Germany
Espér Offline
Expert
Espér  Offline
Expert

Joined: Mar 2008
Posts: 2,247
Baden Württemberg, Germany
hmm. ok.. no more error.. but the rockets just fly to the right o.O


EDIT:

FIXED IT!!

Thx.. works great.. just forget an if in the enemy code.. -.- *stupid mistake*

Last edited by Espér; 10/06/09 18:56.

Selling my Acknex Engine Editions (A7 Com & A8 Pro):
>> click here if you are interested <<
Re: Lenkrakete - wie steuern? | Homing Missile - How to contoll? [Re: Espér] #292800
10/07/09 07:01
10/07/09 07:01
Joined: Feb 2008
Posts: 3,232
Australia
EvilSOB Offline
Expert
EvilSOB  Offline
Expert

Joined: Feb 2008
Posts: 3,232
Australia
hehe...


"There is no fate but what WE make." - CEO Cyberdyne Systems Corp.
A8.30.5 Commercial
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