defenses fire at each other [message #466586] |
Tue, 24 April 2012 16:27 |
robbyke
Messages: 348 Registered: September 2010 Location: Belgium
Karma: 0
|
Recruit |
|
|
i remade JFW_Base_Defence
and i works perfect however (using a guardtower and a turret) i added that it shouldnt attack if their target has no moveable physics.
but stil the guardtower and turret attack eachother
the code wich i forgot :
Toggle Spoiler
void KB_Base_Defence::Enemy_Seen(GameObject *obj,GameObject *enemy)
{
if(!Is_Script_Attached(enemy,"KB_Friendly_Zone_Generated") && Commands->Is_A_Star(enemy)||Is_Harvester(enemy))
{
bool attack = true;
GameObject *o = Get_Vehicle(enemy);
if (o)
{
enemy = o;
}
if(Is_Vehicle(enemy))
{
MoveablePhysClass* moveable = enemy->As_PhysicalGameObj()->Peek_Physical_Object()->As_MoveablePhysClass();
if(!moveable)
{
attack = false;
}
}
if(attack)
{
ActionParamsStruct params;
Vector3 pos,pos2;
float distance;
float minattack,maxattack;
float attacktimer;
pos = Commands->Get_Position(obj);
pos2 = Commands->Get_Position(enemy);
distance = Commands->Get_Distance(pos2,pos);
minattack = Get_Float_Parameter("MinAttackDistance");
if (distance >= minattack)
{
maxattack = Get_Float_Parameter("MaxAttackDistance");
params.Set_Basic(this,100,2);
params.Set_Attack(enemy,maxattack,0.0,true);
params.AttackCheckBlocked = false;
params.AttackForceFire = true;
Commands->Action_Attack(obj,params);
attacktimer = Get_Float_Parameter("AttackTimer");
Commands->Start_Timer(obj,this,attacktimer,2);
}
}
}
}
Owner of kambot TT server
kambot.freeforums.org
[Updated on: Wed, 25 April 2012 00:50] Report message to a moderator
|
|
|
|
|
|
|
Re: defenses fire at each other [message #466611 is a reply to message #466586] |
Wed, 25 April 2012 03:46 |
|
actually, no, I suspect the objects in question have physics of type DecorationPhys which means they dont move.
Jonathan Wilson aka Jonwil
Creator and Lead Coder of the Custom scripts.dll
Renegade Engine Guru
Creator and Lead Coder of TT.DLL
Official member of Tiberian Technologies
|
|
|
|
Re: defenses fire at each other [message #466614 is a reply to message #466586] |
Wed, 25 April 2012 05:04 |
|
Nope, vehicles dont have to be moveable physics.
The rule is (at least after various fixes made in 4.0) that if you can select it from the physics type dropdown, it can be used.
So soldiers can only use HumanPhys (for example)
Jonathan Wilson aka Jonwil
Creator and Lead Coder of the Custom scripts.dll
Renegade Engine Guru
Creator and Lead Coder of TT.DLL
Official member of Tiberian Technologies
|
|
|
|
Re: defenses fire at each other [message #466628 is a reply to message #466611] |
Wed, 25 April 2012 07:21 |
robbyke
Messages: 348 Registered: September 2010 Location: Belgium
Karma: 0
|
Recruit |
|
|
danpaul88 wrote on Wed, 25 April 2012 12:43 | Well that's hardly surprising since guard towers and turrets are actually vehicles (albeit stationary) and thus DO have movable physics
|
jonwil wrote on Wed, 25 April 2012 12:46 | actually, no, I suspect the objects in question have physics of type DecorationPhys which means they dont move.
|
leveledit states they are decorationphys,
i just wonder now though how can i test if the target is a stationary defence?
Owner of kambot TT server
kambot.freeforums.org
|
|
|
Re: defenses fire at each other [message #466629 is a reply to message #466586] |
Wed, 25 April 2012 07:27 |
|
Try
if (Get_Vehicle_Mode(obj) == VEHICLE_TYPE_TURRET)
{
//blah
}
You will need to #include "VehicleGameObjDef.h"
Jonathan Wilson aka Jonwil
Creator and Lead Coder of the Custom scripts.dll
Renegade Engine Guru
Creator and Lead Coder of TT.DLL
Official member of Tiberian Technologies
|
|
|
|
|
Re: defenses fire at each other [message #466697 is a reply to message #466586] |
Thu, 26 April 2012 08:42 |
robbyke
Messages: 348 Registered: September 2010 Location: Belgium
Karma: 0
|
Recruit |
|
|
i thought about scripts already present ar first to but i removed all present scripts on the objects.
i dont get what you mean with the third one
Owner of kambot TT server
kambot.freeforums.org
|
|
|
Re: defenses fire at each other [message #466780 is a reply to message #466697] |
Fri, 27 April 2012 21:19 |
|
Jerad2142
Messages: 3812 Registered: July 2006 Location: USA
Karma: 6
|
General (3 Stars) |
|
|
I have my scripts export directly to ren's folder on compile, as a result there are times where another program will be using scripts (Level editor or game.exe) which prevents the update from compiling and thus to last compiled version remains.
I'm only tossing these ideas out because I don't see any other reason why the turrets would keep attacking each other.
Visit Jerad's deer sweat shop
|
|
|