Renegade Public Forums
C&C: Renegade --> Dying since 2003™, resurrected in 2024!
Home » Renegade Discussions » Mod Forum » attack script ai
attack script ai [message #466482] Sun, 22 April 2012 15:39 Go to next message
robbyke is currently offline  robbyke
Messages: 348
Registered: September 2010
Location: Belgium
Karma: 0
Recruit
i suppose this piece of code would get my defence to keep firing forward but it wont even execute the first attack

void KB_AI_Rep_Turret::Created(GameObject *obj)
{
	float Facing = Commands->Get_Facing(obj);
	Vector3 PosTar = Commands->Get_Position(obj);
	PosTar.Z += 2.0f;
	PosTar.X += static_cast<float>(10*cos(Facing*(PI/180)));
	PosTar.Y += static_cast<float>(10*sin(Facing*(PI/180)));
	Target = Commands->Create_Object("Invisible_Object",PosTar);
	ActionParamsStruct params;
	Vector3 pos;
	params.Set_Basic(this,100,1);
	params.Set_Face_Location(Commands->Get_Position(Target),Commands->Get_Facing(Target),1.0f);
	Commands->Action_Face_Location(Target,params);
}

void KB_AI_Rep_Turret::Action_Complete(GameObject *obj,int action_id,ActionCompleteReason complete_reason)
{
	if (action_id == 1)
	{
		ActionParamsStruct params;
		Vector3 pos;
		params.Set_Basic(this,100,2);
		params.Set_Attack(Target,40,0,true);
		params.AttackCheckBlocked = false;
		Commands->Action_Attack(Target,params);
	}
}


ive checked at JFW_Engineer_Repair but it seems to be the same what do i miss?


Owner of kambot TT server

kambot.freeforums.org
Re: attack script ai [message #466500 is a reply to message #466482] Sun, 22 April 2012 22:07 Go to previous messageGo to next message
E! is currently offline  E!
Messages: 70
Registered: February 2004
Karma: 0
Recruit
have u checked if your Action_Face_Location is ever completed?
if so i would recommend you to try to do an Action_Reset before calling the new Action.
+ i think you need at least those in your Created case to make vehicles work with that script:
Commands->Enable_Enemy_Seen(obj,true);//Just in case you want to work with Enemy_Seen case
Commands->Innate_Enable(obj);
Commands->Enable_Vehicle_Transitions(obj,false);


<<SCUD-Storm Origin Creator>>
Re: attack script ai [message #466507 is a reply to message #466482] Mon, 23 April 2012 01:03 Go to previous message
robbyke is currently offline  robbyke
Messages: 348
Registered: September 2010
Location: Belgium
Karma: 0
Recruit
the facing never starts Sad

i dont want to use enemy seen so i didnt activate it i just wanted to make a turret that keeps firing (a rep gun) in the same direction

and these 2 lines didnt change anything after ive put them in

Commands->Innate_Enable(obj);
Commands->Enable_Vehicle_Transitions(obj,false);

Found my mistake action should be performed by my obj not my target how fckn dumb:(


Owner of kambot TT server

kambot.freeforums.org

[Updated on: Mon, 23 April 2012 02:55]

Report message to a moderator

Previous Topic: cant get animations to work
Next Topic: create a building
Goto Forum:
  


Current Time: Sun Oct 06 16:18:25 MST 2024

Total time taken to generate the page: 0.00668 seconds