diff -uwrN sourceold/scripts/DBIKScripts.cpp source/scripts/DBIKScripts.cpp --- sourceold/scripts/DBIKScripts.cpp 2017-02-16 06:25:31.818200800 +1000 +++ source/scripts/DBIKScripts.cpp 2017-02-23 07:15:45.851601800 +1000 @@ -127,16 +127,13 @@ void DB_Guard_Bot::Created(GameObject *obj) { + if(obj->As_SoldierGameObj()) + { + Attach_Script_Once(obj,"DB_Innate_Soldier","0.5,70,0,0"); HomePosition = Commands->Get_Position(obj); Commands->Set_Innate_Soldier_Home_Location(obj,HomePosition,70); - /* Commands->Innate_Soldier_Enable_Footsteps_Heard(obj,false); Commands->Innate_Soldier_Enable_Gunshot_Heard(obj,false); - Commands->Innate_Soldier_Enable_Bullet_Heard(obj,false); - */ - if(obj->As_SoldierGameObj()) - { - Attach_Script_Once(obj,"DB_Innate_Soldier","0.5,70,0,0"); Commands->Start_Timer(obj,this,Commands->Get_Random(0,10),87); Set_Current_Clip_Bullets(obj,-1); } @@ -213,10 +210,17 @@ void DB_Support_Bot::Created(GameObject *obj) { + if(!obj->As_SoldierGameObj()) + { + Destroy_Script(); + return; + } followid=0; + distance = Get_Float_Parameter("Distance"); + speed = Get_Float_Parameter("Speed"); Attach_Script_Once(obj,"DB_Innate_Soldier","0.5,0,0,0"); Commands->Enable_HUD_Pokable_Indicator(obj,1); - Commands->Start_Timer(obj,this,5.0f,1); + Commands->Start_Timer(obj,this,4.0f,1); } void DB_Support_Bot::Damaged(GameObject *obj,GameObject *damager,float amount) @@ -233,11 +237,7 @@ void DB_Support_Bot::Poked(GameObject *obj,GameObject *poker) { ActionParamsStruct actionThingy; - float d; - float s; actionThingy.Set_Basic(this,70,1); - d = Get_Float_Parameter("Distance"); - s = Get_Float_Parameter("Speed"); if (Commands->Get_Player_Type(obj) == Commands->Get_Player_Type(poker)) { if(followid==poker->Get_ID()) @@ -249,9 +249,6 @@ else { followid=poker->Get_ID(); - actionThingy.Set_Movement(poker,s,d); - actionThingy.MoveFollow = true; - Commands->Action_Goto(obj,actionThingy); Send_Message_Player(poker,255,255,255,"This bot will now follow you."); } } @@ -264,19 +261,20 @@ GameObject *follow = Commands->Find_Object(followid); if(follow) { - ActionParamsStruct actionThingy; - float d; - float s; - actionThingy.Set_Basic(this,70,1); - d = Get_Float_Parameter("Distance"); - s = Get_Float_Parameter("Speed"); - actionThingy.Set_Movement(follow,s,d); - actionThingy.MoveFollow = true; - Commands->Action_Goto(obj,actionThingy); + if(obj && !obj->As_SoldierGameObj()->Is_On_Ladder() && !obj->As_SoldierGameObj()->Is_In_Elevator()) + { + if(Commands->Get_Distance(Commands->Get_Position(obj),Commands->Get_Position(follow)) > distance * 1.5f) + { + ActionParamsStruct action; + action.Set_Basic(this,70,1); + action.Set_Movement(follow,speed,distance); + Commands->Action_Goto(obj,action); + } + } } else followid = 0; - Commands->Start_Timer(obj,this,5.0f,1); + Commands->Start_Timer(obj,this,4.0f,1); } } diff -uwrN sourceold/scripts/DBIKScripts.h source/scripts/DBIKScripts.h --- sourceold/scripts/DBIKScripts.h 2017-01-15 08:11:46.740802600 +1000 +++ source/scripts/DBIKScripts.h 2017-02-23 07:15:45.321201800 +1000 @@ -31,6 +31,8 @@ class DB_Support_Bot : public ScriptImpClass { int followid; + float distance; + float speed; void Created(GameObject *obj); void Damaged(GameObject *obj,GameObject *damager,float amount); void Poked(GameObject *obj,GameObject *poker); diff -uwrN sourceold/scripts/DBScripts.cpp source/scripts/DBScripts.cpp --- sourceold/scripts/DBScripts.cpp 2017-01-22 19:56:58.286626000 +1000 +++ source/scripts/DBScripts.cpp 2017-02-24 07:50:26.465001400 +1000 @@ -51,7 +51,7 @@ Upgraded=true; } - if(Commands->Get_Player_Type(obj)!=-2) + if(Get_Object_Type(obj)!=-2) { Attach_Script_Once_V(obj,"dp88_buildingScripts_functionMoneyTrickle","%f",amount); Play_Killed = true; @@ -88,17 +88,17 @@ if (damage < 0.0f) { - if (Commands->Get_Player_Type(obj) == -2) + if (Get_Object_Type(obj) == -2) { if (Commands->Get_Health(obj) == Commands->Get_Max_Health(obj)) { - Commands->Set_Player_Type(obj,Get_Object_Type(damager)); - if (Commands->Get_Player_Type(obj) == 0) + Set_Object_Type(obj,Get_Object_Type(damager)); + if (Get_Object_Type(obj) == 0) { Send_Message_Team(0,255,0,0,StringClass::getFormattedString("Nod has captured the %s!", Building)); Attach_Script_Once_V(obj,"dp88_buildingScripts_functionMoneyTrickle","%f",amount); } - else if (Commands->Get_Player_Type(obj) == 1) + else if (Get_Object_Type(obj) == 1) { Send_Message_Team(1,255,201,0,StringClass::getFormattedString("GDI has captured the %s!", Building)); Attach_Script_Once_V(obj,"dp88_buildingScripts_functionMoneyTrickle","%f",amount); @@ -111,7 +111,7 @@ if (damage > Commands->Get_Health(obj)) { - if (Commands->Get_Player_Type(obj) == 0) + if (Get_Object_Type(obj) == 0) { if (Play_Killed) { @@ -121,7 +121,7 @@ Remove_Script(obj,"dp88_buildingScripts_functionMoneyTrickle"); } } - else if (Commands->Get_Player_Type(obj) == 1) + else if (Get_Object_Type(obj) == 1) { if (Play_Killed) { @@ -131,7 +131,7 @@ Remove_Script(obj,"dp88_buildingScripts_functionMoneyTrickle"); } } - Commands->Set_Player_Type(obj,-2); + Set_Object_Type(obj,-2); Commands->Set_Health(obj,1.0f); } } @@ -150,7 +150,7 @@ Commands->Set_Animation_Frame(obj,Get_Model(obj),0); Set_Object_Type(obj, Get_Int_Parameter("Team")); - if(Commands->Get_Player_Type(obj)!=-2) + if(Get_Object_Type(obj)!=-2) { Play_Killed = true; Play_Damage = true; @@ -198,7 +198,7 @@ { if (damage > Commands->Get_Health(obj)) { - if (Commands->Get_Player_Type(obj) == 0) + if (Get_Object_Type(obj) == 0) { if (Play_Killed) { @@ -208,7 +208,7 @@ Commands->Set_Animation_Frame(obj,Get_Model(obj),0); } } - else if (Commands->Get_Player_Type(obj) == 1) + else if (Get_Object_Type(obj) == 1) { if (Play_Killed) { @@ -218,24 +218,24 @@ Commands->Set_Animation_Frame(obj,Get_Model(obj),0); } } - Commands->Set_Player_Type(obj,-2); + Set_Object_Type(obj,-2); Commands->Set_Health(obj,1.0f); } if (damage < 0.0f) { - if (Commands->Get_Player_Type(obj) == -2) + if (Get_Object_Type(obj) == -2) { if (Commands->Get_Health(obj) == Commands->Get_Max_Health(obj)) { - Commands->Set_Player_Type(obj,Get_Object_Type(damager)); - if (Commands->Get_Player_Type(obj) == 0) + Set_Object_Type(obj,Get_Object_Type(damager)); + if (Get_Object_Type(obj) == 0) { Send_Message_Team(0,255,0,0,StringClass::getFormattedString("Nod has captured the %s!",Building)); Commands->Set_Animation_Frame(obj,Get_Model(obj),1); } - else if (Commands->Get_Player_Type(obj) == 1) + else if (Get_Object_Type(obj) == 1) { Send_Message_Team(1,255,201,0,StringClass::getFormattedString("GDI has captured the %s!",Building)); Commands->Set_Animation_Frame(obj,Get_Model(obj),3); @@ -326,7 +326,7 @@ { if (damage > Commands->Get_Health(obj)) { - if (Commands->Get_Player_Type(obj) == 0) + if (Get_Object_Type(obj) == 0) { if (Play_Killed) { @@ -337,7 +337,7 @@ Commands->Set_Animation_Frame(obj,Get_Model(obj),0); } } - else if (Commands->Get_Player_Type(obj) == 1) + else if (Get_Object_Type(obj) == 1) { if (Play_Killed) { @@ -348,25 +348,25 @@ Commands->Set_Animation_Frame(obj,Get_Model(obj),0); } } - Commands->Set_Player_Type(obj,-2); + Set_Object_Type(obj,-2); Commands->Set_Health(obj,1.0f); } if (damage < 0.0f) { - if (Commands->Get_Player_Type(obj) == -2) + if (Get_Object_Type(obj) == -2) { if (Commands->Get_Health(obj) == Commands->Get_Max_Health(obj)) { - Commands->Set_Player_Type(obj,Get_Object_Type(damager)); - if (Commands->Get_Player_Type(obj) == 0) + Set_Object_Type(obj,Get_Object_Type(damager)); + if (Get_Object_Type(obj) == 0) { Send_Message_Team(0,255,0,0,StringClass::getFormattedString("Nod has captured the %s!", Building)); Attach_Script_Once(Commands->Find_Object(zoneid), "JFW_Sell_Zone", "0"); Commands->Set_Animation_Frame(obj,Get_Model(obj),1); } - else if (Commands->Get_Player_Type(obj) == 1) + else if (Get_Object_Type(obj) == 1) { Send_Message_Team(1,255,201,0,StringClass::getFormattedString("GDI has captured the %s!", Building)); Attach_Script_Once(Commands->Find_Object(zoneid), "JFW_Sell_Zone", "1"); @@ -402,7 +402,7 @@ Play_Damage = false; Play_Killed = false; - if(Commands->Get_Player_Type(obj)!=-2) + if(Get_Object_Type(obj)!=-2) { Play_Killed = true; Play_Damage = true; @@ -415,7 +415,7 @@ { if (damage > Commands->Get_Health(obj)) { - if (Commands->Get_Player_Type(obj) == 0) + if (Get_Object_Type(obj) == 0) { if (Play_Killed) { @@ -434,7 +434,7 @@ Commands->Action_Reset(obj,200); } } - else if (Commands->Get_Player_Type(obj) == 1) + else if (Get_Object_Type(obj) == 1) { if (Play_Killed) { @@ -453,24 +453,24 @@ Commands->Action_Reset(obj,200); } } - Commands->Set_Player_Type(obj,-2); + Set_Object_Type(obj,-2); Commands->Set_Health(obj,1.0f); } if (damage < 0.0f) { - if (Commands->Get_Player_Type(obj) == -2) + if (Get_Object_Type(obj) == -2) { if (Commands->Get_Health(obj) == Commands->Get_Max_Health(obj)) { - Commands->Set_Player_Type(obj,Get_Object_Type(damager)); - if (Commands->Get_Player_Type(obj) == 0) + Set_Object_Type(obj,Get_Object_Type(damager)); + if (Get_Object_Type(obj) == 0) { Send_Message_Team(0,255,0,0,StringClass::getFormattedString("Nod has captured the %s!",Building)); //DALogManager::Write_Log("_INFO","Nod has captured the %s!",Building); } - else if (Commands->Get_Player_Type(obj) == 1) + else if (Get_Object_Type(obj) == 1) { Send_Message_Team(1,255,201,0,StringClass::getFormattedString("GDI has captured the %s!",Building)); //DALogManager::Write_Log("_INFO","GDI has captured the %s!",Building); @@ -693,7 +693,7 @@ void DB_capturable_helipadzone_reload::Entered(GameObject *obj, GameObject *enterer) { if(Commands->Find_Object(Get_Int_Parameter("BuildingID"))) - if (Commands->Get_Player_Type(enterer) == Commands->Get_Player_Type(Commands->Find_Object(Get_Int_Parameter("BuildingID"))) && enterer->As_VehicleGameObj() && Is_VTOL(enterer)) + if (Get_Object_Type(enterer) == Get_Object_Type(Commands->Find_Object(Get_Int_Parameter("BuildingID"))) && enterer->As_VehicleGameObj() && Is_VTOL(enterer)) { if(!Has_Timer(obj,this,enterer->Get_ID())) Commands->Start_Timer(obj, this, 1, Commands->Get_ID(enterer)); @@ -807,9 +807,9 @@ InfantryFactoryID = Get_Int_Parameter("InfantryFactoryID"); Cost = Get_Float_Parameter("Cost"); Preset = Get_Parameter("Preset"); - Team = Commands->Get_Player_Type(Commands->Find_Object(InfantryFactoryID)); + Team = Get_Object_Type(Commands->Find_Object(InfantryFactoryID)); Allowpoke = true; - Commands->Set_Player_Type(obj, Team); + Set_Object_Type(obj, Team); Commands->Start_Timer(obj, this, 10.0f, 102031);//set the team of the console to that of the associated helipad } void DB_Capturable_Infantry_Terminal::Poked(GameObject *obj, GameObject *poker) @@ -817,9 +817,9 @@ if (Allowpoke) { Commands->Enable_HUD_Pokable_Indicator(obj, false); - Team = Commands->Get_Player_Type(Commands->Find_Object(InfantryFactoryID));//request the helipad team again and check it against poker + Team = Get_Object_Type(Commands->Find_Object(InfantryFactoryID));//request the helipad team again and check it against poker Allowpoke = false; Commands->Start_Timer(obj, this, 3.0f, 102030);//No poking for 5s - if (Commands->Get_Player_Type(poker) == Team) + if (Get_Object_Type(poker) == Team) { if (Is_Base_Powered(Team)) { @@ -882,8 +882,8 @@ } else if (number == 102031) { - Team = Commands->Get_Player_Type(Commands->Find_Object(InfantryFactoryID)); - Commands->Set_Player_Type(obj, Team); + Team = Get_Object_Type(Commands->Find_Object(InfantryFactoryID)); + Set_Object_Type(obj, Team); Commands->Start_Timer(obj, this, 10.0f, 102031);//re-set the team of the console to that of the associated helipad } } @@ -906,9 +906,9 @@ CheckObjectID = Get_Int_Parameter("CheckObjectID"); Cost = Get_Float_Parameter("Cost"); Preset = Get_Parameter("Powerup"); - Team = Commands->Get_Player_Type(Commands->Find_Object(CheckObjectID)); + Team = Get_Object_Type(Commands->Find_Object(CheckObjectID)); Allowpoke = true; - Commands->Set_Player_Type(obj, Team); + Set_Object_Type(obj, Team); Commands->Start_Timer(obj, this, 10.0f, 102031);//set the team of the console to that of the associated helipad } void DB_Capturable_Powerup_Terminal::Poked(GameObject *obj, GameObject *poker) @@ -916,9 +916,9 @@ if (Allowpoke) { Commands->Enable_HUD_Pokable_Indicator(obj, false); - Team = Commands->Get_Player_Type(Commands->Find_Object(CheckObjectID));//request the helipad team again and check it against poker + Team = Get_Object_Type(Commands->Find_Object(CheckObjectID));//request the helipad team again and check it against poker Allowpoke = false; Commands->Start_Timer(obj, this, 3.0f, 102030);//No poking for 5s - if (Commands->Get_Player_Type(poker) == Team) + if (Get_Object_Type(poker) == Team) { if (Is_Base_Powered(Team)) { @@ -977,8 +977,8 @@ } else if (number == 102031) { - Team = Commands->Get_Player_Type(Commands->Find_Object(CheckObjectID)); - Commands->Set_Player_Type(obj, Team); + Team = Get_Object_Type(Commands->Find_Object(CheckObjectID)); + Set_Object_Type(obj, Team); Commands->Start_Timer(obj, this, 10.0f, 102031);//re-set the team of the console to that of the associated helipad } } @@ -990,13 +990,13 @@ int team; void Nod_Turret_DeathSound::Created(GameObject *obj) { - team=Commands->Get_Player_Type(obj); + team=Get_Object_Type(obj); } void Nod_Turret_DeathSound::Killed(GameObject *obj, GameObject *killer) { - team=Commands->Get_Player_Type(obj); + team=Get_Object_Type(obj); if(team==0) Create_2D_WAV_Sound_Team("m00bntu_kill0001i1evan_snd.wav",team); else if(team==1) @@ -1010,13 +1010,13 @@ int team; void GDI_Guard_Tower_DeathSound::Created(GameObject *obj) { - team=Commands->Get_Player_Type(obj); + team=Get_Object_Type(obj); } void GDI_Guard_Tower_DeathSound::Killed(GameObject *obj, GameObject *killer) { - team=Commands->Get_Player_Type(obj); + team=Get_Object_Type(obj); if(team==1) Create_2D_WAV_Sound_Team("m00bggt_kill0001i1evag_snd.wav",team); else if(team==0) @@ -1028,13 +1028,13 @@ int team; void Nod_SamSite_DeathSound::Created(GameObject *obj) { - team=Commands->Get_Player_Type(obj); + team=Get_Object_Type(obj); } void Nod_SamSite_DeathSound::Killed(GameObject *obj, GameObject *killer) { - team=Commands->Get_Player_Type(obj); + team=Get_Object_Type(obj); if(team==0) Create_2D_WAV_Sound_Team("m00bnss_kill0001i1evan_snd.wav",team); else if(team==1) @@ -1047,7 +1047,7 @@ int team; void DB_Power_Plant_fix::Created(GameObject *obj) { - team=Commands->Get_Player_Type(obj); + team=Get_Object_Type(obj); } diff -uwrN sourceold/scripts/DB_Innate.cpp source/scripts/DB_Innate.cpp --- sourceold/scripts/DB_Innate.cpp 2017-02-16 06:25:31.819200800 +1000 +++ source/scripts/DB_Innate.cpp 2017-02-18 18:59:47.917800600 +1000 @@ -397,7 +397,7 @@ } else { - Commands->Select_Weapon(obj,"None"); + Commands->Select_Weapon(obj,""); } ActTime = 0; } diff -uwrN sourceold/scripts/engine_dmg.cpp source/scripts/engine_dmg.cpp --- sourceold/scripts/engine_dmg.cpp 2016-10-31 07:17:12.471013500 +1000 +++ source/scripts/engine_dmg.cpp 2017-02-23 07:45:57.938607600 +1000 @@ -727,9 +727,9 @@ if(Commands->Get_Player_Type(Damager) == Commands->Get_Player_Type(o)) { float Damage = (Max_Health + Max_Shield) * FriendPercentage; - if ((Get_Vehicle_Mode(o) != VEHICLE_TYPE_TURRET) || The_Game()->Is_Friendly_Fire_Permitted()) + if ((Get_Vehicle_Mode(o) != VEHICLE_TYPE_TURRET)) { - if(ForceFriendly) + if(ForceFriendly || The_Game()->Is_Friendly_Fire_Permitted()) { Commands->Apply_Damage(o,Damage,Warhead,0); } @@ -739,7 +739,7 @@ } } } - else + else if(Get_Vehicle_Mode(o) != VEHICLE_TYPE_TURRET) { float Damage = (Max_Health + Max_Shield) * EnemyPercentage; Commands->Apply_Damage(o,Damage,Warhead,Damager); @@ -775,9 +775,7 @@ if (Commands->Get_Player_Type(Damager) == Commands->Get_Player_Type(o)) { float Damage = (Max_Health + Max_Shield) * FriendPercentage; - if (The_Game()->Is_Friendly_Fire_Permitted()) - { - if (ForceFriendly) + if (ForceFriendly || The_Game()->Is_Friendly_Fire_Permitted()) { Commands->Apply_Damage(o, Damage, Warhead, 0); } @@ -786,7 +784,6 @@ Commands->Apply_Damage(o, Damage, Warhead, Damager); } } - } else { float Damage = (Max_Health + Max_Shield) * EnemyPercentage; diff -uwrN sourceold/scripts/engine_obj.h source/scripts/engine_obj.h --- sourceold/scripts/engine_obj.h 2016-10-31 07:17:12.477013500 +1000 +++ source/scripts/engine_obj.h 2017-02-21 16:13:39.368638100 +1000 @@ -36,6 +36,10 @@ #define CID_Airstrip 0xD006 #define CID_Cinematic 0x3011 #define CID_ComCenter 0xD008 +#define CID_Weapon 0xB001 +#define CID_Ammo 0xB002 +#define CID_Explosion 0xB003 +#define CID_Spawner 0x300D int SCRIPTS_API Get_Object_Type(GameObject *obj); //get the team of an object,0 = Nod,1 = GDI,2 = neutral,works on buildings void SCRIPTS_API Set_Object_Type(GameObject *obj,int type); //set the team of an object,0 = Nod,1 = GDI,2 = neutral,works on buildings