diff -urN sourceold/scripts/JMGRenetBusters.cpp source/scripts/JMGRenetBusters.cpp --- sourceold/scripts/JMGRenetBusters.cpp 2022-11-19 15:40:13.662857100 -0600 +++ source/scripts/JMGRenetBusters.cpp 2022-11-19 19:00:10.176837500 -0600 @@ -24,6 +24,8 @@ #include "VehicleGameObj.h" #include "jmgUtility.h" #include "JMGRenetBuster.h" +#include "RigidBodyClass.h" +#include "ArmedGameObjDef.h" // Did a major overhaul on all these scripts, even though the mod they belonged to is dead :( void JMG_Create_Ship_On_Poke::Created(GameObject *obj) { @@ -2610,10 +2612,11 @@ sprintf(anim,"CometSpin%d.CometSpin%d",Random,Random); Commands->Set_Animation(obj,anim,true,0,0,-1,true); } + int impulses = 1; if (Commands->Get_Random(0.0f,1.0f) < 0.25f && JMG_CMTB_Main_Game_Control::CMTBLevel) - Set_Current_Clip_Bullets(obj,max((int)((Commands->Get_Random_Int(0,JMG_CMTB_Main_Game_Control::CMTBLevel)+1)*JMG_CMTB_Main_Game_Control::DifficultyMultiplier),1)); + impulses = max((int)((Commands->Get_Random_Int(0,JMG_CMTB_Main_Game_Control::CMTBLevel)+1)*JMG_CMTB_Main_Game_Control::DifficultyMultiplier),1); else - Set_Current_Clip_Bullets(obj,max((int)(JMG_CMTB_Main_Game_Control::CMTBLevel*JMG_CMTB_Main_Game_Control::DifficultyMultiplier),1)); + impulses = max((int)(JMG_CMTB_Main_Game_Control::CMTBLevel*JMG_CMTB_Main_Game_Control::DifficultyMultiplier),1); Vector3 Position = Commands->Get_Position(obj); Position.Z = 0.5; GameObject *SPOT = Commands->Create_Object("Daves Arrow",Position); @@ -2638,14 +2641,20 @@ RenCometBustersList += TypeObject(obj,1.5625f,1.25f,Asteroid); break; } - Vector3 target = Get_Vector3_Parameter("TargetPosition"); - target.Z = Commands->Get_Position(obj).Z; - ActionParamsStruct params; - params.Set_Basic(this,99,1); - params.Set_Attack(target,100.0f,0.0f,true); - params.AttackForceFire = true; - Commands->Action_Attack(obj,params); Commands->Destroy_Object(SPOT); + + PhysicalGameObj *physicalGameObj = obj->As_PhysicalGameObj(); + Matrix3D muzzle = physicalGameObj->As_ArmedGameObj()->Get_Muzzle(); + Vector3 impulse_pos; + muzzle.Get_Translation(&impulse_pos); + Vector3 impulse; + muzzle.Get_X_Vector(&impulse); + impulse *= Get_Mass(obj)*-0.630f*impulses; + physicalGameObj->Peek_Physical_Object()->As_RigidBodyClass()->Apply_Impulse(impulse,impulse_pos); + Force_Position_Update(obj); + Force_Orientation_Update(obj); + Force_Velocity_Update(obj); + Update_Network_Object(obj); } void JMG_CMTB_Comet_Script::Killed(GameObject *obj, GameObject *damager) { diff -urN sourceold/scripts/ODESystemClass.h source/scripts/ODESystemClass.h --- sourceold/scripts/ODESystemClass.h 1969-12-31 18:00:00.000000000 -0600 +++ source/scripts/ODESystemClass.h 2022-11-19 19:00:10.190377200 -0600 @@ -0,0 +1,26 @@ +#ifndef TT_INCLUDE__ODESYSTEMCLASS_H +#define TT_INCLUDE__ODESYSTEMCLASS_H +#include "engine_vector.h" +class StateVectorClass : public DynamicVectorClass +{ +public: + void Reset(void) { ActiveCount = 0; } + void Resize(int size) { if (size > VectorMax) { DynamicVectorClass::Resize(size); } } +}; +class ODESystemClass +{ +public: + virtual void Get_State(StateVectorClass & set_state) = 0; + virtual int Set_State(const StateVectorClass & new_state,int start_index = 0) = 0; + virtual int Compute_Derivatives(float t,StateVectorClass * test_state,StateVectorClass * dydt,int start_index = 0) = 0; +}; +class IntegrationSystem +{ +public: + static void Euler_Integrate(ODESystemClass * sys,float dt); + static void Midpoint_Integrate(ODESystemClass * sys,float dt); + static void Runge_Kutta_Integrate(ODESystemClass * sys,float dt); + static void Runge_Kutta5_Integrate(ODESystemClass * odesys,float dt); +}; + +#endif diff -urN sourceold/scripts/PhysicsConstants.h source/scripts/PhysicsConstants.h --- sourceold/scripts/PhysicsConstants.h 1969-12-31 18:00:00.000000000 -0600 +++ source/scripts/PhysicsConstants.h 2022-11-19 19:00:10.198519700 -0600 @@ -0,0 +1,78 @@ +#ifndef TT_INCLUDE__PHYSICSCONSTANTS_H +#define TT_INCLUDE__PHYSICSCONSTANTS_H + + + +#include "Vector3.h" + + + +class ChunkSaveClass; +class ChunkLoadClass; + + +#ifndef TTLE_EXPORTS +extern float ContactFrictionCoefficient[3][32]; +extern float ContactDragCoefficient[3][32]; +#else +typedef float ContactFrictionCoefficientType[3][32]; +extern REF_DECL(ContactFrictionCoefficientType,ContactFrictionCoefficient); +typedef float ContactDragCoefficientType[3][32]; +extern REF_DECL(ContactDragCoefficientType,ContactDragCoefficient); +#endif + + +class PhysicsConstants +{ + +public: + + static float AngularDamping; + static float DefaultContactFriction; + static float DefaultContactDrag; +#ifndef W3DVIEWER + static REF_DECL(Vector3, GravityAcceleration); +#endif + static float LinearDamping; + static float RestingContactVelocity; + static float MinFrictionVelocity; + static float MinFrictionVelocity2; + + static void Init(); + + static void Set_Contact_Friction_Coefficient(int physicsType, int surfaceType, float value) + { + if ((uint)physicsType < 3 && (uint)surfaceType < 32) + ContactFrictionCoefficient[physicsType][surfaceType] = value; + } + + static float Get_Contact_Friction_Coefficient(int physicsType, int surfaceType) + { + if ((uint)physicsType < 3 && (uint)surfaceType < 32) + return ContactFrictionCoefficient[physicsType][surfaceType]; + else + return ContactFrictionCoefficient[0][0]; + } + + static void Set_Contact_Drag_Coefficient(int physicsType, int surfaceType, float value) + { + if ((uint)physicsType < 3 && (uint)surfaceType < 32) + ContactDragCoefficient[physicsType][surfaceType] = value; + } + + static float Get_Contact_Drag_Coefficient(int physicsType, int surfaceType) + { + if ((uint)physicsType < 3 && (uint)surfaceType < 32) + return ContactDragCoefficient[physicsType][surfaceType]; + else + return ContactDragCoefficient[0][0]; + } + + static void Save(ChunkSaveClass&); + static void Load(ChunkLoadClass&); + +}; + + + +#endif diff -urN sourceold/scripts/RigidBodyClass.h source/scripts/RigidBodyClass.h --- sourceold/scripts/RigidBodyClass.h 1969-12-31 18:00:00.000000000 -0600 +++ source/scripts/RigidBodyClass.h 2022-11-19 19:00:10.214821900 -0600 @@ -0,0 +1,208 @@ +#ifndef TT_INCLUDE__RIGIDBODYCLASS_H +#define TT_INCLUDE__RIGIDBODYCLASS_H +#include "MoveablePhysClass.h" +#include "ODESystemClass.h" +#include "AABoxClass.h" +#include "Quaternion.h" +#include "Matrix3.h" +#include "PhysicsConstants.h" +class RigidBodyDefClass; +class OBBoxRenderObjClass; +class PaddedBoxClass; +class OctBoxClass; +class RBodyHistoryClass; +struct CastResultStruct; +const int MAX_CONTACT_POINTS = 10; +const float RBODY_SLEEP_DELAY = 0.5f; // if still for this many seconds, shut off simulation +struct RigidBodyStateStruct +{ + RigidBodyStateStruct(void) {} + RigidBodyStateStruct(const RigidBodyStateStruct & that); + RigidBodyStateStruct & operator = (const RigidBodyStateStruct & that); + void Reset(void); + void To_Vector(StateVectorClass & vec); + int From_Vector(const StateVectorClass & vec,int index); + static void Lerp(const RigidBodyStateStruct & s0,const RigidBodyStateStruct & s1,float fraction,RigidBodyStateStruct * res); + bool Is_Valid(void) { return (Position.Is_Valid() && Orientation.Is_Valid() && LMomentum.Is_Valid() && AMomentum.Is_Valid()); } + Vector3 Position; + Quaternion Orientation; + Vector3 LMomentum; + Vector3 AMomentum; +}; +inline RigidBodyStateStruct::RigidBodyStateStruct(const RigidBodyStateStruct & that) +{ + *this = that; +} +inline RigidBodyStateStruct & RigidBodyStateStruct::operator = (const RigidBodyStateStruct & that) +{ + Position = that.Position; + Orientation = that.Orientation; + LMomentum = that.LMomentum; + AMomentum = that.AMomentum; + return *this; +} +inline void RigidBodyStateStruct::Reset(void) +{ + Position.Set(0,0,0); + Orientation.Make_Identity(); + LMomentum.Set(0,0,0); + AMomentum.Set(0,0,0); +} +inline void RigidBodyStateStruct::To_Vector(StateVectorClass & vec) +{ + vec.Add(Position[0]); + vec.Add(Position[1]); + vec.Add(Position[2]); + + vec.Add(Orientation[0]); + vec.Add(Orientation[1]); + vec.Add(Orientation[2]); + vec.Add(Orientation[3]); + + vec.Add(LMomentum[0]); + vec.Add(LMomentum[1]); + vec.Add(LMomentum[2]); + + vec.Add(AMomentum[0]); + vec.Add(AMomentum[1]); + vec.Add(AMomentum[2]); +} +inline int RigidBodyStateStruct::From_Vector(const StateVectorClass & vec,int index) +{ + Position[0] = vec[index++]; + Position[1] = vec[index++]; + Position[2] = vec[index++]; + + Orientation[0] = vec[index++]; + Orientation[1] = vec[index++]; + Orientation[2] = vec[index++]; + Orientation[3] = vec[index++]; + + LMomentum[0] = vec[index++]; + LMomentum[1] = vec[index++]; + LMomentum[2] = vec[index++]; + + AMomentum[0] = vec[index++]; + AMomentum[1] = vec[index++]; + AMomentum[2] = vec[index++]; + + return index; +} +inline void RigidBodyStateStruct::Lerp +( + const RigidBodyStateStruct & s0, + const RigidBodyStateStruct & s1, + float fraction, + RigidBodyStateStruct * res +) +{ + Vector3::Lerp(s0.Position,s1.Position,fraction,&(res->Position)); + Vector3::Lerp(s0.LMomentum,s1.LMomentum,fraction,&(res->LMomentum)); + Vector3::Lerp(s0.AMomentum,s1.AMomentum,fraction,&(res->AMomentum)); + ::Fast_Slerp(res->Orientation,s0.Orientation,s1.Orientation,fraction); +} + +class RigidBodyClass : public MoveablePhysClass , public ODESystemClass +{ +public: + RigidBodyClass(void); + virtual ~RigidBodyClass(void); + virtual RigidBodyClass * As_RigidBodyClass(void) { return this; } + RigidBodyDefClass * Get_RigidBodyDef(void) { return (RigidBodyDefClass *)Definition; } + void Init(const RigidBodyDefClass & definition); + virtual const AABoxClass & Get_Bounding_Box(void) const; + virtual const Matrix3D & Get_Transform(void) const; + virtual void Set_Transform(const Matrix3D & m); + virtual bool Cast_Ray(PhysRayCollisionTestClass & raytest); + virtual bool Cast_AABox(PhysAABoxCollisionTestClass & boxtest); + virtual bool Cast_OBBox(PhysOBBoxCollisionTestClass & boxtest); + virtual bool Intersection_Test(PhysAABoxIntersectionTestClass & test); + virtual bool Intersection_Test(PhysOBBoxIntersectionTestClass & test); + virtual bool Intersection_Test(PhysMeshIntersectionTestClass & test); + virtual bool Can_Teleport(const Matrix3D &new_tm, bool check_dyn_only = false,MultiListClass * result_list = NULL); + virtual bool Can_Teleport_And_Stand(const Matrix3D &new_tm, Matrix3D *out); + void Get_Orientation(Quaternion * set_q) const { *set_q = State.Orientation; } + void Set_Orientation(Quaternion & new_q) { State.Orientation = new_q; } + virtual void Get_Velocity(Vector3 * set_vel) const; + virtual void Get_Angular_Velocity(Vector3 * set_avel) const; + virtual void Set_Velocity(const Vector3 & newvel); + virtual void Set_Angular_Velocity(const Vector3 & newavel); + virtual void Apply_Impulse(const Vector3 & imp); + virtual void Apply_Impulse(const Vector3 & imp, const Vector3 & wpos); + virtual void Timestep(float dt); + void Compute_Point_Velocity(const Vector3 & p,Vector3 * pdot); + float Get_Last_Timestep(void) { return LastTimestep; } + void Network_Interpolate_State_Update( const Vector3 & new_pos, + const Quaternion & new_orientation, + const Vector3 & new_vel, + const Vector3 & new_avel, + float blend_fraction); + void Network_Latency_State_Update( const Vector3 & new_pos, + const Quaternion & new_orientation, + const Vector3 & new_vel, + const Vector3 & new_avel); + static void Set_Correction_Time(float time) { _CorrectionTime = time; } + static float Get_Correction_Time(void) { return _CorrectionTime; } + virtual void Set_Model(RenderObjClass * model); + virtual void Set_Mass(float mass); + virtual void Get_Inertia_Inv(Matrix3 * set_I_inv); + void Set_Inertia(const Matrix3 & I); + void Get_Inertia(Matrix3 * I); + void Set_Contact_Parameters(float length); + void Get_Contact_Parameters(float * stiffness,float * damping,float * length); + float Get_Weight(void) { return GravScale * Mass * (-PhysicsConstants::GravityAcceleration.Z); } + virtual void Get_Shadow_Blob_Box(AABoxClass * set_obj_space_box); + virtual bool Push(const Vector3 & move); + virtual const PersistFactoryClass & Get_Factory (void) const; + virtual bool Save (ChunkSaveClass &csave); + virtual bool Load (ChunkLoadClass &cload); + virtual void On_Post_Load(void); + OBBoxRenderObjClass* Peek_Box() { return Box; } +protected: + virtual void Get_State(StateVectorClass & set_state); + virtual int Set_State(const StateVectorClass & new_state,int start_index); + void Set_State(const RigidBodyStateStruct & new_state); + virtual int Compute_Derivatives(float t,StateVectorClass * test_state,StateVectorClass * set_derivs,int start_index); + void Integrate(float time); + void Update_Cached_Model_Parameters(void); + virtual void Compute_Inertia(void); + void Update_Auxiliary_State(void); + virtual void Compute_Force_And_Torque(Vector3 * force,Vector3 * torque); + void Compute_Impact(const CastResultStruct & result,Vector3 * impulse); + void Compute_Impact(const Vector3 & point,const Vector3 & normal,Vector3 * impulse); + bool Is_Colliding(const Vector3 & point, const Vector3 & normal); + void Set_Moving_Collision_Region(float dt); + void Set_Stationary_Collision_Region(void); + virtual bool Can_Go_To_Sleep(float dt); + bool Find_State_In_Contact_Zone(const RigidBodyStateStruct & oldstate); + bool Push_Phys3_Object_Away(Phys3Class * p3obj,const CastResultStruct & contact); + void Network_Latency_Error_Correction(float dt); + void Assert_State_Valid(void) const; + void Assert_Not_Intersecting(void); + void Dump_State(void) const; + OBBoxRenderObjClass * Box; // World-Space Box + Matrix3 IBody; // Body space inertia tensor + Matrix3 IBodyInv; // Inverse of the body space inertia tensor + OctBoxClass * ContactBox; // datastructure for finding contact points + float ContactThickness; // Dimension of the contact region + RigidBodyStateStruct State; // current state vector + Matrix3 Rotation; + Matrix3 IInv; + Vector3 Velocity; + Vector3 AngularVelocity; + bool IsInContact; + int ContactCount; + Vector3 ContactPoint[MAX_CONTACT_POINTS]; + Vector3 ContactNormal; + int StickCount; + float LastTimestep; + float GoToSleepTimer; + RBodyHistoryClass * History; + RigidBodyStateStruct LatencyError; + RigidBodyStateStruct LastKnownState; + static float _CorrectionTime; +private: + RigidBodyClass(const RigidBodyClass &); + RigidBodyClass & operator = (const RigidBodyClass &); +}; // 02B0 02B0 02CC 02C8 +#endif diff -urN sourceold/scripts/agtfix.cpp source/scripts/agtfix.cpp --- sourceold/scripts/agtfix.cpp 2022-11-19 15:40:10.720360100 -0600 +++ source/scripts/agtfix.cpp 2022-11-19 19:00:10.255115400 -0600 @@ -13,6 +13,7 @@ #include "scripts.h" #include "agtfix.h" #include "engine_game.h" +#include "engine_obj.h" #include "BuildingGameObj.h" #include "BuildingAggregateClass.h" @@ -140,6 +141,7 @@ GameObject* MissileObj = Commands->Create_Object("GDI_AGT", MissilePos); if (MissileObj) { + Set_Object_Type(MissileObj, Get_Object_Type(AGTObj)); Commands->Attach_Script(MissileObj, "GDI_AGT_Missile", "0"); MissileID = Commands->Get_ID(MissileObj); } @@ -149,6 +151,7 @@ GameObject* GunObj = Commands->Create_Object("GDI_Ceiling_Gun_AGT", GunPos[i]); if (GunObj) { + Set_Object_Type(GunObj, Get_Object_Type(AGTObj)); Commands->Attach_Script(GunObj, "GDI_AGT_Gun", ""); Commands->Send_Custom_Event(AGTObj, GunObj, 0, MissileID, 0); GunID[i] = Commands->Get_ID(GunObj); @@ -240,7 +243,7 @@ return false; // TODO: Make switch for agt kills neutral? - if (Commands->Get_Player_Type(EnemyObj) != 0) + if (Commands->Get_Player_Type(EnemyObj) != (Get_Object_Type(GunObj) ? 0 : 1)) return false; if (Commands->Get_Health(EnemyObj) <= 0) @@ -329,7 +332,7 @@ return false; // TODO: Make switch for agt kills neutral? - if (Commands->Get_Player_Type(EnemyObj) != 0) + if (Commands->Get_Player_Type(EnemyObj) != (Get_Object_Type(MissileObj) ? 0 : 1)) return false; if (Commands->Get_Health(EnemyObj) <= 0) diff -urN sourceold/scripts/cPlayer.h source/scripts/cPlayer.h --- sourceold/scripts/cPlayer.h 2022-11-19 15:40:11.424419200 -0600 +++ source/scripts/cPlayer.h 2022-11-19 19:00:10.261096300 -0600 @@ -50,8 +50,8 @@ void Set_Ladder_Points(int amount); void Set_Rung(int amount); void Set_Is_Active(bool active); - void Set_Name(const WideStringClass& name); - void Set_Id(uint32 id); + void SCRIPTS_API Set_Name(const WideStringClass& name); + void SCRIPTS_API Set_Id(uint32 id); void Set_Wol_ClanID(uint32 wolClanId); void Set_Wol_Rank(sint32 wolRank); void Set_Is_In_Game(bool); diff -urN sourceold/scripts/dllmain.cpp source/scripts/dllmain.cpp --- sourceold/scripts/dllmain.cpp 2022-11-19 15:40:11.973891600 -0600 +++ source/scripts/dllmain.cpp 2022-11-19 19:00:10.268774800 -0600 @@ -424,6 +424,17 @@ Delete_Dialog = (dlg)Address(tt, "Delete_Dialog"); Display_HUD_Weapon_Grant_Player = (dhwg)Address(tt, "Display_HUD_Weapon_Grant_Player"); Display_HUD_Ammo_Grant_Player = (dhwg)Address(tt, "Display_HUD_Ammo_Grant_Player"); + Get_Repository_URL = (gru)Address(tt, "Get_Repository_URL"); + Set_Repository_URL = (sru)Address(tt, "Set_Repository_URL"); + Get_Screenshot_URL = (gru)Address(tt, "Get_Screenshot_URL"); + Set_Screenshot_URL = (sru)Address(tt, "Set_Screenshot_URL"); + Take_Screenshot = (tss)Address(tt, "Take_Screenshot"); + Is_In_Pathfind_Sector = (iips)Address(tt, "Is_In_Pathfind_Sector"); + Set_Gravity_Multiplier = (sgm)Address(tt, "Set_Gravity_Multiplier"); + Is_Gameplay_Allowed = (iga)Address(tt, "Is_Gameplay_Allowed"); + Set_Gameplay_Allowed = (sga)Address(tt, "Set_Gameplay_Allowed"); + Print_Client_Console = (pcc)Address(tt, "Print_Client_Console"); + Print_Client_Console_Player = (pccp)Address(tt, "Print_Client_Console_Player"); #ifdef SSGM SSGMGameManager::Init(); diff -urN sourceold/scripts/engine_dialog.cpp source/scripts/engine_dialog.cpp --- sourceold/scripts/engine_dialog.cpp 2022-11-19 15:40:12.272740200 -0600 +++ source/scripts/engine_dialog.cpp 2022-11-19 19:00:10.285919400 -0600 @@ -19,6 +19,7 @@ Set_Control_Bounds(control, x, y, width, height); control->Set_Text_Color(label_color); control->Set_Label_Text(text); + control->Set_Is_Title(title); return control; } diff -urN sourceold/scripts/engine_tt.cpp source/scripts/engine_tt.cpp --- sourceold/scripts/engine_tt.cpp 2022-11-19 15:40:12.613920000 -0600 +++ source/scripts/engine_tt.cpp 2022-11-19 19:00:10.301223500 -0600 @@ -275,6 +275,17 @@ SCRIPTS_API dlg Delete_Dialog; SCRIPTS_API dhwg Display_HUD_Weapon_Grant_Player; SCRIPTS_API dhwg Display_HUD_Ammo_Grant_Player; +SCRIPTS_API gru Get_Repository_URL; +SCRIPTS_API sru Set_Repository_URL; +SCRIPTS_API gru Get_Screenshot_URL; +SCRIPTS_API sru Set_Screenshot_URL; +SCRIPTS_API tss Take_Screenshot; +SCRIPTS_API iips Is_In_Pathfind_Sector; +SCRIPTS_API sgm Set_Gravity_Multiplier; +SCRIPTS_API iga Is_Gameplay_Allowed; +SCRIPTS_API sga Set_Gameplay_Allowed; +SCRIPTS_API pcc Print_Client_Console; +SCRIPTS_API pccp Print_Client_Console_Player; SCRIPTS_API bool Can_Team_Build_Vehicle(int Team) { diff -urN sourceold/scripts/engine_tt.h source/scripts/engine_tt.h --- sourceold/scripts/engine_tt.h 2022-11-19 15:40:12.627144200 -0600 +++ source/scripts/engine_tt.h 2022-11-19 19:00:10.301223500 -0600 @@ -229,6 +229,15 @@ typedef ScriptedDialogClass* (*idlg) (int id); typedef void (*dlg) (ScriptedDialogClass* dialog); typedef void (*dhwg) (GameObject* obj, int weapon, int rounds); +typedef const char* (*gru) (); +typedef void (*sru) (const char* url); +typedef void (*tss) (int playerID); +typedef bool (*iips) (Vector3 point, float maxDistance); +typedef void (*sgm) (GameObject* obj, float multiplier); +typedef bool (*iga) (); +typedef void (*sga) (bool allowed); +typedef void (*pcc) (const char* text, Vector4 argb_color); +typedef void (*pccp) (GameObject* player, const char* text, Vector4 argb_color); SCRIPTS_API extern gpl Get_Player_List; SCRIPTS_API extern gcmi Get_Current_Map_Index; SCRIPTS_API extern gm Get_Map; @@ -461,6 +470,17 @@ SCRIPTS_API extern dlg Delete_Dialog; SCRIPTS_API extern dhwg Display_HUD_Weapon_Grant_Player; SCRIPTS_API extern dhwg Display_HUD_Ammo_Grant_Player; +SCRIPTS_API extern gru Get_Repository_URL; +SCRIPTS_API extern sru Set_Repository_URL; +SCRIPTS_API extern gru Get_Screenshot_URL; +SCRIPTS_API extern sru Set_Screenshot_URL; +SCRIPTS_API extern tss Take_Screenshot; +SCRIPTS_API extern iips Is_In_Pathfind_Sector; +SCRIPTS_API extern sgm Set_Gravity_Multiplier; +SCRIPTS_API extern iga Is_Gameplay_Allowed; +SCRIPTS_API extern sga Set_Gameplay_Allowed; +SCRIPTS_API extern pcc Print_Client_Console; +SCRIPTS_API extern pccp Print_Client_Console_Player; class SCRIPTS_API JFW_Key_Hook_Base : public ScriptImpClass { public: diff -urN sourceold/scripts/gap.cpp source/scripts/gap.cpp --- sourceold/scripts/gap.cpp 2022-11-19 15:40:12.780882800 -0600 +++ source/scripts/gap.cpp 2022-11-19 19:00:10.304850000 -0600 @@ -204,16 +204,19 @@ void RA_Gap_Generator_Building::Created(GameObject *obj) { + enabled = false; GameObject *GapControl = Find_Object_By_Preset(2, Get_Parameter("Gap_Controller")); if (!Get_Int_Parameter("Team")) { Commands->Send_Custom_Event(obj, GapControl, 1000, Get_Int_Parameter("Stealth_Range"), 2); Commands->Send_Custom_Event(obj, GapControl, 2222, 3, 3); + enabled = true; } else if (Get_Int_Parameter("Team") == 1) { Commands->Send_Custom_Event(obj, GapControl, 1111, Get_Int_Parameter("Stealth_Range"), 2); Commands->Send_Custom_Event(obj, GapControl, 2222, 3, 3); + enabled = true; } shroudID = 0; sizeID = 0; @@ -231,20 +234,44 @@ { if (number == Get_Int_Parameter("Timer_Number")) { - if (!Is_Base_Powered(Get_Object_Type(obj))) - { - GameObject *GapControl = Find_Object_By_Preset(2, Get_Parameter("Gap_Controller")); - Commands->Send_Custom_Event(obj, GapControl, 2222, 2, 0); - if (shroudID) - { - Commands->Destroy_Object(Commands->Find_Object(shroudID)); - shroudID = 0; - } - if (sizeID) - { - Commands->Destroy_Object(Commands->Find_Object(sizeID)); - sizeID = 0; - } + if (!enabled && Is_Base_Powered(Get_Object_Type(obj))) + { + GameObject *GapControl = Find_Object_By_Preset(2, Get_Parameter("Gap_Controller")); + Commands->Send_Custom_Event(obj, GapControl, 2222, 1, 0); //Activate Stealth Field + + if (!shroudID) + { + Vector3 position = Commands->Get_Bone_Position(obj, "ROOTTRANSFORM"); + GameObject *object = Commands->Create_Object(Get_Parameter("ShroudPreset"), position); + Commands->Set_Player_Type(object,Commands->Get_Player_Type(obj)); + Commands->Attach_To_Object_Bone(object, obj, "ROOTTRANSFORM"); + shroudID = Commands->Get_ID(object); + } + if (!sizeID) + { + Vector3 position = Commands->Get_Bone_Position(obj, "ROOTTRANSFORM"); + GameObject *object = Commands->Create_Object(Get_Parameter("SizePreset"), position); + Commands->Set_Player_Type(object,Commands->Get_Player_Type(obj)); + Commands->Attach_To_Object_Bone(object, obj, "ROOTTRANSFORM"); + sizeID = Commands->Get_ID(object); + } + enabled = true; + } + else if(enabled && !Is_Base_Powered(Get_Object_Type(obj))) + { + GameObject *GapControl = Find_Object_By_Preset(2, Get_Parameter("Gap_Controller")); + Commands->Send_Custom_Event(obj, GapControl, 2222, 0, 0); //Deactivate Stealth Field + if (shroudID) + { + Commands->Destroy_Object(Commands->Find_Object(shroudID)); + shroudID = 0; + } + if (sizeID) + { + Commands->Destroy_Object(Commands->Find_Object(sizeID)); + sizeID = 0; + } + enabled = false; } Commands->Start_Timer(obj, this, 2, Get_Int_Parameter("Timer_Number")); } diff -urN sourceold/scripts/gap.h source/scripts/gap.h --- sourceold/scripts/gap.h 2022-11-19 15:40:12.795524900 -0600 +++ source/scripts/gap.h 2022-11-19 19:00:10.304850000 -0600 @@ -25,6 +25,7 @@ class RA_Gap_Generator_Building : public ScriptImpClass { unsigned long shroudID; unsigned long sizeID; + bool enabled; void Created(GameObject *obj); void Timer_Expired(GameObject *obj, int number); void Killed(GameObject *obj, GameObject *killer); diff -urN sourceold/scripts/gmgame.cpp source/scripts/gmgame.cpp --- sourceold/scripts/gmgame.cpp 2022-11-19 15:40:12.854685000 -0600 +++ source/scripts/gmgame.cpp 2022-11-19 19:00:10.306830400 -0600 @@ -75,6 +75,7 @@ SCRIPTS_API bool SBHCanPickupDropWeapons = 1; SCRIPTS_API bool CharactersDropDNA = 1; SCRIPTS_API bool ShowExtraMessages = 1; +SCRIPTS_API bool MapExtraKillMessages = false; SCRIPTS_API bool IsPresetDisabled(int preset) { @@ -723,6 +724,7 @@ { RegisteredEvents[EVENT_MAP_INI][i]->OnLoadMapINISettings(SSGMIni); } + MapExtraKillMessages = SSGMIni->Get_Bool(s,"ExtraKillMessages",ExtraKillMessages); delete[] s; } else diff -urN sourceold/scripts/gmgame.h source/scripts/gmgame.h --- sourceold/scripts/gmgame.h 2022-11-19 15:40:12.868518200 -0600 +++ source/scripts/gmgame.h 2022-11-19 19:00:10.306830400 -0600 @@ -209,4 +209,5 @@ SCRIPTS_API extern float PowerupExpireTime; SCRIPTS_API extern float WreckDestroySelfTime; SCRIPTS_API extern bool VehicleLockIcons; +SCRIPTS_API extern bool MapExtraKillMessages; #endif diff -urN sourceold/scripts/gmsoldier.cpp source/scripts/gmsoldier.cpp --- sourceold/scripts/gmsoldier.cpp 2022-11-19 15:40:12.916580500 -0600 +++ source/scripts/gmsoldier.cpp 2022-11-19 19:00:10.309843200 -0600 @@ -316,7 +316,7 @@ Log_Killed_Message(obj, killer, "SOLDIER"); Unbind_Vehicle(obj, true); - if (ExtraKillMessages) + if (MapExtraKillMessages) { if (Commands->Get_ID(killer) == 0) { diff -urN sourceold/scripts/jmgBearHunter.cpp source/scripts/jmgBearHunter.cpp --- sourceold/scripts/jmgBearHunter.cpp 2022-11-19 15:40:13.553412500 -0600 +++ source/scripts/jmgBearHunter.cpp 2022-11-19 19:00:10.339039800 -0600 @@ -641,6 +641,7 @@ Commands->Attach_Script(obj,"JMG_Bear_Hunter_Armored_Car_Controller",""); Commands->Attach_Script(obj,"JMG_Utility_Basic_Spawner_In_Radius","Skittish_Animal_Wander_Point,0.1,0.0,500,0.0,450.0,0.0,500.0,0.0 0.0 -1000.0,1.0,1.0,1,5,0.25,-1,-1,-1,1,1,0.0 0.0 1.0,0.0,1,5.0,1,0,0,0.0 0.0 0.0,-1,0.0"); Commands->Attach_Script(obj,"JMG_Utility_Basic_Spawner_In_Radius","AI_Mouse_Wanderpoint,0.1,0.0,250,0.0,135.0,0.0,250.0,0.0 -703.0 -1000.0,1.0,1.0,1,5,0.25,-1,-1,-1,1,1,0.0 0.0 1.0,0.0,1,5.0,1,0,0,0.0 0.0 0.0,-1,0.0"); + Commands->Attach_Script(obj,"JMG_Utility_Sync_Fog_Controller","10.0,300.0"); } void JMG_Bear_Hunter_Game_Control::Timer_Expired(GameObject *obj,int number) { @@ -997,6 +998,8 @@ Commands->Set_Clouds(1.0f,1.0f,250.0f); Commands->Set_Lightning(0.15f,0.6f,1.0f,0.0f,1.0f,250.0f); Commands->Set_Fog_Range(10.0f,150.0f,250.0f); + JMG_Utility_Sync_Fog_Controller::min = 10.0f; + JMG_Utility_Sync_Fog_Controller::max = 150.0f; for (int x = 1;x < 128;x++) { GameObject *player = Get_GameObj(x); @@ -2931,6 +2934,8 @@ else floodLightId = 0; stealthModeOverride = Get_Int_Parameter("StealthModeOverride"); + canOnlySeeTargetScript = Get_Int_Parameter("CanOnlyTargetCameraTargets") == 1 ? true : false; + minDistanceSquared = Get_Float_Parameter("MinSightDistance")*Get_Float_Parameter("MinSightDistance"); Commands->Enable_Enemy_Seen(obj,true); Commands->Enable_Hibernation(obj,false); Commands->Start_Timer(obj,this,0.25f,1); @@ -2939,14 +2944,19 @@ { if (!Commands->Get_Health(seen)) return; - if (Is_Script_Attached(seen,"JMG_Security_Camera_Behavior_Ignore")) + if (canOnlySeeTargetScript && !Is_Script_Attached(seen,"JMG_Security_Camera_Behavior_Target")) + return; + if (Is_Script_Attached(seen,"JMG_Security_Camera_Behavior_Ignore") && !(canOnlySeeTargetScript && Is_Script_Attached(seen,"JMG_Security_Camera_Behavior_Target"))) return; if (!JmgUtility::CanSeeStealth(stealthModeOverride,obj,seen)) return; int seenID = Commands->Get_ID(seen); + Vector3 pos = Commands->Get_Position(obj); + if (minDistanceSquared && JmgUtility::SimpleDistance(pos,Commands->Get_Position(seen)) < minDistanceSquared) + return; if (!EnemyID) { - Commands->Create_Sound(Get_Parameter("Alarm_Sound"),Commands->Get_Position(obj),obj); + Commands->Create_Sound(Get_Parameter("Alarm_Sound"),pos,obj); SeenTime = 10; EnemyID = seenID; ActionParamsStruct params; @@ -8432,6 +8442,20 @@ *facing = node->facing; return true; } +bool JMG_Utility_Basic_Spawner_Wander_Point::Get_A_Defense_Point(Vector3 *position,float *facing) +{ + Rp2SimplePositionSystem::SimplePositionNode *node = NULL; + if (wanderPointGroup != -1) + node = JMG_Wandering_AI_Controller::wanderPoints.GetRandomFromGroup(wanderPointGroup); + if (!node) + { + Console_Input("msg JMG_Utility_Basic_Spawner ERROR: No wander points could be found for that group!"); + return false; + } + *position = node->position; + *facing = node->facing; + return true; +} bool JMG_Utility_Custom_Teleport_To_Random_Wander_Point::Get_A_Defense_Point(Vector3 *position,float *facing) { Rp2SimplePositionSystem::SimplePositionNode *node = NULL; @@ -9458,13 +9482,16 @@ BearHunterVoiceSystem::PlayVoice("BH102.mp3","Bear Rug Co: Looks like you found some turkeys, bring them to the processing plant for market price."); NewObjectiveSystemControl.Add_Objective(28,NewObjectiveSystem::Bonus,NewObjectiveSystem::Pending,12864,"",12864); } +void JMG_Security_Camera_Behavior_Target::Created(GameObject *obj) +{ +} ScriptRegistrant JMG_Bear_Hunter_Player_Soldier_Registrant("JMG_Bear_Hunter_Player_Soldier",""); ScriptRegistrant JMG_Rp2_Dedicated_Server_Sound_Emulator_Registrant("JMG_Rp2_Dedicated_Server_Sound_Emulator",""); ScriptRegistrant JMG_Bear_Hunter_Game_Control_Registrant("JMG_Bear_Hunter_Game_Control","PositionFile=DhSwampDeerPositions.ecw:string"); ScriptRegistrant JMG_Rp2_Hostile_Mutant_AI_Registrant("JMG_Rp2_Hostile_Mutant_AI",""); ScriptRegistrant JMG_Bear_Hunt_Mutant_Attacker_Registrant("JMG_Bear_Hunt_Mutant_Attacker","Speed:float"); ScriptRegistrant JMG_Bear_Hunter_Animal_Control_Registrant("JMG_Bear_Hunter_Animal_Control",""); -ScriptRegistrant JMG_Security_Camera_Behavior_Registrant("JMG_Security_Camera_Behavior","Angle:float,Alarm_ID=0:int,Is_Gun=1:int,Delay=0:float,Alarm_Message=0:int,Alarm_Sound=Beep:string,UpdateRateMultiplier=1.0:float,IdleAimZAngleModifier=0.0:float,FloodLightPreset=null:string,Power_Message=0:int,StealthModeOverride=0:int"); +ScriptRegistrant JMG_Security_Camera_Behavior_Registrant("JMG_Security_Camera_Behavior","Angle:float,Alarm_ID=0:int,Is_Gun=1:int,Delay=0:float,Alarm_Message=0:int,Alarm_Sound=Beep:string,UpdateRateMultiplier=1.0:float,IdleAimZAngleModifier=0.0:float,FloodLightPreset=null:string,Power_Message=0:int,StealthModeOverride=0:int,CanOnlyTargetCameraTargets=0:int,MinSightDistance=0.0:float"); ScriptRegistrant JMG_Bear_Hunt_Mutant_Cat_Explosion_Registrant("JMG_Bear_Hunt_Mutant_Cat_Explosion","KillSelfExplosion:string,KilledExplosion:string"); ScriptRegistrant JMG_Bear_Hunter_President_Controller_Registrant("JMG_Bear_Hunter_President_Controller",""); ScriptRegistrant JMG_Bear_Hunter_Turret_Death_Alert_Registrant("JMG_Bear_Hunter_Turret_Death_Alert",""); @@ -9561,3 +9588,4 @@ ScriptRegistrant JMG_Bear_Hunter_Give_AI_Cash_For_Kills_Registrant("JMG_Bear_Hunter_Give_AI_Cash_For_Kills",""); ScriptRegistrant JMG_Wandering_AI_Wander_Point_Follow_Weapon_Or_Obj_Registrant("JMG_Wandering_AI_Wander_Point_Follow_Weapon_Or_Obj","GroupId:int,PresetName:string,WeaponName:string"); ScriptRegistrant JMG_Bear_Hunter_Turkey_Registrant("JMG_Bear_Hunter_Turkey",""); +ScriptRegistrant JMG_Security_Camera_Behavior_Target_Registrant("JMG_Security_Camera_Behavior_Target",""); diff -urN sourceold/scripts/jmgBearHunter.h source/scripts/jmgBearHunter.h --- sourceold/scripts/jmgBearHunter.h 2022-11-19 15:40:13.572648500 -0600 +++ source/scripts/jmgBearHunter.h 2022-11-19 19:00:10.341011900 -0600 @@ -2309,6 +2309,8 @@ float cameraAngles[5]; float CameraFacingUpdateTime; float idleZAimAngleModifier; + float minDistanceSquared; + bool canOnlySeeTargetScript; void Created(GameObject *obj); void Enemy_Seen(GameObject *obj,GameObject *seen); void Timer_Expired(GameObject *obj,int number); @@ -3692,7 +3694,6 @@ void Killed(GameObject *obj,GameObject *killer); }; - /*! * \brief Makes a wander point follow an object on the map * \GroupId - ID of the group the point belongs to @@ -3713,4 +3714,13 @@ class JMG_Bear_Hunter_Turkey : public ScriptImpClass { void Killed(GameObject *obj,GameObject *killer); +}; + +/*! +* \If the security camera script has CanOnlyTargetCameraTargets set this script is needed for a target to be visible +* \author jgray +* \ingroup JmgUtility +*/ +class JMG_Security_Camera_Behavior_Target : public ScriptImpClass { + void Created(GameObject *obj); }; \ No newline at end of file diff -urN sourceold/scripts/jmgUtility.cpp source/scripts/jmgUtility.cpp --- sourceold/scripts/jmgUtility.cpp 2022-11-19 15:40:13.679745700 -0600 +++ source/scripts/jmgUtility.cpp 2022-11-19 19:00:10.345638400 -0600 @@ -351,6 +351,7 @@ if (number == 2) { Force_Position_Update(obj); + Force_Orientation_Update(obj); } } void JMG_Utility_Sync_System_Object::Killed(GameObject *obj,GameObject *killer) @@ -421,6 +422,7 @@ if (number == 1) { Force_Position_Update(obj); + Force_Orientation_Update(obj); Commands->Start_Timer(obj,this,Get_Float_Parameter("Sync_Rate"),1); } } @@ -441,7 +443,7 @@ { if (number == 1) { - if (!spawnedId && respawnTime > 0 && spawnLimit && enabled) + if (!spawnedId && respawnTime > 0 && spawnLimit && enabled && !The_Game()->Is_Game_Over()) { respawnTime -= 0.1f; if (respawnTime <= 0) @@ -8625,7 +8627,9 @@ id = Get_Int_Parameter("ID"); message = Get_Int_Parameter("Message"); param = Get_Int_Parameter("Param"); - Commands->Start_Timer(obj,this,time,1); + enableCustom = Get_Int_Parameter("EnableCustom"); + if (!enableCustom) + Commands->Start_Timer(obj,this,time,1); } void JMG_Utility_Timer_Custom::Timer_Expired(GameObject *obj,int number) { @@ -8638,6 +8642,16 @@ Commands->Start_Timer(obj,this,time,1); } } +void JMG_Utility_Timer_Custom::Custom(GameObject *obj,int message,int param,GameObject *sender) +{ + if (enableCustom && enableCustom == message) + { + if (param) + Commands->Start_Timer(obj,this,time,1); + else + Stop_Timer(obj,1); + } +} void JMG_Utility_Zone_Change_Character_Model::Created(GameObject *obj) { playerType = Get_Int_Parameter("PlayerType"); @@ -9182,12 +9196,16 @@ sprintf(bone,"%s",Get_Parameter("Bone")); owner = Get_Int_Parameter("Owner"); custom = Get_Int_Parameter("Custom"); + alive = Get_Int_Parameter("Alive") ? true : false; } void JMG_Utility_Custom_Create_Explosion_At_Bone::Custom(GameObject *obj,int message,int param,GameObject *sender) { if (message == custom) { - Commands->Create_Explosion_At_Bone(explosion,obj,bone,!owner ? obj : (owner == -1 ? sender : Commands->Find_Object(owner))); + GameObject *exploder = !owner ? obj : (owner == -1 ? sender : Commands->Find_Object(owner)); + if (alive && (!exploder || !Commands->Get_Health(exploder))) + return; + Commands->Create_Explosion_At_Bone(explosion,obj,bone,exploder); } } void JMG_Utility_Custom_Send_Custom_Repeat_Ignore_Time::Created(GameObject *obj) @@ -9662,9 +9680,9 @@ void JMG_Utility_Basic_Spawner_In_Radius::Created(GameObject *obj) { attachScriptsGroupId = Get_Int_Parameter("Attach_Scripts_Group_ID"); - scriptId = Get_Int_Parameter("Script_ID"); - if (scriptId == -1) - scriptId = this->Get_ID(); + spawnedObjectScriptID = Get_Int_Parameter("Spawned_Object_Script_ID"); + if (spawnedObjectScriptID == -1) + spawnedObjectScriptID = this->Get_ID(); spawnedObjects = 0; spawnLocation = Get_Vector3_Parameter("Spawn_Location"); if (spawnLocation.X == -1.0f && spawnLocation.Y == -1.0f) @@ -9676,7 +9694,7 @@ spawnLocation.Z = mypos.Z; } spawnAtATime = Get_Int_Parameter("Spawn_At_A_Time"); - spawnLimit = Get_Int_Parameter("Spawn_Limit"); + maxTotalSpawned = Get_Int_Parameter("Max_Total_Spawned"); minRadius = Get_Float_Parameter("Min_Spawn_Radius"); maxRadius = Get_Float_Parameter("Max_Spawn_Radius"); initialSpawnHeight = Get_Float_Parameter("Initial_Spawn_Height"); @@ -9708,6 +9726,8 @@ if (enabled) Initial_Spawn(obj); Commands->Start_Timer(obj,this,rate+(randomRate ? Commands->Get_Random(-randomRate,randomRate) : 0.0f),1); + lastPlayerCount = 0; + Commands->Start_Timer(obj,this,2.5f,3); } void JMG_Utility_Basic_Spawner_In_Radius::Timer_Expired(GameObject *obj,int number) { @@ -9724,28 +9744,42 @@ else Commands->Start_Timer(obj,this,0.1f,1); } + if (number == 3 && !The_Game()->Is_Game_Over()) + { + int change = GetPlayerLimitModifier()-lastPlayerCount; + lastPlayerCount = change; + for (int x = 0;x < change;x++) + Commands->Send_Custom_Event(obj,obj,6873525,spawnedObjectScriptID,0.1f); + Commands->Start_Timer(obj,this,2.5f,3); + } } void JMG_Utility_Basic_Spawner_In_Radius::Custom(GameObject *obj,int message,int param,GameObject *sender) { - if (changeSpawnCapCustom == -1 && message == changeSpawnCapCustom) + if (changeSpawnCapCustom && message == changeSpawnCapCustom) { + int change = param-spawnAtATime; spawnAtATime = param; + for (int x = 0;x < change;x++) + Commands->Send_Custom_Event(obj,obj,6873525,spawnedObjectScriptID,0.1f); } - if (message == 6873523 && param == scriptId) + if (message == 6873523 && param == spawnedObjectScriptID) { spawnedObjects++; } - if (message == 6873524 && param == scriptId) + if (message == 6873524 && param == spawnedObjectScriptID) { - spawnedObjects--; - Commands->Send_Custom_Event(obj,obj,6873525,scriptId,rate+(randomRate ? Commands->Get_Random(-randomRate,randomRate) : 0.0f)); + if (spawnedObjects > 0) + spawnedObjects--; + Commands->Send_Custom_Event(obj,obj,6873525,spawnedObjectScriptID,rate+(randomRate ? Commands->Get_Random(-randomRate,randomRate) : 0.0f)); } - if (message == 6873525 && param == scriptId) + if (message == 6873525 && param == spawnedObjectScriptID && !The_Game()->Is_Game_Over()) { - if (!enabled || AttemptSpawn(obj) == SpawnFailureTypes::SPAWN_BLOCKED) - Commands->Send_Custom_Event(obj,obj,6873525,scriptId,0.1f); + if (!enabled) + return; + if (AttemptSpawn(obj) == SpawnFailureTypes::SPAWN_BLOCKED) + Commands->Send_Custom_Event(obj,obj,6873525,spawnedObjectScriptID,0.1f); } - if (enableDisableCustom && message == enableDisableCustom) + if (enableDisableCustom && message == enableDisableCustom && !The_Game()->Is_Game_Over()) { enabled = param != 0 ? true : false; if (param == 1) @@ -9756,7 +9790,7 @@ { if (!(spawnedObjects < spawnAtATime+GetPlayerLimitModifier())) return SpawnFailureTypes::LIMIT_REACHED; - if (!((spawnLimit >= 0 && spawnCount < spawnLimit) || spawnLimit < 0)) + if (!((maxTotalSpawned >= 0 && spawnCount < maxTotalSpawned) || maxTotalSpawned < 0)) return SpawnFailureTypes::LIMIT_REACHED; float distance = (minRadius < maxRadius ? Commands->Get_Random(minRadius,maxRadius) : minRadius); float facing = Commands->Get_Random(-180.0f,180.0f); @@ -9836,7 +9870,7 @@ } spawnCount++; char params[512]; - sprintf(params,"%d,%d,%d",Commands->Get_ID(obj),scriptId,spawnGroupId); + sprintf(params,"%d,%d,%d",Commands->Get_ID(obj),spawnedObjectScriptID,spawnGroupId); Commands->Attach_Script(spawned,"JMG_Utility_Basic_Spawner_In_Radius_Attached",params); Commands->Send_Custom_Event(spawned,obj,6873522,attachScriptsGroupId,0.0f); return SpawnFailureTypes::SUCCESS; @@ -9851,6 +9885,7 @@ void JMG_Utility_Basic_Spawner_In_Radius::Initial_Spawn(GameObject *obj) { int addSpawn = GetPlayerLimitModifier(); + lastPlayerCount = addSpawn; for (int x = spawnedObjects;x < initialSpawn+addSpawn;x++) { JMG_Utility_Basic_Spawner_In_Radius::SpawnFailureTypes spawnResult; @@ -9863,7 +9898,7 @@ x = initialSpawn+1+addSpawn; } if (spawnResult == SpawnFailureTypes::SPAWN_BLOCKED) - Commands->Send_Custom_Event(obj,obj,6873525,scriptId,0.1f); + Commands->Send_Custom_Event(obj,obj,6873525,spawnedObjectScriptID,0.1f); if (initialSpawn < spawnAtATime) { Stop_Timer(obj,1); @@ -9909,7 +9944,7 @@ sentCreateMessage = true; GameObject *controller = Commands->Find_Object(Get_Int_Parameter("Controller_ID")); if (controller) - Commands->Send_Custom_Event(obj,controller,6873523,Get_Int_Parameter("Script_ID"),0.0f); + Commands->Send_Custom_Event(obj,controller,6873523,Get_Int_Parameter("Spawned_Object_Script_ID"),0.0f); AddSpawnedObjectToGroup(obj); } void JMG_Utility_Basic_Spawner_In_Radius_Attached::Destroyed(GameObject *obj) @@ -9919,7 +9954,7 @@ sentDeathMessage = true; GameObject *controller = Commands->Find_Object(Get_Int_Parameter("Controller_ID")); if (controller) - Commands->Send_Custom_Event(obj,controller,6873524,Get_Int_Parameter("Script_ID"),0.0f); + Commands->Send_Custom_Event(obj,controller,6873524,Get_Int_Parameter("Spawned_Object_Script_ID"),0.0f); } void JMG_Utility_Basic_Spawner_In_Radius_Attached::AddSpawnedObjectToGroup(GameObject *spawned) { @@ -10197,18 +10232,20 @@ { custom = Get_Int_Parameter("Custom"); position = Get_Vector3_Parameter("Position"); + id = Get_Int_Parameter("ID"); } void JMG_Utility_Custom_Set_Position::Custom(GameObject *obj,int message,int param,GameObject *sender) { if (message == custom) { - Commands->Set_Position(obj,position); - if (obj->As_ScriptZoneGameObj()) + GameObject *target = id ? Commands->Find_Object(id) : obj; + Commands->Set_Position(target,position); + if (target->As_ScriptZoneGameObj()) { - OBBoxClass *zone = Get_Zone_Box(obj); + OBBoxClass *zone = Get_Zone_Box(target); zone->Center = position; - JmgUtility::RotateZoneBox(Commands->Get_Facing(obj),zone->Basis); - Set_Zone_Box(obj,*zone); + JmgUtility::RotateZoneBox(Commands->Get_Facing(target),zone->Basis); + Set_Zone_Box(target,*zone); } } } @@ -13029,7 +13066,7 @@ bool JMG_Utility_Control_Point_Controller::allSetupComplete = false; void JMG_Utility_Control_Point_Controller::Created(GameObject *obj) { - JMG_Utility_Control_Point_Controller::controlPointTeamData.Add_Tail(new JMG_Utility_Control_Point_Controller::ControlPointTeamData(-2,Get_Parameter("NeutralTeamName"),Get_Int_Parameter("NeutralPlayerType"),Get_Int_Parameter("NeutralRadarBlipColor"),Get_Parameter("NeutralDefaultPointModel"),Get_Parameter("NeutralDefaultAnimation"),Get_Float_Parameter("NeutralAnimationLength"),Get_Parameter("NeutralCaptureSound"),Get_Parameter("NeutralLostSound"),Get_Parameter("NeutralLockedModel"),Get_Parameter("NeutralLockedAnim"),Get_Float_Parameter("NeutralLockedAnimLength"),Get_Int_Parameter("NeutralDefenseMultiplier"),Get_Int_Parameter("NeutralCaptureMultiplier"),Get_Int_Parameter("NeutralUnoccupiedMultiplier"))); + JMG_Utility_Control_Point_Controller::controlPointTeamData.Add_Tail(new JMG_Utility_Control_Point_Controller::ControlPointTeamData(-2,Get_Parameter("NeutralTeamName"),Get_Int_Parameter("NeutralPlayerType"),Get_Int_Parameter("NeutralRadarBlipColor"),Get_Parameter("NeutralDefaultPointModel"),Get_Parameter("NeutralDefaultAnimation"),Get_Float_Parameter("NeutralAnimationLength"),Get_Parameter("NeutralCaptureSound"),Get_Parameter("NeutralLostSound"),Get_Parameter("NeutralLockedModel"),Get_Parameter("NeutralLockedAnim"),Get_Float_Parameter("NeutralLockedAnimLength"),Get_Int_Parameter("NeutralDefenseMultiplier"),Get_Int_Parameter("NeutralCaptureMultiplier"),Get_Int_Parameter("NeutralUnoccupiedMultiplier"),Get_Int_Parameter("NeutralCustomID"),Get_Int_Parameter("NeutralTeamMemberCaptureCustom"),Get_Int_Parameter("NeutralTeamMembmerLostCustom"),Get_Int_Parameter("NeutralTeamCaptureCustom"),Get_Int_Parameter("NeutralTeamLostCustom"),Get_Int_Parameter("NeutralTeamMemberNeutralize"))); Commands->Start_Timer(obj,this,0.1f,1); } void JMG_Utility_Control_Point_Controller::Timer_Expired(GameObject *obj,int number) @@ -13071,7 +13108,7 @@ Console_Input("msg JMG_Utility_Control_Point_Team_Setting ERROR: Team -2 is reserved for team neutral!"); return; } - JMG_Utility_Control_Point_Controller::controlPointTeamData.Add_Tail(new JMG_Utility_Control_Point_Controller::ControlPointTeamData(Get_Int_Parameter("TeamID"),Get_Parameter("TeamName"),Get_Int_Parameter("PlayerType"),Get_Int_Parameter("RadarBlipColor"),Get_Parameter("PointModel"),Get_Parameter("Animation"),Get_Float_Parameter("AnimationLength"),Get_Parameter("CaptureSound"),Get_Parameter("LostSound"),Get_Parameter("LockedModel"),Get_Parameter("LockedAnim"),Get_Float_Parameter("LockedAnimLength"),Get_Int_Parameter("DefenseMultiplier"),Get_Int_Parameter("CaptureMultiplier"),Get_Int_Parameter("UnoccupiedMultiplier"))); + JMG_Utility_Control_Point_Controller::controlPointTeamData.Add_Tail(new JMG_Utility_Control_Point_Controller::ControlPointTeamData(Get_Int_Parameter("TeamID"),Get_Parameter("TeamName"),Get_Int_Parameter("PlayerType"),Get_Int_Parameter("RadarBlipColor"),Get_Parameter("PointModel"),Get_Parameter("Animation"),Get_Float_Parameter("AnimationLength"),Get_Parameter("CaptureSound"),Get_Parameter("LostSound"),Get_Parameter("LockedModel"),Get_Parameter("LockedAnim"),Get_Float_Parameter("LockedAnimLength"),Get_Int_Parameter("DefenseMultiplier"),Get_Int_Parameter("CaptureMultiplier"),Get_Int_Parameter("UnoccupiedMultiplier"),Get_Int_Parameter("CustomID"),Get_Int_Parameter("TeamMemberCaptureCustom"),Get_Int_Parameter("TeamMembmerLostCustom"),Get_Int_Parameter("TeamCaptureCustom"),Get_Int_Parameter("TeamLostCustom"),Get_Int_Parameter("TeamMemberNeutralize"))); Destroy_Script(); } void JMG_Utility_Control_Point::Created(GameObject *obj) @@ -13321,6 +13358,13 @@ sprintf(LostMessage,"%s lost control of %s!",lastTeam->teamName,controlPointName); JmgUtility::MessageAllPlayers(127,255,127,LostMessage); Commands->Create_2D_Sound(lastTeam->lostSound); + SendCustomToAllInRange(obj,lastTeam->customId,lastTeam->teamId,lastTeam->teamMembmerLostCustom); + if (lastTeam->teamLostCustom) + { + GameObject *object = lastTeam->customId ? Commands->Find_Object(lastTeam->customId) : obj; + Commands->Send_Custom_Event(obj,object,lastTeam->teamLostCustom,0,0); + } + SendNeutralizeToAllInRange(obj,lastTeam->teamId); if (lastTeamOverride) { GameObject *object = lastTeamOverride->id ? Commands->Find_Object(lastTeamOverride->id) : obj; @@ -13338,6 +13382,12 @@ JmgUtility::MessageAllPlayers(127,255,127,CapMessage); Commands->Create_2D_Sound(controllingTeam->captureSound); GrantPointsToTeamMembersInRange(obj,captureScore,true); + SendCustomToAllInRange(obj,controllingTeam->customId,controllingTeam->teamId,controllingTeam->teamMemberCaptureCustom); + if (controllingTeam->teamCaptureCustom) + { + GameObject *object = controllingTeam->customId ? Commands->Find_Object(controllingTeam->customId) : obj; + Commands->Send_Custom_Event(obj,object,controllingTeam->teamCaptureCustom,0,0); + } if (controllingTeamOverride) { GameObject *object = controllingTeamOverride->id ? Commands->Find_Object(controllingTeamOverride->id) : obj; @@ -13376,6 +13426,57 @@ Commands->Give_Points(o,GivePoints,true); } } +void JMG_Utility_Control_Point::SendCustomToAllInRange(GameObject *obj,int id,int teamId,int custom) +{ + if (!custom) + return; + Vector3 pos = Commands->Get_Position(obj); + for (SLNode *current = GameObjManager::SmartGameObjList.Head();current;current = current->Next()) + { + SmartGameObj* o = current->Data(); + if (!o) + continue; + Vector3 unitPos = Commands->Get_Position(o); + if (controlHeightMinMax.X && (pos.Z + controlHeightMinMax.X) > unitPos.Z) + continue; + if (controlHeightMinMax.Y && (pos.Z + controlHeightMinMax.Y) < unitPos.Z) + continue; + if (JmgUtility::SimpleDistance(pos,unitPos) > controlDistance) + continue; + JMG_Utility_Control_Point_Team_Member *unitScript = (JMG_Utility_Control_Point_Team_Member*)Find_Script_On_Object(o,"JMG_Utility_Control_Point_Team_Member"); + if (!unitScript || !unitScript->setupComplete) + continue; + if (unitScript->teamData->teamId == teamId) + { + GameObject *object = id ? Commands->Find_Object(id) : obj; + Commands->Send_Custom_Event(o,object,custom,0,0); + } + } +} +void JMG_Utility_Control_Point::SendNeutralizeToAllInRange(GameObject *obj,int teamId) +{ + Vector3 pos = Commands->Get_Position(obj); + for (SLNode *current = GameObjManager::SmartGameObjList.Head();current;current = current->Next()) + { + SmartGameObj* o = current->Data(); + if (!o) + continue; + Vector3 unitPos = Commands->Get_Position(o); + if (controlHeightMinMax.X && (pos.Z + controlHeightMinMax.X) > unitPos.Z) + continue; + if (controlHeightMinMax.Y && (pos.Z + controlHeightMinMax.Y) < unitPos.Z) + continue; + if (JmgUtility::SimpleDistance(pos,unitPos) > controlDistance) + continue; + JMG_Utility_Control_Point_Team_Member *unitScript = (JMG_Utility_Control_Point_Team_Member*)Find_Script_On_Object(o,"JMG_Utility_Control_Point_Team_Member"); + if (!unitScript || !unitScript->setupComplete) + continue; + if (unitScript->teamData->teamId == teamId || !unitScript->teamData->teamMemberNeutralize) + continue; + GameObject *object = unitScript->teamData->customId ? Commands->Find_Object(unitScript->teamData->customId) : obj; + Commands->Send_Custom_Event(o,object,unitScript->teamData->teamMemberNeutralize,0,0); + } +} void JMG_Utility_Control_Point::Destroyed(GameObject *obj) { controlPointSettingOverride.Remove_All(); @@ -13686,6 +13787,8 @@ } if (number == 2) { + if (The_Game()->Is_Game_Over()) + return; if (selectedCpId) { GameObject *controlPoint = Commands->Find_Object(selectedCpId); @@ -13735,15 +13838,17 @@ { if (message == spawnCustom) { - if (spawnTime) + if (spawnTime || The_Game()->Is_Game_Over()) return; - Set_HUD_Help_Text_Player_Text(obj,stringId,"",Vector3(1.0f,0.5f,0.0f)); + Set_HUD_Help_Text_Player_Text(obj,stringId," ",Vector3(1.0f,0.5f,0.0f)); Set_Screen_Fade_Opacity_Player(obj,0.0f,0.1f); Change_Character(obj,Get_Parameter("SpawnPreset")); obj->As_SoldierGameObj()->Set_Collision_Group(Collision_Group_Type::SOLDIER_GHOST_COLLISION_GROUP); } if (message == groupChangeCustom) { + if (The_Game()->Is_Game_Over()) + return; if (lastSpawnGroup != JMG_Utility_Control_Point_Assault_Mode::spawnGroup) controlPointId = 0; lastSpawnGroup = JMG_Utility_Control_Point_Assault_Mode::spawnGroup; @@ -13751,6 +13856,8 @@ } if (message == ungroupedChangeCustom) { + if (The_Game()->Is_Game_Over()) + return; selectedCpId = ungroupedControlPointId = SelectCpToSpawnFrom(obj,ungroupedControlPointId,false); } } @@ -14619,6 +14726,8 @@ } void JMG_Utility_Custom_Play_Animation_Send_Custom_When_Complete::Animation_Complete(GameObject *obj,const char *anim) { + if (_stricmp(anim,animation)) + return; if (obj->As_SoldierGameObj()) { obj->As_SoldierGameObj()->Set_Override_Weapon_Hold_Style(-1); @@ -14656,7 +14765,7 @@ GameObject *target = current->Data()->As_ScriptableGameObj(); if (target && target->As_ScriptableGameObj() && !_stricmp(preset,Commands->Get_Preset_Name(target))) { - Commands->Send_Custom_Event(obj,target,custom,Param,0.0f); + Commands->Send_Custom_Event(obj,target,custom,Param,delay); } } } @@ -14891,6 +15000,10 @@ attackCheckBlocked = Get_Int_Parameter("AttackCheckBlocked") ? true : false; canSeeStealth = Get_Int_Parameter("CanSeeStealth"); shutdownEngineOnArrival = Get_Int_Parameter("ShutdownEngineOnArrival") ? true : false; + changeDefendSpeedCustom = Get_Int_Parameter("ChangeDefendSpeedCustom"); + changeCaptureSpeedCustom = Get_Int_Parameter("ChangeCaptureSpeedCustom"); + changeAttackSpeedCustom = Get_Int_Parameter("ChangeAttackSpeedCustom"); + const AmmoDefinitionClass *ammo = Get_Weapon_Ammo_Definition(Get_Current_Weapon(obj),true); if (ammo) { @@ -14905,11 +15018,32 @@ Commands->Start_Timer(obj,this,0.0f,3); Commands->Start_Timer(obj,this,10.0f,4); } +void JMG_Utility_AI_Control_Point::Custom(GameObject *obj,int message,int param,GameObject *sender) +{ + if (changeDefendSpeedCustom != 0 && changeDefendSpeedCustom == message) + { + defendSpeed = param/100.0f; + if (state == CONTROL_POINT_DEFENSE) + Attack_Move(obj,Commands->Find_Object(lastAction.targetId),lastAction.location,defendSpeed,lastAction.distance,lastAction.attack,lastAction.overrideLocation); + } + if (changeCaptureSpeedCustom != 0 && changeCaptureSpeedCustom == message) + { + captureSpeed = param/100.0f; + if (state == CONTROL_POINT_ATTACK) + Attack_Move(obj,Commands->Find_Object(lastAction.targetId),lastAction.location,captureSpeed,lastAction.distance,lastAction.attack,lastAction.overrideLocation); + } + if (changeAttackSpeedCustom != 0 && changeAttackSpeedCustom == message) + { + attackSpeed = param/100.0f; + if (state == ATTACKING_TARGET) + Attack_Move(obj,Commands->Find_Object(lastAction.targetId),lastAction.location,attackSpeed,lastAction.distance,lastAction.attack,lastAction.overrideLocation); + } +} void JMG_Utility_AI_Control_Point::Enemy_Seen(GameObject *obj,GameObject *seen) { if (!Commands->Get_Health(seen)) return; - if (Is_Script_Attached(seen,"JMG_Utility_AI_Goto_Enemy_Ignore_Object")) + if (Is_Script_Attached(seen,"JMG_Utility_AI_Control_Point_Ignore_Object")) return; if (!_stricmp(Get_Skin(seen),"Blamo") || !_stricmp(Get_Shield_Type(seen),"Blamo")) return; @@ -14953,7 +15087,7 @@ { GameObject *target = Commands->Find_Object(targetId); targetPos = Commands->Get_Position(target); - if (!target || !Commands->Get_Health(target) || (Commands->Get_Player_Type(obj) != -2 && Commands->Get_Player_Type(target) == Commands->Get_Player_Type(obj)) || Is_Script_Attached(target,"JMG_Utility_AI_Goto_Enemy_Ignore_Object")) + if (!target || !Commands->Get_Health(target) || (Commands->Get_Player_Type(obj) != -2 && Commands->Get_Player_Type(target) == Commands->Get_Player_Type(obj)) || Is_Script_Attached(target,"JMG_Utility_AI_Control_Point_Ignore_Object")) { lastSeenTime = 0; if (state == CONTROL_POINT_ATTACK && lastWanderPoint) @@ -17438,6 +17572,601 @@ Commands->Send_Custom_Event(obj,Commands->Find_Object(randomId),randomCustom,Param == -1 ? param : Param,delay); } } +void JMG_Utility_Custom_Force_All_Players_Into_Vehicle::Created(GameObject *obj) +{ + if (!obj->As_VehicleGameObj()) + { + Console_Input("msg JMG_Utility_Custom_Force_All_Players_Into_Vehicle ERROR: Only works when attached to vehicles!"); + Destroy_Script(); + return; + } + custom = Get_Int_Parameter("Custom"); + forceOutOfOtherVehicles = Get_Int_Parameter("ForceOutOfOtherVehicles") ? true : false; +} +void JMG_Utility_Custom_Force_All_Players_Into_Vehicle::Custom(GameObject *obj,int message,int param,GameObject *sender) +{ + if (message == custom) + { + if (param != this->Get_ID()) + { + for (int x = 1;x < 128;x++) + { + GameObject *player = Get_GameObj(x); + if (!player || !Commands->Get_Health(player)) + continue; + SuccessState successState = ForceIntoVehicle(obj,player); + if (successState == SuccessState::VEHICLE_FULL || successState == SuccessState::FAILED) + return; + } + } + else + { + ForceIntoVehicle(obj,sender); + } + } +} +JMG_Utility_Custom_Force_All_Players_Into_Vehicle::SuccessState JMG_Utility_Custom_Force_All_Players_Into_Vehicle::ForceIntoVehicle(GameObject *obj,GameObject *player) +{ + if (obj == Get_Vehicle(player)) + return SuccessState::ALREADY_IN; + if (Get_Vehicle_Seat_Count(obj) <= Get_Vehicle_Occupant_Count(obj)) + return SuccessState::VEHICLE_FULL; + if (Get_Vehicle(player)) + { + if (!forceOutOfOtherVehicles) + return SuccessState::STUCK_IN_ANOTHER_VEHICLE; + Soldier_Transition_Vehicle(player); + Commands->Send_Custom_Event(player,obj,custom,this->Get_ID(),0.1f); + return SuccessState::RETRY; + } + Force_Vehicle_Entry(player,obj); + if (obj == Get_Vehicle(player)) + return SuccessState::SUCCESS; + return SuccessState::FAILED; +} +void JMG_Utility_Custom_Force_Occupants_Out_And_Lock::Created(GameObject *obj) +{ + if (!obj->As_VehicleGameObj()) + { + Console_Input("msg JMG_Utility_Custom_Force_Occupants_Out_And_Lock ERROR: Only works when attached to vehicles!"); + Destroy_Script(); + return; + } + custom = Get_Int_Parameter("Custom"); +} +void JMG_Utility_Custom_Force_Occupants_Out_And_Lock::Custom(GameObject *obj,int message,int param,GameObject *sender) +{ + if (message == custom) + { + Timer_Expired(obj,1); + } +} +void JMG_Utility_Custom_Force_Occupants_Out_And_Lock::Timer_Expired(GameObject *obj,int number) +{ + if (number == 1) + { + Force_Occupants_Exit(obj); + if (!Get_Vehicle_Occupant_Count(obj)) + { + Commands->Enable_Vehicle_Transitions(obj,false); + Destroy_Script(); + return; + } + Commands->Start_Timer(obj,this,0.1f,1); + } +} +void JMG_Utility_Custom_Send_Custom_If_Occupant_LorE::Created(GameObject *obj) +{ + if (!obj->As_VehicleGameObj()) + { + Console_Input("msg JMG_Utility_Custom_Send_Custom_If_Vehicle_Occupant_Count_Less_Than ERROR: Only works when attached to vehicles!"); + Destroy_Script(); + return; + } + recieveMessage = Get_Int_Parameter("Custom"); + id = Get_Int_Parameter("ID"); + custom = Get_Int_Parameter("SendCustom"); + Param = Get_Int_Parameter("Param"); + delay = Get_Float_Parameter("Delay"); + occupants = Get_Int_Parameter("OccupantCount"); + repeat = Get_Int_Parameter("Repeat") ? true : false; +} +void JMG_Utility_Custom_Send_Custom_If_Occupant_LorE::Custom(GameObject *obj,int message,int param,GameObject *sender) +{ + if (message == recieveMessage) + { + if (Get_Vehicle_Occupant_Count(obj) > occupants) + return; + GameObject *object = id ? (id == -1 ? sender : Commands->Find_Object(id)) : obj; + Commands->Send_Custom_Event(obj,object,custom,Param == -1 ? param : Param,delay); + if (!repeat) + Destroy_Script(); + } +} +void JMG_Utility_Custom_Send_Custom_If_Occupant_GorE::Created(GameObject *obj) +{ + if (!obj->As_VehicleGameObj()) + { + Console_Input("msg JMG_Utility_Custom_Send_Custom_If_Occupant_GorE ERROR: Only works when attached to vehicles!"); + Destroy_Script(); + return; + } + recieveMessage = Get_Int_Parameter("Custom"); + id = Get_Int_Parameter("ID"); + custom = Get_Int_Parameter("SendCustom"); + Param = Get_Int_Parameter("Param"); + delay = Get_Float_Parameter("Delay"); + occupants = Get_Int_Parameter("OccupantCount"); + repeat = Get_Int_Parameter("Repeat") ? true : false; +} +void JMG_Utility_Custom_Send_Custom_If_Occupant_GorE::Custom(GameObject *obj,int message,int param,GameObject *sender) +{ + if (message == recieveMessage) + { + if (Get_Vehicle_Occupant_Count(obj) < occupants) + return; + GameObject *object = id ? (id == -1 ? sender : Commands->Find_Object(id)) : obj; + Commands->Send_Custom_Event(obj,object,custom,Param == -1 ? param : Param,delay); + if (!repeat) + Destroy_Script(); + } +} +SList JMG_Utility_Basic_Spawner_Wander_Point::spawnObjectNodeList; +void JMG_Utility_Basic_Spawner_Wander_Point::Created(GameObject *obj) +{ + attachScriptsGroupId = Get_Int_Parameter("Attach_Scripts_Group_ID"); + spawnedObjectScriptID = Get_Int_Parameter("Spawned_Object_Script_ID"); + if (spawnedObjectScriptID == -1) + spawnedObjectScriptID = this->Get_ID(); + spawnedObjects = 0; + spawnAtATime = Get_Int_Parameter("Spawn_At_A_Time"); + maxTotalSpawned = Get_Int_Parameter("Max_Total_Spawned"); + rate = Get_Float_Parameter("Spawn_Rate"); + randomRate = Get_Float_Parameter("Random_Spawn_Rate"); + changeSpawnCapCustom = Get_Int_Parameter("Change_Spawn_Cap_Custom"); + sprintf(preset,"%s",Get_Parameter("Spawn_Preset")); + spawnCount = 0; + initialSpawn = Get_Int_Parameter("Initial_Spawn"); + if (initialSpawn == -1) + initialSpawn = spawnAtATime; + spawnGroupId = Get_Int_Parameter("Spawn_Group_ID"); + enabled = Get_Int_Parameter("Starts_Disabled") == 0 ? true : false; + enableDisableCustom = Get_Int_Parameter("Enable_Disable_Custom"); + playersAddToSpawnAtATime = Get_Float_Parameter("PlayersAddToSpawnAtATime"); + wanderPointGroup = Get_Int_Parameter("WanderingPointGroupID"); + safeTeleportDistance = Get_Float_Parameter("SafeTeleportDistance"); + if (The_Game()->Get_Game_Duration_S() < 1.5f) + Commands->Start_Timer(obj,this,1.5f,2); + else + Timer_Expired(obj,2); + lastPlayerCount = 0; + Commands->Start_Timer(obj,this,2.5f,3); +} +void JMG_Utility_Basic_Spawner_Wander_Point::Timer_Expired(GameObject *obj,int number) +{ + if (number == 2 && !The_Game()->Is_Game_Over()) + { + if (enabled) + Initial_Spawn(obj); + Commands->Start_Timer(obj,this,rate+(randomRate ? Commands->Get_Random(-randomRate,randomRate) : 0.0f),1); + } + if (number == 1 && !The_Game()->Is_Game_Over()) + { + if (enabled) + { + JMG_Utility_Basic_Spawner_Wander_Point::SpawnFailureTypes spawnResult = AttemptSpawn(obj); + if (spawnResult == SpawnFailureTypes::SUCCESS) + Commands->Start_Timer(obj,this,rate+(randomRate ? Commands->Get_Random(-randomRate,randomRate) : 0.0f),1); + else if (spawnResult == SpawnFailureTypes::SPAWN_BLOCKED) + Commands->Start_Timer(obj,this,0.1f,1); + } + else + Commands->Start_Timer(obj,this,0.1f,1); + } + if (number == 3 && !The_Game()->Is_Game_Over()) + { + int change = GetPlayerLimitModifier()-lastPlayerCount; + lastPlayerCount = change; + for (int x = 0;x < change;x++) + Commands->Send_Custom_Event(obj,obj,6873525,spawnedObjectScriptID,0.1f); + Commands->Start_Timer(obj,this,2.5f,3); + } +} +void JMG_Utility_Basic_Spawner_Wander_Point::Custom(GameObject *obj,int message,int param,GameObject *sender) +{ + if (changeSpawnCapCustom && message == changeSpawnCapCustom) + { + int change = param-spawnAtATime; + spawnAtATime = param; + for (int x = 0;x < change;x++) + Commands->Send_Custom_Event(obj,obj,6873525,spawnedObjectScriptID,0.1f); + } + if (message == 6873523 && param == spawnedObjectScriptID) + { + spawnedObjects++; + } + if (message == 6873524 && param == spawnedObjectScriptID) + { + if (spawnedObjects > 0) + spawnedObjects--; + Commands->Send_Custom_Event(obj,obj,6873525,spawnedObjectScriptID,rate+(randomRate ? Commands->Get_Random(-randomRate,randomRate) : 0.0f)); + } + if (message == 6873525 && param == spawnedObjectScriptID && !The_Game()->Is_Game_Over()) + { + if (!enabled) + return; + if (AttemptSpawn(obj) == SpawnFailureTypes::SPAWN_BLOCKED) + Commands->Send_Custom_Event(obj,obj,6873525,spawnedObjectScriptID,0.1f); + } + if (enableDisableCustom && message == enableDisableCustom && !The_Game()->Is_Game_Over()) + { + enabled = param != 0 ? true : false; + if (param == 1) + Initial_Spawn(obj); + } +} +JMG_Utility_Basic_Spawner_Wander_Point::SpawnFailureTypes JMG_Utility_Basic_Spawner_Wander_Point::AttemptSpawn(GameObject *obj) +{ + if (!(spawnedObjects < spawnAtATime+GetPlayerLimitModifier())) + return SpawnFailureTypes::LIMIT_REACHED; + if (!((maxTotalSpawned >= 0 && spawnCount < maxTotalSpawned) || maxTotalSpawned < 0)) + return SpawnFailureTypes::LIMIT_REACHED; + + GameObject *spawned = Commands->Create_Object(preset,Commands->Get_Position(obj)); + if (Grab_Teleport_Spot(spawned,5)) + { + char params[512]; + sprintf(params,"%d,%d,%d",Commands->Get_ID(obj),spawnedObjectScriptID,spawnGroupId); + Commands->Attach_Script(spawned,"JMG_Utility_Basic_Spawner_In_Radius_Attached",params); + Commands->Send_Custom_Event(spawned,obj,6873522,attachScriptsGroupId,0.0f); + return SpawnFailureTypes::SUCCESS; + } + Commands->Destroy_Object(spawned); + return SpawnFailureTypes::SPAWN_BLOCKED; +} +void JMG_Utility_Basic_Spawner_Wander_Point::Initial_Spawn(GameObject *obj) +{ + int addSpawn = GetPlayerLimitModifier(); + lastPlayerCount = addSpawn; + for (int x = spawnedObjects;x < initialSpawn+addSpawn;x++) + { + JMG_Utility_Basic_Spawner_Wander_Point::SpawnFailureTypes spawnResult; + for (int y = 0;y < 5;y++) + { + spawnResult = AttemptSpawn(obj); + if (spawnResult == SpawnFailureTypes::SUCCESS) + break; + if (spawnResult == SpawnFailureTypes::LIMIT_REACHED) + x = initialSpawn+1+addSpawn; + } + if (spawnResult == SpawnFailureTypes::SPAWN_BLOCKED) + Commands->Send_Custom_Event(obj,obj,6873525,spawnedObjectScriptID,0.1f); + if (initialSpawn < spawnAtATime) + { + Stop_Timer(obj,1); + Commands->Start_Timer(obj,this,0.1f,1); + } + } +} +int JMG_Utility_Basic_Spawner_Wander_Point::GetPlayerLimitModifier() +{ + return (int)playersAddToSpawnAtATime*Get_Player_Count(); +} +bool JMG_Utility_Basic_Spawner_Wander_Point::Grab_Teleport_Spot(GameObject *spawnedObject,int attempts) +{ + if (!attempts) + return false; + attempts--; + Vector3 targetPos; + float facing; + if (!Get_A_Defense_Point(&targetPos,&facing)) + { + char errormsg[220]; + sprintf(errormsg,"msg JMG_Utility_Basic_Spawner_Wander_Point ERROR: No wander points found for group %d!",wanderPointGroup); + Console_Input(errormsg); + return false; + } + MoveablePhysClass *mphys = spawnedObject->As_PhysicalGameObj() ? spawnedObject->As_PhysicalGameObj()->Peek_Physical_Object()->As_MoveablePhysClass() : NULL; + if (mphys && mphys->Find_Teleport_Location(targetPos,safeTeleportDistance,&targetPos)) + { + spawnCount++; + Toggle_Fly_Mode(spawnedObject); + Commands->Set_Position(spawnedObject,targetPos); + Force_Position_Update(spawnedObject); + Toggle_Fly_Mode(spawnedObject); + char params[220]; + sprintf(params,"0.1,%.2f",facing); + Commands->Attach_Script(spawnedObject,"JMG_Utility_Delay_Then_Rotate_Camera",params); + return true; + } + else + { + Commands->Set_Position(spawnedObject,targetPos); + return Grab_Teleport_Spot(spawnedObject,attempts); + } +} +int JMG_Utility_Global_CSC_With_Global_Param_Controller::globalParam = -1; +void JMG_Utility_Global_CSC_With_Global_Param_Controller::Created(GameObject *obj) +{ + globalParam = Get_Int_Parameter("GlobalParam"); +} +void JMG_Utility_Global_CSC_With_Global_Param_Update_Custom::Created(GameObject *obj) +{ + custom = Get_Int_Parameter("Custom"); + globalParam = Get_Int_Parameter("GlobalParam"); +} +void JMG_Utility_Global_CSC_With_Global_Param_Update_Custom::Custom(GameObject *obj,int message,int param,GameObject *sender) +{ + if (message == custom) + { + JMG_Utility_Global_CSC_With_Global_Param_Controller::globalParam = globalParam; + } +} +void JMG_Utility_Global_CSC_With_Global_Param::Created(GameObject *obj) +{ + recieveMessage = Get_Int_Parameter("Custom"); + id = Get_Int_Parameter("ID"); + custom = Get_Int_Parameter("SendCustom"); + delay = Get_Float_Parameter("Delay"); + randomDelay = Get_Float_Parameter("RandomDelay"); + randomChance = Get_Float_Parameter("RandomChance"); +} +void JMG_Utility_Global_CSC_With_Global_Param::Custom(GameObject *obj,int message,int param,GameObject *sender) +{ + if (message == recieveMessage) + { + if (randomChance && randomChance < Commands->Get_Random(0.0f,1.0f)) + return; + GameObject *object = id ? (id == -1 ? sender : Commands->Find_Object(id)) : obj; + Commands->Send_Custom_Event(obj,object,custom,JMG_Utility_Global_CSC_With_Global_Param_Controller::globalParam,delay+(randomDelay > 0 ? Commands->Get_Random(0.0f,randomDelay) : 0.0f)); + } +} +float JMG_Utility_Global_Armor_Scaled_Controller::scale = 100.0f; +void JMG_Utility_Global_Armor_Scaled_Controller::Created(GameObject *obj) +{ + scale = Get_Float_Parameter("Scale")*0.01f; +} +void JMG_Utility_Global_Armor_Scaled_Custom::Created(GameObject *obj) +{ + custom = Get_Int_Parameter("Custom"); + scale = Get_Float_Parameter("Scale"); + if (scale > 0) + scale *= 0.01f; +} +void JMG_Utility_Global_Armor_Scaled_Custom::Custom(GameObject *obj,int message,int param,GameObject *sender) +{ + if (message == custom) + { + JMG_Utility_Global_Armor_Scaled_Controller::scale = scale == -1.0f ? param*0.01f : scale; + } +} +void JMG_Utility_Global_Armor_Scaled_Object::Created(GameObject *obj) +{ + Set_Max_Shield_Strength(obj,JMG_Utility_Global_Armor_Scaled_Controller::scale*Commands->Get_Max_Shield_Strength(obj)); + Commands->Set_Shield_Strength(obj,JMG_Utility_Global_Armor_Scaled_Controller::scale*Commands->Get_Shield_Strength(obj)); +} +float JMG_Utility_Global_Health_Scaled_Controller::scale = 100.0f; +void JMG_Utility_Global_Health_Scaled_Controller::Created(GameObject *obj) +{ + scale = Get_Float_Parameter("Scale")*0.01f; +} +void JMG_Utility_Global_Health_Scaled_Custom::Created(GameObject *obj) +{ + custom = Get_Int_Parameter("Custom"); + scale = Get_Float_Parameter("Scale"); + if (scale > 0) + scale *= 0.01f; +} +void JMG_Utility_Global_Health_Scaled_Custom::Custom(GameObject *obj,int message,int param,GameObject *sender) +{ + if (message == custom) + { + JMG_Utility_Global_Health_Scaled_Controller::scale = scale == -1.0f ? param*0.01f : scale; + } +} +void JMG_Utility_Global_Health_Scaled_Object::Created(GameObject *obj) +{ + Set_Max_Health(obj,JMG_Utility_Global_Health_Scaled_Controller::scale*Commands->Get_Max_Health(obj)); + Commands->Set_Health(obj,JMG_Utility_Global_Health_Scaled_Controller::scale*Commands->Get_Health(obj)); +} +float JMG_Utility_Global_Infantry_Speed_Controller::speed = 6.0f; +void JMG_Utility_Global_Infantry_Speed_Controller::Created(GameObject *obj) +{ + speed = Get_Float_Parameter("Speed"); +} +void JMG_Utility_Global_Infantry_Speed_Custom::Created(GameObject *obj) +{ + custom = Get_Int_Parameter("Custom"); + speed = Get_Float_Parameter("Scale"); +} +void JMG_Utility_Global_Infantry_Speed_Custom::Custom(GameObject *obj,int message,int param,GameObject *sender) +{ + if (message == custom) + { + JMG_Utility_Global_Infantry_Speed_Controller::speed = speed == -1.0f ? param*0.01f : speed; + } +} +void JMG_Utility_Global_Infantry_Speed_Object::Created(GameObject *obj) +{ + if (!obj->As_SoldierGameObj()) + { + Console_Input("msg JMG_Utility_Global_Infantry_Speed_Object ERROR: This script can only be attached to infantry"); + Destroy_Script(); + return; + } + obj->As_SoldierGameObj()->Set_Max_Speed(JMG_Utility_Global_Infantry_Speed_Controller::speed); +} +void JMG_Utility_AI_Control_Point_Ignore_Object::Created(GameObject *obj) +{ +} +void JMG_Utility_Custom_Send_Custom_No_Presets_Outside_Of_Vehicle::Created(GameObject *obj) +{ + if (!obj->As_VehicleGameObj()) + { + Console_Input("msg JMG_Utility_Custom_Send_Custom_No_Presets_Outside_Of_Vehicle ERROR: Only works when attached to vehicles!"); + Destroy_Script(); + return; + } + recieveMessage = Get_Int_Parameter("Custom"); + id = Get_Int_Parameter("ID"); + custom = Get_Int_Parameter("SendCustom"); + Param = Get_Int_Parameter("Param"); + delay = Get_Float_Parameter("Delay"); + occupants = Get_Int_Parameter("OccupantCount"); + sprintf(preset,"%s",Get_Parameter("Preset")); + repeat = Get_Int_Parameter("Repeat") ? true : false; +} +void JMG_Utility_Custom_Send_Custom_No_Presets_Outside_Of_Vehicle::Custom(GameObject *obj,int message,int param,GameObject *sender) +{ + if (message == recieveMessage) + { + for (SLNode *current = GameObjManager::SmartGameObjList.Head();current;current = current->Next()) + { + SmartGameObj* o = current->Data(); + if (o != obj && !_stricmp(Commands->Get_Preset_Name(o),preset) && Get_Vehicle(o) != obj) + return; + } + GameObject *object = id ? (id == -1 ? sender : Commands->Find_Object(id)) : obj; + Commands->Send_Custom_Event(obj,object,custom,Param == -1 ? param : Param,delay); + if (!repeat) + Destroy_Script(); + } +} +void JMG_Utility_Custom_Send_Custom_No_Presets_Inside_Of_Vehicle::Created(GameObject *obj) +{ + if (!obj->As_VehicleGameObj()) + { + Console_Input("msg JMG_Utility_Custom_Send_Custom_No_Presets_Inside_Of_Vehicle ERROR: Only works when attached to vehicles!"); + Destroy_Script(); + return; + } + recieveMessage = Get_Int_Parameter("Custom"); + id = Get_Int_Parameter("ID"); + custom = Get_Int_Parameter("SendCustom"); + Param = Get_Int_Parameter("Param"); + delay = Get_Float_Parameter("Delay"); + occupants = Get_Int_Parameter("OccupantCount"); + sprintf(preset,"%s",Get_Parameter("Preset")); + repeat = Get_Int_Parameter("Repeat") ? true : false; +} +void JMG_Utility_Custom_Send_Custom_No_Presets_Inside_Of_Vehicle::Custom(GameObject *obj,int message,int param,GameObject *sender) +{ + if (message == recieveMessage) + { + for (int x = 0;x < Get_Vehicle_Seat_Count(obj);x++) + { + GameObject *occupant = Get_Vehicle_Occupant(obj,x); + if (occupant && !_stricmp(Commands->Get_Preset_Name(occupant),preset)) + return; + } + GameObject *object = id ? (id == -1 ? sender : Commands->Find_Object(id)) : obj; + Commands->Send_Custom_Event(obj,object,custom,Param == -1 ? param : Param,delay); + if (!repeat) + Destroy_Script(); + } +} +void JMG_Utility_Custom_Send_Custom_From_All_Players::Created(GameObject *obj) +{ + recieveMessage = Get_Int_Parameter("Custom"); + id = Get_Int_Parameter("ID"); + custom = Get_Int_Parameter("SendCustom"); + Param = Get_Int_Parameter("Param"); + delay = Get_Float_Parameter("Delay"); +} +void JMG_Utility_Custom_Send_Custom_From_All_Players::Custom(GameObject *obj,int message,int param,GameObject *sender) +{ + if (message == recieveMessage) + { + for (int x = 1;x < 128;x++) + { + GameObject *player = Get_GameObj(x); + if (!player) + continue; + GameObject *object = id ? (id == -2 ? player : (id == -1 ? sender : Commands->Find_Object(id))) : obj; + Commands->Send_Custom_Event(player,object,custom,Param == -1 ? param : Param,delay); + } + } +} +void JMG_Utility_Killed_By_Player_Send_Custom_From_Player::Killed(GameObject *obj,GameObject *killer) +{ + if (!Commands->Is_A_Star(killer)) + return; + int id = Get_Int_Parameter("ID"); + GameObject *object = id ? (id == -1 ? killer : Commands->Find_Object(id)) : obj; + Commands->Send_Custom_Event(killer,object,Get_Int_Parameter("Custom"),Get_Int_Parameter("Param"),Get_Float_Parameter("Delay")); + Destroy_Script(); +} +float JMG_Utility_Sync_Fog_Controller::min = 0.0f; +float JMG_Utility_Sync_Fog_Controller::max = 300.0f; +void JMG_Utility_Sync_Fog_Controller::Created(GameObject *obj) +{ + min = Get_Float_Parameter("MinRange"); + max = Get_Float_Parameter("MaxRange"); + for (int x = 1;x < 128;x++) + fogSynced[x] = false; + Commands->Start_Timer(obj,this,0.25,23453451); +} +void JMG_Utility_Sync_Fog_Controller::Timer_Expired(GameObject *obj,int number) +{ + if (number == 23453451) + { + for (int x = 1;x < 128;x++) + { + GameObject *player = Get_GameObj(x); + if (player && !fogSynced[x]) + { + fogSynced[x] = true; + Set_Fog_Enable_Player(player,true); + Set_Fog_Range_Player(player,min,max,0); + } + if (!player && fogSynced[x]) + fogSynced[x] = false; + } + Commands->Start_Timer(obj,this,0.25,23453451); + } +} +void JMG_Utility_Sync_Fog_Custom_Update::Created(GameObject *obj) +{ + custom = Get_Int_Parameter("Custom"); + min = Get_Float_Parameter("MinRange"); + max = Get_Float_Parameter("MaxRange"); + transition = Get_Float_Parameter("Transition"); +} +void JMG_Utility_Sync_Fog_Custom_Update::Custom(GameObject *obj,int message,int param,GameObject *sender) +{ + if (message == custom) + { + Commands->Set_Fog_Range(min,max,transition); + JMG_Utility_Sync_Fog_Controller::min = min; + JMG_Utility_Sync_Fog_Controller::max = max; + } +} +void JMG_Utility_Sync_Animation_On_Join::Created(GameObject *obj) +{ + for (int x = 1;x < 128;x++) + synced[x] = false; + Commands->Start_Timer(obj,this,0.25,23453451); +} +void JMG_Utility_Sync_Animation_On_Join::Timer_Expired(GameObject *obj,int number) +{ + if (number == 23453451) + { + for (int x = 1;x < 128;x++) + { + GameObject *player = Get_GameObj(x); + if (player && !synced[x]) + { + synced[x] = true; + const char *anim = Get_Animation_Name(obj); + if (anim != NULL) + Set_Subobject_Animation_Player(player,obj,anim,false,NULL,Get_Animation_Frame(obj),Get_Animation_Target_Frame(obj),true); + } + if (!player && synced[x]) + synced[x] = false; + } + Commands->Start_Timer(obj,this,0.25,23453451); + } +} ScriptRegistrant JMG_Utility_Check_If_Script_Is_In_Library_Registrant("JMG_Utility_Check_If_Script_Is_In_Library","ScriptName:string,CppName:string"); ScriptRegistrant JMG_Send_Custom_When_Custom_Sequence_Matched_Registrant("JMG_Send_Custom_When_Custom_Sequence_Matched","Success_Custom=0:int,Correct_Step_Custom=0:int,Partial_Failure_Custom=0:int,Failure_Custom=0:int,Send_To_ID=0:int,Custom_0=0:int,Custom_1=0:int,Custom_2=0:int,Custom_3=0:int,Custom_4=0:int,Custom_5=0:int,Custom_6=0:int,Custom_7=0:int,Custom_8=0:int,Custom_9=0:int,Disable_On_Success=1:int,Disable_On_Failure=0:int,Starts_Enabled=1:int,Enable_Custom=0:int,Correct_Step_Saftey=0:int,Failure_Saftey=1:int,Max_Failures=1:int"); ScriptRegistrant JMG_Utility_Change_Model_On_Timer_Registrant("JMG_Utility_Change_Model_On_Timer","Model=null:string,Time=0:float"); @@ -17630,7 +18359,7 @@ ScriptRegistrant JMG_Utility_Kill_Unit_If_Not_Moving_Enough_Registrant("JMG_Utility_Kill_Unit_If_Not_Moving_Enough","Time=60.0:float,Distance=1.0:float"); ScriptRegistrant JMG_Utility_Custom_Display_Briefing_Message_StringID_Registrant("JMG_Utility_Custom_Display_Briefing_Message_StringID","Custom=0:int,StringID:string,MessageColor=239.0 228.0 176.0:Vector3,LineDelayTime=10.0:float,UISound=null:string"); ScriptRegistrant JMG_Utility_Destroy_Objects_In_ID_Range_On_Killed_Registrant("JMG_Utility_Destroy_Objects_In_ID_Range_On_Killed","StartID:int,EndID:int"); -ScriptRegistrant JMG_Utility_Timer_Custom_Registrant("JMG_Utility_Timer_Custom","Time:float,ID:int,Message:int,Param=0:int,Repeat=0:int"); +ScriptRegistrant JMG_Utility_Timer_Custom_Registrant("JMG_Utility_Timer_Custom","Time:float,ID:int,Message:int,Param=0:int,Repeat=0:int,EnableCustom=0:int"); ScriptRegistrant JMG_Utility_Zone_Change_Character_Model_Registrant("JMG_Utility_Zone_Change_Character_Model","NewModel:string,PlayerType=2:int"); ScriptRegistrant JMG_Utility_Timer_Change_Character_Models_On_Team_Registrant("JMG_Utility_Timer_Change_Character_Models_On_Team","Time:float,NewModel:string,PlayerType=2:int,Repeat=0:int,StartsEnabled=1:int,EnableCustom=0:int"); ScriptRegistrant JMG_Utility_Timer_Change_Character_Models_On_HP_Registrant("JMG_Utility_Timer_Change_Character_Models_On_HP","Time:float,NewModel:string,MinHP:float,MaxHP:float,PlayerType=2:int,Repeat=0:int,StartsEnabled=1:int,EnableCustom=0:int"); @@ -17650,7 +18379,7 @@ ScriptRegistrant JMG_Utility_Apply_Damage_On_Timer_Registrant("JMG_Utility_Apply_Damage_On_Timer","Rate:float,DamageAmount:float,Warhead:string,DamagerId:int"); ScriptRegistrant JMG_Utility_Zone_Send_Custom_Exit_Registrant("JMG_Utility_Zone_Send_Custom_Exit","ID=0:int,Custom=0:int,Param=0:int,Delay=0.0:float,PlayerType=2:int,TriggerOnce=1:int"); ScriptRegistrant JMG_Utility_Custom_Enable_Spawners_In_Range_Modular_Registrant("JMG_Utility_Custom_Enable_Spawners_In_Range_Modular","StartID:int,EndID:int,Custom:int,Enable=1:int,Mod=1:int"); -ScriptRegistrant JMG_Utility_Custom_Create_Explosion_At_Bone_Registrant("JMG_Utility_Custom_Create_Explosion_At_Bone","Custom:int,Explosion:string,Bone:string,Owner:int"); +ScriptRegistrant JMG_Utility_Custom_Create_Explosion_At_Bone_Registrant("JMG_Utility_Custom_Create_Explosion_At_Bone","Custom:int,Explosion:string,Bone:string,Owner:int,Alive:int"); ScriptRegistrant JMG_Utility_Custom_Send_Custom_Repeat_Ignore_Time_Registrant("JMG_Utility_Custom_Send_Custom_Repeat_Ignore_Time","Custom:int,ID:int,SendCustom:int,Param:int,Delay:float,IgnoreTime:float,StartsEnabled=1:int,EnableCustom=0:int"); ScriptRegistrant JMG_Utility_Damage_Send_Custom_Registrant("JMG_Utility_Damage_Send_Custom","MinDamage:float,Custom:int,Param:int,Delay:int,ID:int,SenderID:int,StartsEnabled=1:int,EnableCustom=0:int,Repeat=1:int"); ScriptRegistrant JMG_Utility_Send_Custom_When_Player_Inside_Of_Range_Registrant("JMG_Utility_Send_Custom_When_Player_Inside_Of_Range","Distance:float,ID:int,Custom:int,Param:int,Delay:float,TriggerOnce=1:int,SleepTime=10:int"); @@ -17669,8 +18398,8 @@ ScriptRegistrant JMG_Utility_Credit_Trickle_When_Not_AFK_Registrant("JMG_Utility_Credit_Trickle_When_Not_AFK","Credits=1.0:float,Rate=1.0:float,TrickleCap=0.0:float,Team=2:int,Custom=0:int"); ScriptRegistrant JMG_Utility_Killed_Create_Object_Registrant("JMG_Utility_Killed_Create_Object","Preset:string"); ScriptRegistrant JMG_Utility_Damaged_Create_Object_When_Shield_Zero_Registrant("JMG_Utility_Damaged_Create_Object_When_Shield_Zero","Preset:string"); -ScriptRegistrant JMG_Utility_Basic_Spawner_In_Radius_Registrant("JMG_Utility_Basic_Spawner_In_Radius","Spawn_Preset:string,Spawn_Rate:float,Random_Spawn_Rate:float,Spawn_At_A_Time:int,Min_Spawn_Radius:float,Max_Spawn_Radius:float,Initial_Spawn_Height=0.0:float,Spawn_Limit=-1:int,Spawn_Location=-1.0 -1.0 -1.0:Vector3,X_Multiplier=1.0:float,Y_Multiplier=1.0:float,Collision_Check=1:int,Collision_Retry_Attempts=3:int,Collision_Add_Height=1.0:float,Change_Spawn_Cap_Custom=-1:int,Initial_Spawn=-1:int,Script_ID=-1:int,Point_Must_Be_In_Pathfind=1:int,Manual_Facing=0:int,Face_Location=0.0 0.0 0.0:vector3,Face_Direction=0.0:float,Ignore_Ray_Cast_Failure=0:int,Min_Distance_Between_Objects=0.0:float,Spawn_Group_ID=0:int,Starts_Disabled=0:int,Enable_Disable_Custom=0:int,Raycast_Direction_Override[Bottom|Top|Unused]=0.0 0.0 0.0:Vector3,Attach_Scripts_Group_ID=-1:int,PlayersAddToSpawnAtATime=0.0:float"); -ScriptRegistrant JMG_Utility_Basic_Spawner_In_Radius_Attached_Registrant("JMG_Utility_Basic_Spawner_In_Radius_Attached","Controller_ID:int,Script_ID:int,Spawn_Group_ID:int"); +ScriptRegistrant JMG_Utility_Basic_Spawner_In_Radius_Registrant("JMG_Utility_Basic_Spawner_In_Radius","Spawn_Preset:string,Spawn_Rate:float,Random_Spawn_Rate:float,Spawn_At_A_Time:int,Min_Spawn_Radius:float,Max_Spawn_Radius:float,Initial_Spawn_Height=0.0:float,Max_Total_Spawned=-1:int,Spawn_Location=-1.0 -1.0 -1.0:Vector3,X_Multiplier=1.0:float,Y_Multiplier=1.0:float,Collision_Check=1:int,Collision_Retry_Attempts=3:int,Collision_Add_Height=1.0:float,Change_Spawn_Cap_Custom=-1:int,Initial_Spawn=-1:int,Spawned_Object_Script_ID=-1:int,Point_Must_Be_In_Pathfind=1:int,Manual_Facing=0:int,Face_Location=0.0 0.0 0.0:vector3,Face_Direction=0.0:float,Ignore_Ray_Cast_Failure=0:int,Min_Distance_Between_Objects=0.0:float,Spawn_Group_ID=0:int,Starts_Disabled=0:int,Enable_Disable_Custom=0:int,Raycast_Direction_Override[Bottom|Top|Unused]=0.0 0.0 0.0:Vector3,Attach_Scripts_Group_ID=-1:int,PlayersAddToSpawnAtATime=0.0:float"); +ScriptRegistrant JMG_Utility_Basic_Spawner_In_Radius_Attached_Registrant("JMG_Utility_Basic_Spawner_In_Radius_Attached","Controller_ID:int,Spawned_Object_Script_ID:int,Spawn_Group_ID:int"); ScriptRegistrant JMG_Utility_Flying_Vehicle_Crash_Apply_Damage_Registrant("JMG_Utility_Flying_Vehicle_Crash_Apply_Damage","Min_Collision_Speed=33.528:float,Max_Collision_Speed=42.4688:float,Collision_Sound=vehicle_collide_01:string,Explosion_Preset=Plane_Air_Collision:string,Subtract_Min_Speed=0:int"); ScriptRegistrant JMG_Utility_Enemy_Seen_Send_Custom_Registrant("JMG_Utility_Enemy_Seen_Send_Custom","Enemy_Preset_ID:int,ID:int,Visible_Message:int,Visible_Param:int,Not_Visible_Message:int,Not_Visible_Param:int,Max_Lost_Sight_Time=2.5:float,RepeatSendSeenCustom=0:int,AttackPriority[Car|Tank|Bike]=1.0 1.0 1.0:vector3,AttackPriority[Flying|Turret|Boat]=1.0 1.0 1.0:vector3,AttackPriority[Submarine|Infantry|Unused]=1.0 1.0 0.0:vector3"); ScriptRegistrant JMG_Utility_Custom_Send_Custom_If_Script_Attached_Registrant("JMG_Utility_Custom_Send_Custom_If_Script_Attached","Custom:int,Script:string,ID=0:int,SendCustom:int,Param:int,Delay:float"); @@ -17678,7 +18407,7 @@ ScriptRegistrant JMG_Utility_Basic_Spawner_In_Radius_Controller_Registrant("JMG_Utility_Basic_Spawner_In_Radius_Controller",""); ScriptRegistrant JMG_Utility_Custom_Set_Engine_Registrant("JMG_Utility_Custom_Set_Engine","Custom:int,Enable:int"); ScriptRegistrant JMG_Utility_Send_Custom_Player_Count_Matches_Preset_Count_Registrant("JMG_Utility_Send_Custom_Player_Count_Matches_Preset_Count","Preset_ID:int,ID:int,Message:int,Param:int,Delay:float,Min_Player_Count=1:int,Max_Player_Count=-1:int,Rate=0.1:float,Repeat=0:int"); -ScriptRegistrant JMG_Utility_Custom_Set_Position_Registrant("JMG_Utility_Custom_Set_Position","Custom:int,Position:Vector3"); +ScriptRegistrant JMG_Utility_Custom_Set_Position_Registrant("JMG_Utility_Custom_Set_Position","Custom:int,Position:Vector3,ID=0:int"); ScriptRegistrant JMG_Utility_Custom_Delay_Send_Custom_Registrant("JMG_Utility_Custom_Delay_Send_Custom","Custom:int,ID=0:int,SendCustom:int,Param:int,Delay:float,RandomDelay:float,CancelCustom=0:int"); ScriptRegistrant JMG_Utility_Scale_HP_By_Player_Count_Registrant("JMG_Utility_Scale_HP_By_Player_Count","Health_Multiplier=1.0:float,Armor_Multiplier=1.0:float,Max_Player_Count=-1:int,Repeat=1:int,UpdateScaleCustom=0:int"); ScriptRegistrant JMG_Utility_Custom_Send_Custom_To_All_Objects_Registrant("JMG_Utility_Custom_Send_Custom_To_All_Objects","Custom:int,SendCustom:int,Param:int,Team=2:int,Delay=0.0:float"); @@ -17755,8 +18484,8 @@ ScriptRegistrant JMG_Utility_Zone_Teleport_To_Random_WP_Boss_Registrant("JMG_Utility_Zone_Teleport_To_Random_WP_Boss","WanderingAIGroupID=-1:int,SafeTeleportDistance=1.5:float,ChangeGroupIDCustom=0:int,PlayerType=2:int,RetryOnFailure=0:int,AiOnly=0:int,FaceBoss=1:int"); ScriptRegistrant JMG_Utility_Zone_Teleport_To_Random_WP_Boss_Object_Registrant("JMG_Utility_Zone_Teleport_To_Random_WP_Boss_Object",""); ScriptRegistrant JMG_Utility_Custom_Set_Soldier_Speed_Registrant("JMG_Utility_Custom_Set_Soldier_Speed","Custom:int,Speed:float"); -ScriptRegistrant JMG_Utiliwty_Control_Point_Controller_Registrant("JMG_Utility_Control_Point_Controller","NeutralTeamName=Neutral:string,NeutralPlayerType=-2:int,NeutralRadarBlipColor=2:int,NeutralDefaultPointModel:string,NeutralDefaultAnimation:string,NeutralAnimationLength:float,NeutralCaptureSound:string,NeutralLostSound:string,NeutralLockedModel:string,NeutralLockedAnim:string,NeutralLockedAnimLength:float,NeutralDefenseMultiplier=0:int,NeutralCaptureMultiplier=0:int,NeutralUnoccupiedMultiplier=-1:int"); -ScriptRegistrant JMG_Utility_Control_Point_Team_Setting_Registrant("JMG_Utility_Control_Point_Team_Setting","TeamID:int,TeamName:string,PlayerType:int,RadarBlipColor:int,PointModel:string,Animation:string,AnimationLength:float,CaptureSound:string,LostSound:string,LockedModel:string,LockedAnim:string,LockedAnimLength:float,DefenseMultiplier=1:int,CaptureMultiplier=1:int,UnoccupiedMultiplier=1:int"); +ScriptRegistrant JMG_Utiliwty_Control_Point_Controller_Registrant("JMG_Utility_Control_Point_Controller","NeutralTeamName=Neutral:string,NeutralPlayerType=-2:int,NeutralRadarBlipColor=2:int,NeutralDefaultPointModel:string,NeutralDefaultAnimation:string,NeutralAnimationLength:float,NeutralCaptureSound:string,NeutralLostSound:string,NeutralLockedModel:string,NeutralLockedAnim:string,NeutralLockedAnimLength:float,NeutralDefenseMultiplier=0:int,NeutralCaptureMultiplier=0:int,NeutralUnoccupiedMultiplier=-1:int,NeutralCustomID=0:int,NeutralTeamMemberCaptureCustom=0:int,NeutralTeamMemberNeutralize=0:int,NeutralTeamMembmerLostCustom=0:int,NeutralTeamCaptureCustom=0:int,NeutralTeamLostCustom=0:int"); +ScriptRegistrant JMG_Utility_Control_Point_Team_Setting_Registrant("JMG_Utility_Control_Point_Team_Setting","TeamID:int,TeamName:string,PlayerType:int,RadarBlipColor:int,PointModel:string,Animation:string,AnimationLength:float,CaptureSound:string,LostSound:string,LockedModel:string,LockedAnim:string,LockedAnimLength:float,DefenseMultiplier=1:int,CaptureMultiplier=1:int,UnoccupiedMultiplier=1:int,CustomID=0:int,TeamMemberCaptureCustom=0:int,TeamMemberNeutralize=0:int,TeamMembmerLostCustom=0:int,TeamCaptureCustom=0:int,TeamLostCustom=0:int"); ScriptRegistrant JMG_Utility_Control_Point_Registrant("JMG_Utility_Control_Point","ControlPointName:string,ControllingTeamID:int,MaxCapturePoints=100:int,ControlDistance=15.0:float,ControlHeight[Min|Max]=0.0 0.0 0.0:Vector3,ZoneID=0:int,CaptureScore=1000.0:float,NeutralizeScore=1000.0:float,ControlGroupID=-1:int,StartsLocked=0:int,LockCustom=0:int"); ScriptRegistrant JMG_Utility_Control_Point_Setting_Override_Registrant("JMG_Utility_Control_Point_Setting_Override","TeamID:int,ID:int,CaptureCustom:int,LostCustom:int,PointModelOverride:string,AnimationOverride:string,AnimationLength:float,LockedPointModelOverride:string,LockedAnimationOverride:string,LockedAnimationLength:float"); ScriptRegistrant JMG_Utility_Control_Point_Team_Member_Registrant("JMG_Utility_Control_Point_Team_Member","TeamID:int,Multiplier=1:int"); @@ -17800,7 +18529,7 @@ ScriptRegistrant JMG_Utility_Custom_Create_Random_Explosions_Registrant("JMG_Utility_Custom_Create_Random_Explosions","Custom:int,ExplosionPreset:string,Count:int,MaxDistance:float,KillerID:int"); ScriptRegistrant JMG_Utility_Custom_Enable_Incrementally_Spawners_In_Range_Registrant("JMG_Utility_Custom_Enable_Spawners_Incrementally_In_Range","StartID:int,EndID:int,Custom:int,Enable=1:int"); ScriptRegistrant JMG_Utility_Control_Point_Team_Target_Wander_Point_Registrant("JMG_Utility_Control_Point_Team_Target_Wander_Point","ControlPointID:int,TeamID:int,TargetGroupID:int,NonTargetGroupId:int"); -ScriptRegistrant JMG_Utility_AI_Control_Point_Registrant("JMG_Utility_AI_Control_Point","CaptureCpGroupId:int,CaptureCpChance=0.33:float,CaptureSpeed=1.0:float,CaptureDistance=5.0:float,DefendCpGroupId:int,DefendSpeed=1.0:float,DefendDistance=1.0:float,CloseDefendDistance=25.0:float,ChooseFarDefendChance=0.1:float,AttackSpeed=1.0:float,AttackDistance=-1.0:float,RandomAttackDistance=0.0:float,AttackDistractFromCaptureChance=0.25:float,ChanceToInvestigateLastSeenLocation=0.66:float,AttackCheckBlocked=1:int,CanSeeStealth=1:int,ShutdownEngineOnArrival=0:int"); +ScriptRegistrant JMG_Utility_AI_Control_Point_Registrant("JMG_Utility_AI_Control_Point","CaptureCpGroupId:int,CaptureCpChance=0.33:float,CaptureSpeed=1.0:float,CaptureDistance=5.0:float,DefendCpGroupId:int,DefendSpeed=1.0:float,DefendDistance=1.0:float,CloseDefendDistance=25.0:float,ChooseFarDefendChance=0.1:float,AttackSpeed=1.0:float,AttackDistance=-1.0:float,RandomAttackDistance=0.0:float,AttackDistractFromCaptureChance=0.25:float,ChanceToInvestigateLastSeenLocation=0.66:float,AttackCheckBlocked=1:int,CanSeeStealth=1:int,ShutdownEngineOnArrival=0:int,ChangeDefendSpeedCustom=0:int,ChangeCaptureSpeedCustom=0:int,ChangeAttackSpeedCustom=0:int"); ScriptRegistrant JMG_Utility_Objective_System_Set_Infantry_Attach_Bone_Registrant("JMG_Utility_Objective_System_Set_Infantry_Attach_Bone","InfantryAttachBone:string"); ScriptRegistrant JMG_Utility_Security_System_Fixed_NumberPad_Control_Registrant("JMG_Utility_Security_System_Fixed_NumberPad_Control","KeyCode:string,ID:int,Success_Custom=0:int,Partial_Failure_Custom=0:int,Failure_Custom=0:int,Disable_On_Success=1:int,Disable_On_Failure=0:int,Starts_Enabled=1:int,Enable_Custom=0:int,Failure_Safty=1:int,Max_Failures=1:int,Sound_Name_Base:string"); ScriptRegistrant JMG_Utility_Custom_Teleport_Sender_Wanderpoint_Registrant("JMG_Utility_Custom_Teleport_Sender_Wanderpoint","Custom:int,WanderingAIGroupID=-1:int,SafeTeleportDistance=1.5:float,RetryOnFailure=0:int"); @@ -17852,3 +18581,28 @@ ScriptRegistrant JMG_Utility_Custom_Drop_Corpse_Registrant("JMG_Utility_Custom_Drop_Corpse","Custom:int,PowerupName:string,Repeat=0:int"); ScriptRegistrant JMG_Utility_Custom_Send_Shuffled_Customs_Registrant("JMG_Utility_Custom_Send_Shuffled_Customs","Custom:int,ID=0:int,SendCustoms:string,Delim=@:string,Param:int,Delay=0.0:float"); ScriptRegistrant JMG_Utility_Custom_Send_Shuffled_Customs_And_Ids_Registrant("JMG_Utility_Custom_Send_Shuffled_Customs_And_Ids","Custom:int,IDs=0:string,SendCustoms:string,Delim=@:string,Param:int,Delay=0.0:float"); +ScriptRegistrant JMG_Utility_Custom_Force_All_Players_Into_Vehicle_Registrant("JMG_Utility_Custom_Force_All_Players_Into_Vehicle","Custom:int,ForceOutOfOtherVehicles=1:int"); +ScriptRegistrant JMG_Utility_Custom_Force_Occupants_Out_And_Lock_Registrant("JMG_Utility_Custom_Force_Occupants_Out_And_Lock","Custom:int"); +ScriptRegistrant JMG_Utility_Custom_Send_Custom_If_Occupant_LorE_Registrant("JMG_Utility_Custom_Send_Custom_If_Occupant_LorE","Custom:int,OccupantCount:int,ID=0:int,SendCustom:int,Param:int,Delay=0.0:float,Repeat=0:int"); +ScriptRegistrant JMG_Utility_Custom_Send_Custom_If_Occupant_GorE_Registrant("JMG_Utility_Custom_Send_Custom_If_Occupant_GorE","Custom:int,OccupantCount:int,ID=0:int,SendCustom:int,Param:int,Delay=0.0:float,Repeat=0:int"); +ScriptRegistrant JMG_Utility_Basic_Spawner_Wander_Point_Registrant("JMG_Utility_Basic_Spawner_Wander_Point","Spawn_Preset:string,WanderingPointGroupID:int,SafeTeleportDistance=1.5:float,Spawn_Rate:float,Random_Spawn_Rate:float,Spawn_At_A_Time:int,Max_Total_Spawned=-1:int,Change_Spawn_Cap_Custom=-1:int,Initial_Spawn=-1:int,Spawned_Object_Script_ID=-1:int,Spawn_Group_ID=0:int,Starts_Disabled=0:int,Enable_Disable_Custom=0:int,Attach_Scripts_Group_ID=-1:int,PlayersAddToSpawnAtATime=0.0:float"); +ScriptRegistrant JMG_Utility_Global_CSC_With_Global_Param_Controller_Registrant("JMG_Utility_Global_CSC_With_Global_Param_Controller","GlobalParam:int"); +ScriptRegistrant JMG_Utility_Global_CSC_With_Global_Param_Update_Custom_Registrant("JMG_Utility_Global_CSC_With_Global_Param_Update_Custom","Custom:int,GlobalParam:int"); +ScriptRegistrant JMG_Utility_Global_CSC_With_Global_Param_Registrant("JMG_Utility_Global_CSC_With_Global_Param","Custom:int,ID=0:int,SendCustom:int,Delay=0.0:float,RandomDelay=0.0:float,RandomChance=0.0:float"); +ScriptRegistrant JMG_Utility_Global_Armor_Scaled_Controller_Registrant("JMG_Utility_Global_Armor_Scaled_Controller","Scale=100.0:float"); +ScriptRegistrant JMG_Utility_Global_Armor_Scaled_Custom_Registrant("JMG_Utility_Global_Armor_Scaled_Custom","Custom:int,Scale=100.0:float"); +ScriptRegistrant JMG_Utility_Global_Armor_Scaled_Object_Registrant("JMG_Utility_Global_Armor_Scaled_Object",""); +ScriptRegistrant JMG_Utility_Global_Health_Scaled_Controller_Registrant("JMG_Utility_Global_Health_Scaled_Controller","Scale=100.0:float"); +ScriptRegistrant JMG_Utility_Global_Health_Scaled_Custom_Registrant("JMG_Utility_Global_Health_Scaled_Custom","Custom:int,Scale=100.0:float"); +ScriptRegistrant JMG_Utility_Global_Health_Scaled_Object_Registrant("JMG_Utility_Global_Health_Scaled_Object",""); +ScriptRegistrant JMG_Utility_Global_Infantry_Speed_Controller_Registrant("JMG_Utility_Global_Infantry_Speed_Controller","Speed=6.0:float"); +ScriptRegistrant JMG_Utility_Global_Infantry_Speed_Custom_Registrant("JMG_Utility_Global_Infantry_Speed_Custom","Custom:int,Speed=6.0:float"); +ScriptRegistrant JMG_Utility_Global_Infantry_Speed_Object_Registrant("JMG_Utility_Global_Infantry_Speed_Object",""); +ScriptRegistrant JMG_Utility_AI_Control_Point_Ignore_Object_Registrant("JMG_Utility_AI_Control_Point_Ignore_Object",""); +ScriptRegistrant JMG_Utility_Custom_Send_Custom_No_Presets_Outside_Of_Vehicle_Registrant("JMG_Utility_Custom_Send_Custom_No_Presets_Outside_Of_Vehicle","Custom:int,Preset:string,ID=0:int,SendCustom:int,Param:int,Delay=0.0:float,Repeat=0:int"); +ScriptRegistrant JMG_Utility_Custom_Send_Custom_No_Presets_Inside_Of_Vehicle_Registrant("JMG_Utility_Custom_Send_Custom_No_Presets_Inside_Of_Vehicle","Custom:int,Preset:string,ID=0:int,SendCustom:int,Param:int,Delay=0.0:float,Repeat=0:int"); +ScriptRegistrant JMG_Utility_Custom_Send_Custom_From_All_Players_Registrant("JMG_Utility_Custom_Send_Custom_From_All_Players","Custom:int,ID=0:int,SendCustom:int,Param:int,Delay=0.0:float"); +ScriptRegistrant JMG_Utility_Killed_By_Player_Send_Custom_From_Player_Registrant("JMG_Utility_Killed_By_Player_Send_Custom_From_Player","ID:int,Custom:int,Param:int,Delay:float"); +ScriptRegistrant JMG_Utility_Sync_Fog_Controller_Registrant("JMG_Utility_Sync_Fog_Controller","MinRange:float,MaxRange:float"); +ScriptRegistrant JMG_Utility_Sync_Fog_Custom_Update_Registrant("JMG_Utility_Sync_Fog_Custom_Update","Custom:int,MinRange:float,MaxRange:float,Transition:float"); +ScriptRegistrant JMG_Utility_Sync_Animation_On_Join_Registrant("JMG_Utility_Sync_Animation_On_Join",""); \ No newline at end of file diff -urN sourceold/scripts/jmgUtility.h source/scripts/jmgUtility.h --- sourceold/scripts/jmgUtility.h 2022-11-19 15:40:13.700823300 -0600 +++ source/scripts/jmgUtility.h 2022-11-19 19:00:10.347634000 -0600 @@ -1613,7 +1613,10 @@ { GameObject *syncObject = Commands->Find_Object(syncControl.lastSyncNode[x]->id); if (syncObject) + { Force_Position_Update_Player(player,syncObject); + Force_Orientation_Update_Player(player,syncObject); + } } syncControl.lastSyncNode[x] = syncControl.lastSyncNode[x]->next; } @@ -6148,6 +6151,7 @@ * \Message - Custom to send * \Param - parameter to send with the custom * \Repeat - 1 to make it trigger again +* \EnableCustom - If non-zero the timer won't start until it receives a custom with a param of non 0, if it receives a custom with a param of 0 it will be disabled again * \author jgray * \ingroup JmgUtility */ @@ -6157,8 +6161,10 @@ int param; bool repeat; float time; + int enableCustom; void Created(GameObject *obj); void Timer_Expired(GameObject *obj,int number); + void Custom(GameObject *obj,int message,int param,GameObject *sender); }; /*! @@ -6524,6 +6530,7 @@ * \Explosion - Explosion to create * \Bone - Bone to create the explosion at * \Owner - Who own's the explosion (-1 = sender, 0 = self, positive numbers = id of object) +* \Alive - If the owner must be alive to create the explosion * \author jgray * \ingroup JmgUtility */ @@ -6532,6 +6539,7 @@ char bone[32]; int owner; int custom; + bool alive; void Created(GameObject *obj); void Custom(GameObject *obj,int message,int param,GameObject *sender); }; @@ -6894,7 +6902,7 @@ * \Min_Spawn_Radius - The min size of the radius to spawn in, non-zero makes a torus basically * \Max_Spawn_Radius - The max size of the radius to spawn in. * \Initial_Spawn_Height - Adds this much to the Z axis on object creation. -* \Spawn_Limit - How many times can objects be spawned before being disabled, -1 means no limit. +* \Max_Total_Spawned - How many times can objects be spawned before being disabled, -1 means no limit. * \Spawn_Location - Location in which to spawn the objects, -1 -1 ? (Last value is the height of which to start casting the ray from, -1 makes it the current position) * \X_Multiplier - Multiply how the circle is shaped on the X coordinates, default is 1.0. * \Y_Multiplier - Multiply how the circle is shaped on the Y coordinates, default is 1.0. @@ -6902,7 +6910,7 @@ * \Collision_Retry_Attempts - How many times will the script "bump" the object if the collision is blocked. * \Collision_Add_Height - Amount of height to add each time if blocked. * \Initial_Spawn - Setting the value to -1 will spawn the Spawn_At_A_Time on create, any 0 or above will make the objects slowly spawn in at the spawn rate. -* \Script_ID - Set the id for this script, -1 uses default (only use this if you're going to need to manually add spawned objects to this spawner). +* \Spawned_Object_Script_ID - Set the id for this script, -1 uses default (only use this if you're going to need to manually add spawned objects to this spawner). * \Point_Must_Be_In_Pathfind - Requires the created point to be in the pathfind field, if its outside of the field the point will not be created. * \Manual_Facing - If true random facing will not be used, first it will attempt to use Face_Location and if that's all 0's Face_Direction * \Face_Location - If anything besides 0,0,0 all objects created will attempt to face the point @@ -6936,12 +6944,12 @@ bool enabled; float minDistanceBetweenObjects; int spawnGroupId; - int scriptId; + int spawnedObjectScriptID; int spawnedObjects; enum SpawnFailureTypes{SPAWN_BLOCKED, SUCCESS, LIMIT_REACHED, SPAWN_CODE_ERROR}; Vector3 spawnLocation; int spawnAtATime; - int spawnLimit; + int maxTotalSpawned; float minRadius; float maxRadius; float xMultiplier; @@ -6965,6 +6973,7 @@ Vector3 raycastRange; int attachScriptsGroupId; float playersAddToSpawnAtATime; + int lastPlayerCount; void Created(GameObject *obj); void Timer_Expired(GameObject *obj,int number); void Custom(GameObject *obj,int message,int param,GameObject *sender); @@ -7150,12 +7159,14 @@ * \brief Moves an object when a custom is received, works on zones * \Custom - Custom to trigger on * \Position - Spot to place object +* \ID - ID of the object to use, if 0 use itself * \author jgray * \ingroup JmgUtility */ class JMG_Utility_Custom_Set_Position : public ScriptImpClass { int custom; Vector3 position; + int id; void Created(GameObject *obj); void Custom(GameObject *obj,int message,int param,GameObject *sender); }; @@ -9460,6 +9471,12 @@ * \NeutralDefenseMultiplier - Effect a neutral soldier has on an owned CP * \NeutralCaptureMultiplier - Effect a neutral solider has on an enemy CP * \NeutralUnoccupiedMultiplier - How neutral is modified when no soldiers are guarding it +* \CustomID - ID of the object customs will be sent to on captures and losses +* \TeamMemberCaptureCustom - Any team members in the zone of the control point will send this custom to the specified ID on capture +* \TeamMembmerLostCustom - Any team members in the zone of the control point will send this custom to the specified ID on loss +* \TeamMemberNeutralize - When the control point is lost all people in range that are not of the losing team will send this to the specified ID +* \TeamCaptureCustom - When this control point is captured it will send this custom to the specified ID +* \TeamLostCustom - When this control point is lost it will send this custom to the specified ID * \author jgray * \ingroup JmgUtility */ @@ -9482,7 +9499,13 @@ char lockedModel[16]; char lockedAnim[32]; float lockedAnimLen; - ControlPointTeamData(int teamId,const char *teamName,int playerType,int radarBlipColor,const char *pointModel,const char *defaultAnimation,float animationLength,const char *captureSound,const char *lostSound,const char *lockedModel,const char *lockedAnim,float lockedAnimLen,int defenseMultiplier,int captureMultiplier,int unoccupiedMultiplier) + int customId; + int teamMemberCaptureCustom; + int teamMembmerLostCustom; + int teamCaptureCustom; + int teamLostCustom; + int teamMemberNeutralize; + ControlPointTeamData(int teamId,const char *teamName,int playerType,int radarBlipColor,const char *pointModel,const char *defaultAnimation,float animationLength,const char *captureSound,const char *lostSound,const char *lockedModel,const char *lockedAnim,float lockedAnimLen,int defenseMultiplier,int captureMultiplier,int unoccupiedMultiplier,int customId,int teamMemberCaptureCustom,int teamMembmerLostCustom,int teamCaptureCustom,int teamLostCustom,int teamMemberNeutralize) { this->teamId = teamId; sprintf(this->teamName,"%s",teamName); @@ -9499,6 +9522,12 @@ sprintf(this->lockedModel,"%s",lockedModel); sprintf(this->lockedAnim,"%s",lockedAnim); this->lockedAnimLen = lockedAnimLen; + this->customId = customId; + this->teamMemberCaptureCustom = teamMemberCaptureCustom; + this->teamMembmerLostCustom = teamMembmerLostCustom; + this->teamCaptureCustom = teamCaptureCustom; + this->teamLostCustom = teamLostCustom; + this->teamMemberNeutralize = teamMemberNeutralize; } }; static SList controlPointTeamData; @@ -9535,6 +9564,12 @@ * \DefenseMultiplier - Effect this team's soldiers has on controlled CP's * \CaptureMultiplier - Effect this team's soldiers has on an enemy CP * \UnoccupiedMultiplier - Rate at which owned CP's regenerate when no one is around +* \CustomID - ID of the object customs will be sent to on captures and losses +* \TeamMemberCaptureCustom - Any team members in the zone of the control point will send this custom to the specified ID on capture +* \TeamMembmerLostCustom - Any team members in the zone of the control point will send this custom to the specified ID on loss +* \TeamMemberNeutralize - When the control point is lost all people in range that are not of the losing team will send this to the specified ID +* \TeamCaptureCustom - When this control point is captured it will send this custom to the specified ID +* \TeamLostCustom - When this control point is lost it will send this custom to the specified ID * \author jgray * \ingroup JmgUtility */ @@ -9620,6 +9655,8 @@ void UpdateTeam(int teamId); void TriggerAssaultLinesUpdate(); void UpdateControllerWanderPoints(); + void SendCustomToAllInRange(GameObject *obj,int id,int teamId,int custom); + void SendNeutralizeToAllInRange(GameObject *obj,int teamId); public: char controlPointName[128]; int cpGroupId; @@ -10485,6 +10522,9 @@ * \AttackCheckBlocked - Defines whether they should check if they can actually hit the player before shooting * \CanSeeStealth - Can the AI see stealth targets? 0 = No at all, 1 is within the ranges set in LE globals file, 2 means it can see stealth everywhere, think of stock AI. * \ShutdownEngineOnArrival - Used for vehicles, turn on if you have issues with your vehicle rolling away from its move positions after it arrives +* \ChangeDefendSpeedCustom - If this custom is received the defense speed will be updated to the param/100 +* \ChangeCaptureSpeedCustom - If this custom is received the capture speed will be updated to the param/100 +* \ChangeAttackSpeedCustom - If this custom is received the attack speed will be updated to the param/100 * \author jgray * \ingroup JmgUtility */ @@ -10554,6 +10594,9 @@ bool attackCheckBlocked; int canSeeStealth; bool shutdownEngineOnArrival; + int changeDefendSpeedCustom; + int changeCaptureSpeedCustom; + int changeAttackSpeedCustom; void Created(GameObject *obj); void Enemy_Seen(GameObject *obj,GameObject *seen); void Timer_Expired(GameObject *obj,int number); @@ -10566,6 +10609,12 @@ Rp2SimplePositionSystem::SimplePositionNode *Get_Capture_Point(); Rp2SimplePositionSystem::SimplePositionNode *Get_Defense_Point(GameObject *obj); void TriggerAttack(GameObject *obj,GameObject *target); + void Custom(GameObject *obj,int message,int param,GameObject *sender); +public: + JMG_Utility_AI_Control_Point() + { + lastWanderPoint = NULL; + } }; @@ -11614,4 +11663,439 @@ float delay; void Created(GameObject *obj); void Custom(GameObject *obj,int message,int param,GameObject *sender); +}; + +/*! +* \brief When the custom is received all players on the map will attempt to enter the vehicle until it is full +* \Custom - Custom to watch for +* \ForceOutOfVehicles - Whether players already in other vehicles can be forced out of it first, the script will then attempt to put them in 1/10th of a second later +* \author jgray +* \ingroup JmgUtility +*/ +class JMG_Utility_Custom_Force_All_Players_Into_Vehicle : public ScriptImpClass { + int custom; + bool forceOutOfOtherVehicles; + float delay; + enum SuccessState{SUCCESS,RETRY,ALREADY_IN,FAILED,VEHICLE_FULL,STUCK_IN_ANOTHER_VEHICLE}; + void Created(GameObject *obj); + void Custom(GameObject *obj,int message,int param,GameObject *sender); + SuccessState ForceIntoVehicle(GameObject *obj,GameObject *target); +}; + +/*! +* \brief Forces all occupants out of the vehicle (taking as many attempts as needed 10 times a second) once finally empty the vehicle will lock. +* \ Script destroys itself once the action is complete. +* \Custom - Custom to watch for +* \author jgray +* \ingroup JmgUtility +*/ +class JMG_Utility_Custom_Force_Occupants_Out_And_Lock : public ScriptImpClass { + int custom; + void Created(GameObject *obj); + void Custom(GameObject *obj,int message,int param,GameObject *sender); + void Timer_Expired(GameObject *obj,int number); +}; + +/*! +* \brief Sends a custom if the number of occupants in a vehicle is less than or equal to the value specified +* \Custom - Custom to watch for +* \OccupantCount - Number of occupants required to be greater than or equal to not to send the custom +* \ID - ID to send to, 0 sends to self, -1 sends to sender +* \SendCustom - custom to send +* \Param - param to send (-1 sends the param that was received) +* \Delay - delay to add +* \author jgray +* \ingroup JmgUtility +*/ +class JMG_Utility_Custom_Send_Custom_If_Occupant_LorE : public ScriptImpClass { + int occupants; + int recieveMessage; + int id; + int custom; + int Param; + float delay; + bool repeat; + void Created(GameObject *obj); + void Custom(GameObject *obj,int message,int param,GameObject *sender); +}; + +/*! +* \brief Sends a custom if the number of occupants in a vehicle is greater than or equal to the value specified +* \Custom - Custom to watch for +* \OccupantCount - Number of occupants required to be greater than or equal to not to send the custom +* \ID - ID to send to, 0 sends to self, -1 sends to sender +* \SendCustom - custom to send +* \Param - param to send (-1 sends the param that was received) +* \Delay - delay to add +* \author jgray +* \ingroup JmgUtility +*/ +class JMG_Utility_Custom_Send_Custom_If_Occupant_GorE : public ScriptImpClass { + int occupants; + int recieveMessage; + int id; + int custom; + int Param; + float delay; + bool repeat; + void Created(GameObject *obj); + void Custom(GameObject *obj,int message,int param,GameObject *sender); +}; + +/*! +* \brief Spawns objects randomly in a circle using ray casts to find the ground around the location specified can have scripts attached to the spawned object with JMG_Utility_Basic_Spawner_Attach_Script +* \Spawn_Preset - Preset to create (can be a twiddler). +* \WanderingPointGroupID - Group of points to teleport to +* \SafeTeleportDistance - How far can infantry be moved if the spot is blocked +* \Spawn_Rate - Rate at which to spawn more objectSpawn_Locations (also used to respawn when an object is killed). +* \Random_Spawn_Rate - Random amount to add or subtract from the spawn time. +* \Spawn_At_A_Time - Number of instances of the spawned object can exist at once, for example in a traditional spawner only 1 can exist at a time. +* \Max_Total_Spawned - How many times can objects be spawned before being disabled, -1 means no limit. +* \Initial_Spawn - Setting the value to -1 will spawn the Spawn_At_A_Time on create, any 0 or above will make the objects slowly spawn in at the spawn rate. +* \Spawned_Object_Script_ID - Set the id for this script, -1 uses default (only use this if you're going to need to manually add spawned objects to this spawner). +* \Point_Must_Be_In_Pathfind - Requires the created point to be in the pathfind field, if its outside of the field the point will not be created. +* \Spawn_Group_ID - The spawn group id which these objects belong to, if -1 or 0 the distance will be checked against all spawn groups (-1 adds the objects to a group, 0 does not) +* \ if the value is above 0 the objects will only be checked against other objects with the same value. +* \Starts_Disabled - If set to 1 the script won't be able to spawn objects until an Enable_Disable_Custom with a param of 1 is received +* \Enable_Disable_Custom - Custom used to enable or disable the spawners, if the param is 0 it will be disabled, 1 will attempt to spawn the max, anything else just enables the spawn code +* \Attach_Scripts_Group_ID - Defines what scripts should be attached with JMG_Utility_Basic_Spawner_Attach_Script (-1 attachs all scripts on the spawn controller that can be attached) +* \PlayersAddToSpawnAtATime - Each player in game adds to the max number of things this can spawn at a time +* \author jgray +* \ingroup JmgUtility +*/ +class JMG_Utility_Basic_Spawner_Wander_Point : public ScriptImpClass { +public: + struct SpawnObjectNode + { + int groupId; + ReferencerClass obj; + SpawnObjectNode(GameObject *obj,int spawnGroupId) + { + this->obj = obj; + this->groupId = spawnGroupId; + } + }; + static SList spawnObjectNodeList; +private: + bool enabled; + int spawnGroupId; + int spawnedObjectScriptID; + int spawnedObjects; + enum SpawnFailureTypes{SPAWN_BLOCKED, SUCCESS, LIMIT_REACHED, SPAWN_CODE_ERROR}; + int spawnAtATime; + int maxTotalSpawned; + float rate; + float randomRate; + char preset[128]; + int spawnCount; + int changeSpawnCapCustom; + int enableDisableCustom; + int initialSpawn; + int attachScriptsGroupId; + float playersAddToSpawnAtATime; + int wanderPointGroup; + float safeTeleportDistance; + int lastPlayerCount; + void Created(GameObject *obj); + void Timer_Expired(GameObject *obj,int number); + void Custom(GameObject *obj,int message,int param,GameObject *sender); + SpawnFailureTypes AttemptSpawn(GameObject *obj); + void Initial_Spawn(GameObject *obj); + int GetPlayerLimitModifier(); + bool Grab_Teleport_Spot(GameObject *spawnedObject,int attempts); + bool Get_A_Defense_Point(Vector3 *position,float *facing); +}; + +/*! +* \brief Controls if JMG_Utility_Global_CSC_With_Global_Param can send a custom, default param is -1 +* \Custom - Custom to flip if sending is allowed, the param is what to set the flag to +* \author jgray +* \ingroup JmgUtility +*/ +class JMG_Utility_Global_CSC_With_Global_Param_Controller : public ScriptImpClass +{ + void Created(GameObject *obj); +public: + JMG_Utility_Global_CSC_With_Global_Param_Controller() + { + globalParam = -1; + } + static int globalParam; +}; + +/*! +* \brief Changes what the global param is on custom +* \Custom - Custom to flip if sending is allowed +* \GlobalFlag - What to set the global flag to +* \author jgray +* \ingroup JmgUtility +*/ +class JMG_Utility_Global_CSC_With_Global_Param_Update_Custom : public ScriptImpClass +{ + int custom; + int globalParam; + void Created(GameObject *obj); + void Custom(GameObject *obj,int message,int param,GameObject *sender); +}; + +/*! +* \brief Sends a custom with the global param +* \Custom - Custom to watch for +* \ID - ID to send to, 0 sends to self, -1 sends to sender +* \SendCustom - custom to send +* \Delay - delay to add +* \RandomDelay - Max amount of random delay that can be added to the delay +* \RandomChance - If non-zero this will be the chance that the custom can send 0.0-1.0, 1 will always send +* \author jgray +* \ingroup JmgUtility +*/ +class JMG_Utility_Global_CSC_With_Global_Param : public ScriptImpClass +{ + int recieveMessage; + int id; + int custom; + float delay; + float randomDelay; + float randomChance; + void Created(GameObject *obj); + void Custom(GameObject *obj,int message,int param,GameObject *sender); +}; + +/*! +* \brief Controller is required for the global armor scaled system for all objects on the map that have the object script +* \Scale - Default scale for the armor when the object spawns into the game, multiplied by 0.01 +* \author jgray +* \ingroup JmgUtility +*/ +class JMG_Utility_Global_Armor_Scaled_Controller : public ScriptImpClass { + void Created(GameObject *obj); +public: + static float scale; +}; + +/*! +* \brief When a custom is received it will update the scale amount for the scale system +* \Custom - Custom needed to trigger the update +* \Scale - New scale for the armor, value is multiplied by 0.01, -1 uses the param +* \author jgray +* \ingroup JmgUtility +*/ +class JMG_Utility_Global_Armor_Scaled_Custom : public ScriptImpClass { + int custom; + float scale; + void Created(GameObject *obj); + void Custom(GameObject *obj,int message,int param,GameObject *sender); +}; + +/*! +* \brief When the object is created it will scale the objects armor specified by the controller +* \author jgray +* \ingroup JmgUtility +*/ +class JMG_Utility_Global_Armor_Scaled_Object : public ScriptImpClass { + void Created(GameObject *obj); +}; + +/*! +* \brief Controller is required for the global health scaled system for all objects on the map that have the object script +* \Scale - Default scale for the health when the object spawns into the game, multiplied by 0.01 +* \author jgray +* \ingroup JmgUtility +*/ +class JMG_Utility_Global_Health_Scaled_Controller : public ScriptImpClass { + void Created(GameObject *obj); +public: + static float scale; +}; + +/*! +* \brief When a custom is received it will update the scale amount for the scale system +* \Custom - Custom needed to trigger the update +* \Scale - New scale for the health, value is multiplied by 0.01, -1 uses the param +* \author jgray +* \ingroup JmgUtility +*/ +class JMG_Utility_Global_Health_Scaled_Custom : public ScriptImpClass { + int custom; + float scale; + void Created(GameObject *obj); + void Custom(GameObject *obj,int message,int param,GameObject *sender); +}; + +/*! +* \brief When the object is created it will scale the objects health specified by the controller +* \author jgray +* \ingroup JmgUtility +*/ +class JMG_Utility_Global_Health_Scaled_Object : public ScriptImpClass { + void Created(GameObject *obj); +}; + +/*! +* \brief Controller is required for the global speed system for all infantry on the map that have the object script +* \Speed - Default speed for infantry when they spawn +* \author jgray +* \ingroup JmgUtility +*/ +class JMG_Utility_Global_Infantry_Speed_Controller : public ScriptImpClass { + void Created(GameObject *obj); +public: + static float speed; +}; + +/*! +* \brief When a custom is received it will update the speed amount for the speed system +* \Custom - Custom needed to trigger the update +* \Speed - New speed for all global infantry objects created after the script is triggered +* \author jgray +* \ingroup JmgUtility +*/ +class JMG_Utility_Global_Infantry_Speed_Custom : public ScriptImpClass { + int custom; + float speed; + void Created(GameObject *obj); + void Custom(GameObject *obj,int message,int param,GameObject *sender); +}; + +/*! +* \brief When the infantry is created it will update its movement speed to the global speed +* \author jgray +* \ingroup JmgUtility +*/ +class JMG_Utility_Global_Infantry_Speed_Object : public ScriptImpClass { + void Created(GameObject *obj); +}; + +/*! +* \brief Tell objects with JMG_Utility_AI_Control_Point to ignore this object +* \author jgray +* \ingroup JmgUtility +*/ +class JMG_Utility_AI_Control_Point_Ignore_Object : public ScriptImpClass { + void Created(GameObject *obj); +}; + +/*! +* \brief Sends a custom when there are no objects of the preset type outside of the vehicle +* \Custom - Custom to watch for +* \Preset - Preset to check for +* \ID - ID to send to, 0 sends to self, -1 sends to sender +* \SendCustom - custom to send +* \Param - param to send (-1 sends the param that was received) +* \Delay - delay to add +* \author jgray +* \ingroup JmgUtility +*/ +class JMG_Utility_Custom_Send_Custom_No_Presets_Outside_Of_Vehicle : public ScriptImpClass { + int occupants; + int recieveMessage; + int id; + int custom; + int Param; + float delay; + char preset[512]; + bool repeat; + void Created(GameObject *obj); + void Custom(GameObject *obj,int message,int param,GameObject *sender); +}; +/*! +* \brief Sends a custom when there are no objects of the preset type inside of the vehicle +* \Custom - Custom to watch for +* \Preset - Preset to check for +* \ID - ID to send to, 0 sends to self, -1 sends to sender +* \SendCustom - custom to send +* \Param - param to send (-1 sends the param that was received) +* \Delay - delay to add +* \author jgray +* \ingroup JmgUtility +*/ +class JMG_Utility_Custom_Send_Custom_No_Presets_Inside_Of_Vehicle : public ScriptImpClass { + int occupants; + int recieveMessage; + int id; + int custom; + int Param; + float delay; + char preset[512]; + bool repeat; + void Created(GameObject *obj); + void Custom(GameObject *obj,int message,int param,GameObject *sender); +}; + +/*! +* \brief Sends a custom on a custom from each of the players on the map +* \Custom - Custom to watch for +* \ID - ID to send to, 0 sends to self, -1 sends to sender, -2 sends to the player +* \SendCustom - custom to send +* \Param - param to send (-1 sends the param that was received) +* \Delay - delay to add +* \author jgray +* \ingroup JmgUtility +*/ +class JMG_Utility_Custom_Send_Custom_From_All_Players : public ScriptImpClass { + int recieveMessage; + int id; + int custom; + int Param; + float delay; + void Created(GameObject *obj); + void Custom(GameObject *obj,int message,int param,GameObject *sender); +}; + +/*! +* \brief Sends a custom message when killed by a player from the player +* \ID - Id of the object to send the custom to, 0 sends to itself, -1 to killer +* \Message - Custom to send +* \Param - parameter to send with the custom +* \Delay - Time amount to wait before sending the custom +* \author jgray +* \ingroup JmgUtility +*/ +class JMG_Utility_Killed_By_Player_Send_Custom_From_Player : public ScriptImpClass { + void Killed(GameObject *obj,GameObject *killer); +}; + +/*! +* \brief Sets the level's fog on create, after that point its used to sync up any player that joins with the current fog settings +* \Min - Min range of the fog +* \Max - Max range of the fog +* \author jgray +* \ingroup JmgUtility +*/ +class JMG_Utility_Sync_Fog_Controller : public ScriptImpClass { + bool fogSynced[128]; + void Created(GameObject *obj); + void Timer_Expired(GameObject *obj,int number); +public: + static float min; + static float max; +}; + +/*! +* \brief Updates the fog controller's fog settings +* \Custom - Custom to watch for +* \Min - Min range of the fog +* \Max - Max range of the fog +* \Transition - how long it takes the fog to change +* \author jgray +* \ingroup JmgUtility +*/ +class JMG_Utility_Sync_Fog_Custom_Update : public ScriptImpClass { + int custom; + float min; + float max; + float transition; + void Created(GameObject *obj); + void Custom(GameObject *obj,int message,int param,GameObject *sender); +}; + +/*! +* \brief Syncs the current animation with any players that join, this is useful if you see objects slowly slide to match their current frame +* \author jgray +* \ingroup JmgUtility +*/ +class JMG_Utility_Sync_Animation_On_Join : public ScriptImpClass { + bool synced[128]; + void Created(GameObject *obj); + void Timer_Expired(GameObject *obj,int number); }; \ No newline at end of file diff -urN sourceold/scripts/obelfix.cpp source/scripts/obelfix.cpp --- sourceold/scripts/obelfix.cpp 2022-11-19 15:40:14.360902600 -0600 +++ source/scripts/obelfix.cpp 2022-11-19 19:00:10.363794800 -0600 @@ -53,8 +53,9 @@ // Create the Obelisk weapon GameObject* WeaponObj = Commands->Create_Object("Nod_Obelisk", WeaponPos); if (WeaponObj) { - WeaponID = Commands->Get_ID(WeaponObj); + Set_Object_Type(WeaponObj, Get_Object_Type(ObeliskObj)); Commands->Attach_Script(WeaponObj, "Obelisk_Weapon_CnC", ""); + WeaponID = Commands->Get_ID(WeaponObj); } } @@ -85,7 +86,7 @@ // TODO: Make switch for obby kills neutral? // NEUTRAL: if (Commands->Get_Player_Type(EnemyObj) == Commands->Get_Player_Type(WeaponObj)) return false; // GDI-ONLY: if (Commands->Get_Player_Type(EnemyObj) == 1) return false; - if (Commands->Get_Player_Type(EnemyObj) != 1) return false; + if (Commands->Get_Player_Type(EnemyObj) != (Get_Object_Type(WeaponObj) ? 0 : 1)) return false; if (Commands->Get_Health(EnemyObj) <= 0) return false; if (!Commands->Is_Object_Visible(WeaponObj, EnemyObj)) return false; if (Is_Harvester(EnemyObj)) return false; diff -urN sourceold/scripts/scripts.vcxproj source/scripts/scripts.vcxproj --- sourceold/scripts/scripts.vcxproj 2022-11-19 15:40:15.385838900 -0600 +++ source/scripts/scripts.vcxproj 2022-11-19 19:00:10.377408300 -0600 @@ -697,6 +697,7 @@ + @@ -704,6 +705,7 @@ + @@ -727,6 +729,7 @@ + diff -urN sourceold/scripts/scripts.vcxproj.filters source/scripts/scripts.vcxproj.filters --- sourceold/scripts/scripts.vcxproj.filters 2022-11-19 15:40:15.397474900 -0600 +++ source/scripts/scripts.vcxproj.filters 2022-11-19 19:00:10.377408300 -0600 @@ -383,7 +383,7 @@ 01. Sources - + 01. Sources @@ -1315,6 +1315,15 @@ 02. Headers + + 03. New Sources + + + 03. New Sources + + + 03. New Sources +