Gamestudio Links
Zorro Links
Newest Posts
Zorro 2.70
by jcl. 09/29/25 09:24
optimize global parameters SOLVED
by dBc. 09/27/25 17:07
ZorroGPT
by TipmyPip. 09/27/25 10:05
assetHistory one candle shift
by jcl. 09/21/25 11:36
Plugins update
by Grant. 09/17/25 16:28
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
3 registered members (TipmyPip, AndrewAMD, NewbieZorro), 16,055 guests, and 7 spiders.
Key: Admin, Global Mod, Mod
Newest Members
krishna, DrissB, James168, Ed_Love, xtns
19168 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
c_move collision other entity pointer? #308964
02/06/10 04:51
02/06/10 04:51
Joined: Jan 2010
Posts: 40
Adelaide, Australia
Sub_Game Offline OP
Newbie
Sub_Game  Offline OP
Newbie

Joined: Jan 2010
Posts: 40
Adelaide, Australia
My weapons are moving and colliding with entities and remove themselves but I can't seem to make them remove the entity that has been struck.

This is my latest attempt, code from the weapon action:
Code:
if(HIT_TARGET && run_time > 1 )
{
  if(c_scan(my.x, my.pan, vector(360, 360, 10), SCAN_ENTS | IGNORE_PASSABLE | IGNORE_WORLD | IGNORE_ME)!=0)
    ent_remove(you);
			
  ent_remove(me);

  return;
}


Is this a good way of getting the pointer to the other entity?


This shows 4 weapons moving towards the target sub in foreground. When the weapons collide they are removed but the target sub is not.

Any help would be appreciated.


A7 Commercial
First person submarine combat simulator project
http://alexanderforeman.webs.com/fightersubgame.htm
Re: c_move collision other entity pointer? [Re: Sub_Game] #308969
02/06/10 06:40
02/06/10 06:40
Joined: Jan 2010
Posts: 40
Adelaide, Australia
Sub_Game Offline OP
Newbie
Sub_Game  Offline OP
Newbie

Joined: Jan 2010
Posts: 40
Adelaide, Australia
OK - I've managed to get this working with:

Code:
function unit_hit()
{
  if(you.UNIT_TYPE == UNIT_TYPE_TORPEDO) my.STATE = UNITSTATE_HIT;
}

action unit_action()
{ my.event = unit_hit;
  my.emask |= ENABLE_IMPACT; //you = other object pointer

  while(1)
  { 	move_friction=0;
        unit_physics(act_unit);
  	c_move(my, vector(unit_data[act_unit][UNIT_DATA_SPEED]*time_step,0,0), vector(unit_data[act_unit][UNIT_DATA_X_FORCE]*time_step,unit_data[act_unit][UNIT_DATA_Y_FORCE]*time_step,unit_data[act_unit][UNIT_DATA_Z_FORCE]*time_step), IGNORE_PASSABLE | GLIDE);
  	
  	//sink the sub
  	if(my.STATE == UNITSTATE_HIT)
  	{
		//my.STATE = UNITSTATE_NORMAL;
		unit_data[act_unit][UNIT_DATA_Z_FORCE]-=time_step;
		unit_data[act_unit][UNIT_DATA_POWER] = 0;
			
			
	}
  		
  	wait(1);	
}




A7 Commercial
First person submarine combat simulator project
http://alexanderforeman.webs.com/fightersubgame.htm

Moderated by  HeelX, Spirit 

Gamestudio download | 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