diff -urN sourceold/scripts/BuildingGameObjDef.h source/scripts/BuildingGameObjDef.h --- sourceold/scripts/BuildingGameObjDef.h 2024-03-21 19:56:18.000000000 -0500 +++ source/scripts/BuildingGameObjDef.h 2025-02-24 20:08:32.314714600 -0600 @@ -69,6 +69,7 @@ const StringClass & Get_Mesh_Prefix (void) const { return MeshPrefix; } int Get_Damage_Report(int team) const; int Get_Destroy_Report(int team) const; + bool Get_Hide_Team_Battlefield_Information() const; protected: StringClass MeshPrefix; // 0084 ArmorType MCTSkin; // 0088 @@ -79,6 +80,7 @@ int NodDestroyReportID; // 009C friend class BuildingGameObj; friend class PresetDump; + bool HideTeamBattlefieldInformation; }; // 00A0 diff -urN sourceold/scripts/HashTemplateClass.h source/scripts/HashTemplateClass.h --- sourceold/scripts/HashTemplateClass.h 2024-03-21 19:56:18.000000000 -0500 +++ source/scripts/HashTemplateClass.h 2025-02-24 20:08:32.334712700 -0600 @@ -113,6 +113,64 @@ + HashTemplateClass(const HashTemplateClass& o) : unusedEntryIndex(o.unusedEntryIndex), maxHashCount(o.maxHashCount) + { + if (o.indices) + { + indices = new int[o.maxHashCount]; + memcpy(indices, o.indices, sizeof(int) * o.maxHashCount); + } + else + { + indices = NULL; + } + + if (o.entries) + { + entries = new Entry[o.maxHashCount]; + memcpy(entries, o.entries, sizeof(Entry) * o.maxHashCount); + } + else + { + entries = NULL; + } + } + + + HashTemplateClass& operator= (const HashTemplateClass& o) + { + if (this == &o) + return *this; + + delete[] indices; + delete[] entries; + unusedEntryIndex = o.unusedEntryIndex; + maxHashCount = o.maxHashCount; + + if (o.indices) + { + indices = new int[o.maxHashCount]; + memcpy(indices, o.indices, sizeof(int) * o.maxHashCount); + } + else + { + indices = NULL; + } + + if (o.entries) + { + entries = new Entry[o.maxHashCount]; + memcpy(entries, o.entries, sizeof(Entry) * o.maxHashCount); + } + else + { + entries = NULL; + } + + return *this; + } + + ~HashTemplateClass() { delete[] indices; diff -urN sourceold/scripts/PhysDefClass.h source/scripts/PhysDefClass.h --- sourceold/scripts/PhysDefClass.h 2024-03-21 19:56:18.000000000 -0500 +++ source/scripts/PhysDefClass.h 2025-02-24 20:08:32.384707400 -0600 @@ -53,8 +53,8 @@ PLAYER_BUILDING_COLLISION_GROUP, // behaves like a mix of TERRAIN/DEFAULT but doesn't collde with PLAYER_BUILDING_GHOST PLAYER_BUILDING_GHOST_COLLISION_GROUP, // behaves like DEFAULT but doesn't collde with PLAYER_BUILDING - TRAIN_COLLISION_GROUP, // behaves like DEFAULT but collides with TRAIN_TRACK and doesn't collide with WATER_EDGE - TRAIN_TRACK_COLLISION_GROUP, // collides only with TRAIN + TRAIN_COLLISION_GROUP, // collides with TRAIN_TRACK, SOLDIER, DEFAULT, BULLET, and C4, (And the other navel unit types) + TRAIN_TRACK_COLLISION_GROUP, // collides only with itself COLLISION_GROUP_MAX = 32, // not a collision group } Collision_Group_Type; diff -urN sourceold/scripts/SoldierGameObj.h source/scripts/SoldierGameObj.h --- sourceold/scripts/SoldierGameObj.h 2024-03-21 19:56:18.000000000 -0500 +++ source/scripts/SoldierGameObj.h 2025-02-24 20:08:32.419703700 -0600 @@ -214,6 +214,9 @@ virtual int Get_Override_Weapon_Hold_Style(); virtual void Set_Human_Anim_Override(bool enableHumanAnimOverride); virtual int Get_Human_Anim_Override(); + virtual void Set_Enable_Foot_Steps(bool enableFootSteps); + virtual void Trigger_Smooth_Skeleton_Height_Resize(float targetHeight,float speed); + virtual void Trigger_Smooth_Skeleton_Width_Resize(float targetWidth,float speed); protected: RenderObjClass * WeaponRenderModel; //2416 RenderObjClass * BackWeaponRenderModel; //2420 @@ -293,6 +296,11 @@ bool enableHumanAnimOverride; WideStringClass botTag; int sight_bone; + bool enableFootSteps; + float targetSoldierHeight; + float targetSoldierWidth; + float targetSoldierHeightSpeed; + float targetSoldierWidthSpeed; TT_DEPRECATED("Do not use") int Check(void); }; // size: 3404 diff -urN sourceold/scripts/jmgUtility.cpp source/scripts/jmgUtility.cpp --- sourceold/scripts/jmgUtility.cpp 2024-03-21 19:56:18.000000000 -0500 +++ source/scripts/jmgUtility.cpp 2025-02-24 20:08:32.489697100 -0600 @@ -272,6 +272,9 @@ } void JMG_Turret_Spawn::Created(GameObject *obj) { +char debug[220]; +sprintf(debug,"msg Use JMG_Utility_Turret_Spawn instead! Preset: %s",Commands->Get_Preset_Name(obj)); +Console_Input(debug); GameObject *turret = Commands->Create_Object(Get_Parameter("Turret_Preset"),Vector3()); if(!turret) { @@ -9854,25 +9857,9 @@ SetFacing(spawned,Commands->Get_Random(-180.0f,180.0f)); if (collisionCheck) { - for (int x = 0;x <= retryAttempts;x++) - { - MoveablePhysClass *mphys = spawned->As_PhysicalGameObj() ? spawned->As_PhysicalGameObj()->Peek_Physical_Object()->As_MoveablePhysClass() : nullptr; - if (!mphys) - { - Console_Input("msg JMG_Utility_Basic_Spawner_In_Radius ERROR: Collision check is turned on but the created object isn't a PhysicalGameObj!"); - Destroy_Script(); - return SpawnFailureTypes::SPAWN_CODE_ERROR; - } - if (!mphys->Can_Teleport(Matrix3D(bottomRay)) || (pointMustBeInPathfind && !Get_Random_Pathfind_Spot(bottomRay,0.0f,&unneeded))) - { - if (x >= retryAttempts) - { - Commands->Destroy_Object(spawned); - return SpawnFailureTypes::SPAWN_BLOCKED; - } - bottomRay.Z += addHeight; - } - } + SpawnFailureTypes failure = TryPlacement(spawned,bottomRay); + if (failure != SpawnFailureTypes::SUCCESS) + return failure; Commands->Set_Position(spawned,bottomRay); } spawnCount++; @@ -9889,6 +9876,30 @@ } return SpawnFailureTypes::SPAWN_BLOCKED; } +JMG_Utility_Basic_Spawner_In_Radius::SpawnFailureTypes JMG_Utility_Basic_Spawner_In_Radius::TryPlacement(GameObject *spawned,Vector3 bottomRay) +{ + Vector3 unneeded; + for (int x = 0;x <= retryAttempts;x++) + { + MoveablePhysClass *mphys = spawned->As_PhysicalGameObj() ? spawned->As_PhysicalGameObj()->Peek_Physical_Object()->As_MoveablePhysClass() : nullptr; + if (!mphys) + { + Console_Input("msg JMG_Utility_Basic_Spawner_In_Radius ERROR: Collision check is turned on but the created object isn't a PhysicalGameObj!"); + Destroy_Script(); + return SpawnFailureTypes::SPAWN_CODE_ERROR; + } + if (!mphys->Can_Teleport(Matrix3D(bottomRay)) || (pointMustBeInPathfind && !Get_Random_Pathfind_Spot(bottomRay,0.0f,&unneeded))) + { + if (x >= retryAttempts) + { + Commands->Destroy_Object(spawned); + return SpawnFailureTypes::SPAWN_BLOCKED; + } + bottomRay.Z += addHeight; + } + } + return SpawnFailureTypes::SUCCESS; +} void JMG_Utility_Basic_Spawner_In_Radius::Initial_Spawn(GameObject *obj) { int addSpawn = GetPlayerLimitModifier(); @@ -17407,8 +17418,7 @@ { if (number == 1) { - NewObjectiveSystem::ObjectiveVisibleSettingOverride *overrideObject = new NewObjectiveSystem::ObjectiveVisibleSettingOverride(Get_Int_Parameter("ObjectiveID"),Get_Parameter("MarkerModel"),Get_Int_Parameter("MarkerColor"),Get_Parameter("AttachBone"),Get_Int_Parameter("OverrideTextColor") ? true : false,Get_Vector3_Parameter("TextColor"),Get_Int_Parameter("OverrideHudColor") ? true : false,Get_Vector3_Parameter("HudColor")); - BasicObjectiveSystem.overrideVisibleObjectiveSettings.Add_Tail(overrideObject); + BasicObjectiveSystem.OverrideObjectiveVisibilitySettings(Get_Int_Parameter("ObjectiveID"),Get_Parameter("MarkerModel"),Get_Int_Parameter("MarkerColor"),Get_Parameter("AttachBone"),Get_Int_Parameter("OverrideTextColor"),Get_Vector3_Parameter("TextColor"),Get_Int_Parameter("OverrideHudColor"),Get_Vector3_Parameter("HudColor")); } } void JMG_Utility_Custom_Create_Object_At_Bone::Created(GameObject *obj) @@ -18480,7 +18490,6 @@ } } } - void JMG_Utility_Created_Fire_Randomly::Created(GameObject *obj) { rate = Get_Float_Parameter("UpdateRate"); @@ -18507,6 +18516,492 @@ Commands->Start_Timer(obj,this,rate,1); } } +void JMG_Utility_Turret_Spawn::Created(GameObject *obj) +{ + GameObject *turret = Commands->Create_Object(Get_Parameter("Turret_Preset"),Vector3()); + if(!turret) + { + Console_Output("[%d:%s:%s] JMG_Utility_Turret_Spawn Critical Error: Failed to create an instance of the preset %s. Destroying script...\n", Commands->Get_ID(obj), Commands->Get_Preset_Name(obj), this->Get_Name(), Get_Parameter("Turret_Preset")); + Destroy_Script(); + return; + } + Commands->Attach_To_Object_Bone(turret,obj,Get_Parameter("Bone_Name")); + turretId = Commands->Get_ID(turret); + if (turret->As_VehicleGameObj()) + turret->As_VehicleGameObj()->Set_Is_Scripts_Visible(false); + hasDriver = false; +} +void JMG_Utility_Turret_Spawn::Custom(GameObject *obj,int message,int param,GameObject *sender) +{ + if (message == CUSTOM_EVENT_VEHICLE_ENTERED) + { + if (!hasDriver) + { + hasDriver = true; + GameObject *turret = Commands->Find_Object(turretId); + if (turret) + { + Commands->Set_Player_Type(turret,Commands->Get_Player_Type(sender)); + Commands->Action_Reset(turret,100); + } + } + } + if (message == CUSTOM_EVENT_VEHICLE_EXITED) + { + if (hasDriver && obj->As_VehicleGameObj() && !Get_Vehicle_Occupant_Count(obj)) + { + hasDriver = false; + GameObject *turret = Commands->Find_Object(turretId); + if (turret) + { + Commands->Set_Player_Type(turret,Commands->Get_Player_Type(obj)); + Commands->Action_Reset(turret,100); + } + } + } +} +void JMG_Utility_Turret_Spawn::Killed(GameObject *obj,GameObject *killer) +{ + Destroyed(obj); +} +void JMG_Utility_Turret_Spawn::Destroyed(GameObject *obj) +{ + GameObject *turret = Commands->Find_Object(turretId); + if (turret) + Commands->Destroy_Object(turret); +} +void JMG_Utility_Turret_Spawn::Detach(GameObject *obj) +{ + if (Exe == 4) + return; + Destroyed(obj); +} +void JMG_Utility_Custom_Send_Custom_Sender::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"); + randomDelay = Get_Float_Parameter("RandomDelay"); + randomChance = Get_Float_Parameter("RandomChance"); +} +void JMG_Utility_Custom_Send_Custom_Sender::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(sender,object,custom,Param == -1 ? param : Param,delay+(randomDelay > 0 ? Commands->Get_Random(0.0f,randomDelay) : 0.0f)); + } +} +void JMG_Utility_Created_Disable_Footsteps::Created(GameObject *obj) +{ + SoldierGameObj *soldobj = obj->As_SoldierGameObj(); + if (!soldobj) + { + Console_Input("msg JMG_Utility_Created_Disable_Footsteps can only be attached to soldier class objects."); + return; + } + Commands->Start_Timer(obj,this,0.1f,1); +} +void JMG_Utility_Created_Disable_Footsteps::Timer_Expired(GameObject *obj,int number) +{ + if (number == 1) + { + obj->As_SoldierGameObj()->Set_Enable_Foot_Steps(false); + } +} +void JMG_Utility_Zone_Damage_While_In_Zone::Created(GameObject *obj) +{ + soldierMotorcycleTracked = Get_Vector3_Parameter("Soldier|Motorcycle|Tracked"); + vtolWheeledUnused = Get_Vector3_Parameter("VTOL|Wheeled|Unused"); + sprintf(warhead,"%s",Get_Parameter("Warhead")); + sprintf(message,"%s",Get_Parameter("Message")); + messageRgb = Get_Vector3_Parameter("MessageRgb"); + delay = Get_Float_Parameter("Delay"); +} +void JMG_Utility_Zone_Damage_While_In_Zone::Entered(GameObject *obj,GameObject *enterer) +{ + if (!Is_Script_Attached(enterer,"JMG_Utility_Zone_Damage_While_In_Zone_Attached")) + { + if (enterer->As_SoldierGameObj() && soldierMotorcycleTracked.X != 0.0f) + AttachScript(enterer,soldierMotorcycleTracked.X); + else if (enterer->As_VehicleGameObj() && enterer->As_PhysicalGameObj()->Peek_Physical_Object()->As_MotorcycleClass() && soldierMotorcycleTracked.Y != 0.0f) + AttachScript(enterer,soldierMotorcycleTracked.Y); + else if (enterer->As_VehicleGameObj() && enterer->As_PhysicalGameObj()->Peek_Physical_Object()->As_TrackedVehicleClass() && soldierMotorcycleTracked.Z != 0.0f) + AttachScript(enterer,soldierMotorcycleTracked.Z); + else if (enterer->As_VehicleGameObj() && enterer->As_PhysicalGameObj()->Peek_Physical_Object()->As_VTOLVehicleClass() && vtolWheeledUnused.X != 0.0f) + AttachScript(enterer,vtolWheeledUnused.X); + else if (enterer->As_VehicleGameObj() && enterer->As_PhysicalGameObj()->Peek_Physical_Object()->As_WheeledVehicleClass() && vtolWheeledUnused.Y != 0.0f) + AttachScript(enterer,vtolWheeledUnused.Y); + } + if (Is_Script_Attached(enterer,"JMG_Utility_Zone_Damage_While_In_Zone_Attached")) + { + JMG_Utility_Zone_Damage_While_In_Zone_Attached *script = (JMG_Utility_Zone_Damage_While_In_Zone_Attached*)Find_Script_On_Object(enterer,"JMG_Utility_Zone_Damage_While_In_Zone_Attached"); + if (script) + script->zoneCount++; + } +} +void JMG_Utility_Zone_Damage_While_In_Zone::Exited(GameObject *obj,GameObject *exiter) +{ + if (!Is_Script_Attached(exiter,"JMG_Utility_Zone_Damage_While_In_Zone_Attached")) + return; + JMG_Utility_Zone_Damage_While_In_Zone_Attached *script = (JMG_Utility_Zone_Damage_While_In_Zone_Attached*)Find_Script_On_Object(exiter,"JMG_Utility_Zone_Damage_While_In_Zone_Attached"); + if (script) + { + script->zoneCount--;; + if (script->zoneCount <= 0) + Remove_Script(exiter,"JMG_Utility_Zone_Damage_While_In_Zone_Attached"); + } +} +void JMG_Utility_Zone_Damage_While_In_Zone::AttachScript(GameObject *obj,float damage) +{ + char params[256]; + sprintf(params,"%.2f,%s,%.2f,%s,%.2f %.2f %.2f",damage,warhead,delay,message,messageRgb.X,messageRgb.Y,messageRgb.Z); + Attach_Script_Once(obj,"JMG_Utility_Zone_Damage_While_In_Zone_Attached",params); +} +void JMG_Utility_Zone_Damage_While_In_Zone_Attached::Created(GameObject *obj) +{ + damage = Get_Float_Parameter("Damage"); + sprintf(warhead,"%s",Get_Parameter("Warhead")); + delay = Get_Float_Parameter("Delay"); + sprintf(message,"%s",Get_Parameter("Message")); + messageRgb = Get_Vector3_Parameter("MessageRgb"); + Commands->Start_Timer(obj,this,0.0f,1); + if (_stricmp(message,"")) + Commands->Start_Timer(obj,this,0.0f,2); +} +void JMG_Utility_Zone_Damage_While_In_Zone_Attached::Timer_Expired(GameObject *obj,int number) +{ + if (number == 1) + { + Commands->Apply_Damage(obj,damage,warhead,obj); + Commands->Start_Timer(obj,this,delay,1); + } + if (number == 2) + { + GameObject *driver = Get_Vehicle_Driver(obj); + if (driver && Commands->Is_A_Star(driver)) + Set_HUD_Help_Text_Player_Text(driver,7234,message,messageRgb); + else if (Commands->Is_A_Star(obj) && !Get_Vehicle(obj)) + Set_HUD_Help_Text_Player_Text(obj,7234,message,messageRgb); + Commands->Start_Timer(obj,this,3.0f,2); + } +} +void JMG_Utility_Zone_Damage_While_In_Zone_Attached::Detach(GameObject *obj) +{ + if (_stricmp(message,"")) + Set_HUD_Help_Text_Player_Text(obj,7234,"",messageRgb); +} +void JMG_Utility_Visible_Vehicle_Occupants::Created(GameObject *obj) +{ + sprintf(driverPreset,"%s",Get_Parameter("DriverPreset")); + sprintf(seatBoneName,"%s",Get_Parameter("SeatBoneName")); + sprintf(driverAnimation,"%s",Get_Parameter("DriverAnimation")); + sprintf(passengerAnimation,"%s",Get_Parameter("PassengerAnimation")); + damageable = Get_Int_Parameter("Damageable") ? true : false; + debug = Get_Int_Parameter("Debug") ? true : false; +} +void JMG_Utility_Visible_Vehicle_Occupants::Custom(GameObject *obj,int message,int param,GameObject *sender) +{ + if (message == CUSTOM_EVENT_VEHICLE_ENTERED) + { + if (debug) + for (int x = 0;x < Get_Vehicle_Seat_Count(obj);x++) + AddOccupant(obj,sender,x); + else + AddOccupant(obj,sender,Get_Occupant_Seat(obj,sender)); + } + if (message == CUSTOM_EVENT_VEHICLE_EXITED) + { + int senderId = Commands->Get_ID(sender); + for (int x = 0;x < 64;x++) + { + if (occupantActualIds[x] != senderId) + continue; + GameObject *visible = Commands->Find_Object(occupantVisibleIds[x]); + if (!visible) + return; + if (damageable) + { + Commands->Set_Health(sender,Commands->Get_Health(visible)); + Commands->Set_Shield_Strength(sender,Commands->Get_Shield_Strength(visible)); + } + Commands->Destroy_Object(visible); + } + } +} +void JMG_Utility_Visible_Vehicle_Occupants::Destroyed(GameObject *obj) +{ + for (int x = 0;x < 64;x++) + { + GameObject *visible = Commands->Find_Object(occupantVisibleIds[x]); + if (visible) + Commands->Destroy_Object(visible); + } +} +void JMG_Utility_Visible_Vehicle_Occupants::AddOccupant(GameObject *obj,GameObject *sender,int seatId) +{ + GameObject *visible = Commands->Create_Object(driverPreset,Vector3(0.0f,0.0f,0.0f)); + Commands->Disable_Physical_Collisions(visible); + Commands->Set_Model(visible,Get_Model(sender)); + if (damageable) + { + Set_Skin(visible,Get_Skin(sender)); + Commands->Set_Shield_Type(visible,Get_Shield_Type(sender)); + Set_Max_Health(visible,Commands->Get_Max_Health(sender)); + Commands->Set_Health(visible,Commands->Get_Health(sender)); + Set_Max_Shield_Strength(visible,Commands->Get_Max_Shield_Strength(sender)); + Commands->Set_Shield_Strength(visible,Commands->Get_Shield_Strength(sender)); + } + char seatBone[32]; + sprintf(seatBone,"%s%0d",seatBoneName,seatId); + Commands->Attach_To_Object_Bone(visible,obj,seatBone); + Commands->Set_Animation(visible,!seatId ? driverAnimation : passengerAnimation,true,0,0.0f,-1.0f,true); + occupantActualIds[seatId] = Commands->Get_ID(sender); + occupantVisibleIds[seatId] = Commands->Get_ID(visible); + char params[512]; + sprintf(params,"%d",Commands->Get_ID(sender)); + Commands->Attach_Script(visible,"JMG_Utility_Visible_Vehicle_Occupants_Attached",params); +} +void JMG_Utility_Visible_Vehicle_Occupants_Attached::Killed(GameObject *obj,GameObject *killer) +{ + GameObject *owner = Commands->Find_Object(Get_Int_Parameter("OwnerId")); + if (!owner) + return; + GameObject *vehicle = Get_Vehicle(owner); + if (!vehicle) + return; + Force_Occupant_Exit(vehicle,Get_Occupant_Seat(vehicle,owner)); + Commands->Apply_Damage(owner,99999.9f,"BlamoKiller",killer); + char params[220]; + sprintf(params,"%d",Commands->Get_ID(killer)); + Commands->Attach_Script(owner,"JMG_Utility_Visible_Vehicle_Occupants_Attached_Kill_Cleanup",params); + +} +void JMG_Utility_Visible_Vehicle_Occupants_Attached_Kill_Cleanup::Created(GameObject *obj) +{ + Commands->Start_Timer(obj,this,0.0f,1); +} +void JMG_Utility_Visible_Vehicle_Occupants_Attached_Kill_Cleanup::Timer_Expired(GameObject *obj,int number) +{ + if (number == 1) + { + if (Get_Vehicle(obj)) + { + Lock_Soldier_Collision_Group(obj,SOLDIER_GHOST_COLLISION_GROUP); + Toggle_Fly_Mode(obj); + } + Commands->Apply_Damage(obj,99999.9f,"BlamoKiller",Commands->Find_Object(Get_Int_Parameter("KillerID"))); + } +} +void JMG_Utility_Zone_Disable_Specific_Weapon_Presets::Created(GameObject *obj) +{ + sprintf(presets,"%s",Get_Parameter("Presets")); + delim = Get_Parameter("Delim")[0]; + sprintf(message,"%s",Get_Parameter("Message")); + messageRgb = Get_Vector3_Parameter("MessageRgb"); +} +void JMG_Utility_Zone_Disable_Specific_Weapon_Presets::Entered(GameObject *obj,GameObject *enterer) +{ + if (!Is_Script_Attached(enterer,"JMG_Utility_Zone_Disable_Specific_Weapon_Presets_Attached")) + { + char params[512]; + sprintf(params,"%s,%c,%s,%.2f %.2f %.2f",presets,delim,message,messageRgb.X,messageRgb.Y,messageRgb.Z); + Attach_Script_Once(enterer,"JMG_Utility_Zone_Disable_Specific_Weapon_Presets_Attached",params); + } + if (Is_Script_Attached(enterer,"JMG_Utility_Zone_Disable_Specific_Weapon_Presets_Attached")) + { + JMG_Utility_Zone_Disable_Specific_Weapon_Presets_Attached *script = (JMG_Utility_Zone_Disable_Specific_Weapon_Presets_Attached*)Find_Script_On_Object(enterer,"JMG_Utility_Zone_Disable_Specific_Weapon_Presets_Attached"); + if (script) + script->zoneCount++; + } +} +void JMG_Utility_Zone_Disable_Specific_Weapon_Presets::Exited(GameObject *obj,GameObject *exiter) +{ + if (!Is_Script_Attached(exiter,"JMG_Utility_Zone_Disable_Specific_Weapon_Presets_Attached")) + return; + JMG_Utility_Zone_Disable_Specific_Weapon_Presets_Attached *script = (JMG_Utility_Zone_Disable_Specific_Weapon_Presets_Attached*)Find_Script_On_Object(exiter,"JMG_Utility_Zone_Disable_Specific_Weapon_Presets_Attached"); + if (script) + { + script->zoneCount--;; + if (script->zoneCount <= 0) + Remove_Script(exiter,"JMG_Utility_Zone_Disable_Specific_Weapon_Presets_Attached"); + } +} +void JMG_Utility_Zone_Disable_Specific_Weapon_Presets_Attached::Created(GameObject *obj) +{ + holding = false; + char delim[1]; + sprintf(delim,"%s",Get_Parameter("Delim")); + char presets[2048]; + sprintf(presets,"%s",Get_Parameter("Presets")); + char *token = strtok(presets,delim); + while(token != NULL) + { + char tok[128]; + sprintf(tok,"%s",token); + weaponPresets.Add_Tail(new StringNode(tok)); + token = strtok(NULL,delim); + } + sprintf(message,"%s",Get_Parameter("Message")); + messageRgb = Get_Vector3_Parameter("MessageRgb"); + if (_stricmp(message,"")) + Commands->Start_Timer(obj,this,0.0f,2); + Commands->Start_Timer(obj,this,0.0f,1); +} +void JMG_Utility_Zone_Disable_Specific_Weapon_Presets_Attached::Timer_Expired(GameObject *obj,int number) +{ + if (number == 1) + { + holding = false; + const char *weap = Get_Current_Weapon(obj); + for (SLNode *current = weaponPresets.Head();current;current = current->Next()) + { + if (weap && !_stricmp(weap,current->Data()->preset)) + { + int clip = Get_Clip_Bullets(obj,weap); + int bullets = Get_Bullets(obj,weap); + if (clip || bullets) + { + current->Data()->bullets += bullets; + current->Data()->clip += clip; + Set_Bullets(obj,weap,0); + Set_Clip_Bullets(obj,weap,0); + } + holding = true; + break; + } + } + Commands->Start_Timer(obj,this,0.1f,1); + } + if (number == 2) + { + if (holding) + { + GameObject *driver = Get_Vehicle_Driver(obj); + if (driver && Commands->Is_A_Star(driver)) + Set_HUD_Help_Text_Player_Text(driver,7234,message,messageRgb); + else if (Commands->Is_A_Star(obj) && !Get_Vehicle(obj)) + Set_HUD_Help_Text_Player_Text(obj,7234,message,messageRgb); + } + Commands->Start_Timer(obj,this,3.0f,2); + } +} +void JMG_Utility_Zone_Disable_Specific_Weapon_Presets_Attached::Detach(GameObject *obj) +{ + if (_stricmp(message,"")) + Set_HUD_Help_Text_Player_Text(obj,7234," ",messageRgb); + Destroyed(obj); +} +void JMG_Utility_Zone_Disable_Specific_Weapon_Presets_Attached::Destroyed(GameObject *obj) +{ + for (SLNode *current = weaponPresets.Head();current;current = current->Next()) + { + if (!current->Data()->clip && !current->Data()->bullets) + continue; + Set_Clip_Bullets(obj,current->Data()->preset,current->Data()->clip); + Set_Bullets(obj,current->Data()->preset,current->Data()->bullets); + current->Data()->bullets = 0; + current->Data()->clip = 0; + holding = false; + } + weaponPresets.Remove_All(); +} +void JMG_Utility_Zone_Damage_While_In_Zone_Presets::Created(GameObject *obj) +{ + char delim[1]; + sprintf(delim,"%s",Get_Parameter("Delim")); + char presetList[2048]; + sprintf(presetList,"%s",Get_Parameter("Presets")); + char *token = strtok(presetList,delim); + while(token != NULL) + { + char tok[128]; + sprintf(tok,"%s",token); + presets.Add_Tail(new StringNode(tok)); + token = strtok(NULL,delim); + } + damage = Get_Float_Parameter("Damage"); + sprintf(warhead,"%s",Get_Parameter("Warhead")); + sprintf(message,"%s",Get_Parameter("Message")); + messageRgb = Get_Vector3_Parameter("MessageRgb"); + delay = Get_Float_Parameter("Delay"); +} +void JMG_Utility_Zone_Damage_While_In_Zone_Presets::Entered(GameObject *obj,GameObject *enterer) +{ + if (!Is_Script_Attached(enterer,"JMG_Utility_Zone_Damage_While_In_Zone_Presets_Attached")) + { + const char *preset = Commands->Get_Preset_Name(enterer); + for (SLNode *current = presets.Head();current;current = current->Next()) + { + if (!_stricmp(preset,current->Data()->preset)) + { + char params[256]; + sprintf(params,"%.2f,%s,%.2f,%s,%.2f %.2f %.2f",damage,warhead,delay,message,messageRgb.X,messageRgb.Y,messageRgb.Z); + Attach_Script_Once(enterer,"JMG_Utility_Zone_Damage_While_In_Zone_Presets_Attached",params); + return; + } + } + } + if (Is_Script_Attached(enterer,"JMG_Utility_Zone_Damage_While_In_Zone_Presets_Attached")) + { + JMG_Utility_Zone_Damage_While_In_Zone_Presets_Attached *script = (JMG_Utility_Zone_Damage_While_In_Zone_Presets_Attached*)Find_Script_On_Object(enterer,"JMG_Utility_Zone_Damage_While_In_Zone_Presets_Attached"); + if (script) + script->zoneCount++; + } +} +void JMG_Utility_Zone_Damage_While_In_Zone_Presets::Exited(GameObject *obj,GameObject *exiter) +{ + if (!Is_Script_Attached(exiter,"JMG_Utility_Zone_Damage_While_In_Zone_Presets_Attached")) + return; + JMG_Utility_Zone_Damage_While_In_Zone_Presets_Attached *script = (JMG_Utility_Zone_Damage_While_In_Zone_Presets_Attached*)Find_Script_On_Object(exiter,"JMG_Utility_Zone_Damage_While_In_Zone_Presets_Attached"); + if (script) + { + script->zoneCount--;; + if (script->zoneCount <= 0) + Remove_Script(exiter,"JMG_Utility_Zone_Damage_While_In_Zone_Presets_Attached"); + } +} +void JMG_Utility_Zone_Damage_While_In_Zone_Presets::Destroyed(GameObject *obj) +{ + presets.Remove_All(); +} +void JMG_Utility_Zone_Damage_While_In_Zone_Presets_Attached::Created(GameObject *obj) +{ + damage = Get_Float_Parameter("Damage"); + sprintf(warhead,"%s",Get_Parameter("Warhead")); + delay = Get_Float_Parameter("Delay"); + sprintf(message,"%s",Get_Parameter("Message")); + messageRgb = Get_Vector3_Parameter("MessageRgb"); + Commands->Start_Timer(obj,this,0.0f,1); + if (_stricmp(message,"")) + Commands->Start_Timer(obj,this,0.0f,2); +} +void JMG_Utility_Zone_Damage_While_In_Zone_Presets_Attached::Timer_Expired(GameObject *obj,int number) +{ + if (number == 1) + { + Commands->Apply_Damage(obj,damage,warhead,obj); + Commands->Start_Timer(obj,this,delay,1); + } + if (number == 2) + { + GameObject *driver = Get_Vehicle_Driver(obj); + if (driver && Commands->Is_A_Star(driver)) + Set_HUD_Help_Text_Player_Text(driver,7234,message,messageRgb); + else if (Commands->Is_A_Star(obj) && !Get_Vehicle(obj)) + Set_HUD_Help_Text_Player_Text(obj,7234,message,messageRgb); + Commands->Start_Timer(obj,this,3.0f,2); + } +} +void JMG_Utility_Zone_Damage_While_In_Zone_Presets_Attached::Detach(GameObject *obj) +{ + if (_stricmp(message,"")) + Set_HUD_Help_Text_Player_Text(obj,7234," ",messageRgb); +} 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"); @@ -18959,3 +19454,15 @@ ScriptRegistrant JMG_Utility_Killed_Send_Custom_Killer_Registrant("JMG_Utility_Killed_Send_Custom_Killer","ID:int,Custom:int,Param:int,Delay:float"); ScriptRegistrant JMG_Utility_Custom_Send_Custom_To_All_Objects_Sender_Registrant("JMG_Utility_Custom_Send_Custom_To_All_Objects_Sender","Custom:int,SendCustom:int,Param:int,Team=2:int,Delay=0.0:float,MaxDistance=0.0:float"); ScriptRegistrant JMG_Utility_Created_Fire_Randomly_Registrant("JMG_Utility_Created_Fire_Randomly","FireAngle=45.0:float,MinHeight=0:float,MaxHeight=0:float,UpdateRate=1.5:float,UseFacing=-999.0:float"); +ScriptRegistrant JMG_Utility_Turret_Spawn_Registrant("JMG_Utility_Turret_Spawn","Turret_Preset:string,Bone_Name=Tur_Mount:string"); +ScriptRegistrant JMG_Utility_Custom_Send_Custom_Sender_Registrant("JMG_Utility_Custom_Send_Custom_Sender","Custom:int,ID=0:int,SendCustom:int,Param:int,Delay=0.0:float,RandomDelay=0.0:float,RandomChance=0.0:float"); +ScriptRegistrant JMG_Utility_Created_Disable_Footsteps_Registrant("JMG_Utility_Created_Disable_Footsteps",""); +ScriptRegistrant JMG_Utility_Zone_Damage_While_In_Zone_Registrant("JMG_Utility_Zone_Damage_While_In_Zone","Soldier|Motorcycle|Tracked=1.0 1.0 1.0:vector3,VTOL|Wheeled|Unused=1.0 1.0 1.0:vector3,Warhead=None:string,Delay=0.1:float,Message:string,MessageRgb:vector3"); +ScriptRegistrant JMG_Utility_Zone_Damage_While_In_Zone_Attached_Registrant("JMG_Utility_Zone_Damage_While_In_Zone_Attached","Damage:float,Warhead:string,Delay:float,Message:string,MessageRgb:vector3"); +ScriptRegistrant JMG_Utility_Visible_Vehicle_Occupants_Registrant("JMG_Utility_Visible_Vehicle_Occupants","DriverPreset=Simple_Sydney_SandM_Wall:string,SeatBoneName:string,DriverAnimation:string,PassengerAnimation:string,Damageable:int,Debug:int"); +ScriptRegistrant JMG_Utility_Visible_Vehicle_Occupants_Attached_Registrant("JMG_Utility_Visible_Vehicle_Occupants_Attached","OwnerId:int"); +ScriptRegistrant JMG_Utility_Visible_Vehicle_Occupants_Attached_Kill_Cleanup_Registrant("JMG_Utility_Visible_Vehicle_Occupants_Attached_Kill_Cleanup","KillerId:int"); +ScriptRegistrant JMG_Utility_Zone_Disable_Specific_Weapon_Presets_Registrant("JMG_Utility_Zone_Disable_Specific_Weapon_Presets","Presets:string,Delim:string,Message:string,MessageRgb:vector3"); +ScriptRegistrant JMG_Utility_Zone_Disable_Specific_Weapon_Presets_Attached_Registrant("JMG_Utility_Zone_Disable_Specific_Weapon_Presets_Attached","Presets:string,Delim:string,Message:string,MessageRgb:vector3"); +ScriptRegistrant JMG_Utility_Zone_Damage_While_In_Zone_Presets_Registrant("JMG_Utility_Zone_Damage_While_In_Zone_Presets","Presets:string,Delim:string,Damage:float,Warhead=None:string,Delay=0.1:float,Message:string,MessageRgb:vector3"); +ScriptRegistrant JMG_Utility_Zone_Damage_While_In_Zone_Presets_Attached_Registrant("JMG_Utility_Zone_Damage_While_In_Zone_Presets_Attached","Damage:float,Warhead:string,Delay:float,Message:string,MessageRgb:vector3"); diff -urN sourceold/scripts/jmgUtility.h source/scripts/jmgUtility.h --- sourceold/scripts/jmgUtility.h 2024-03-21 19:56:18.000000000 -0500 +++ source/scripts/jmgUtility.h 2025-02-24 20:08:32.494697300 -0600 @@ -159,7 +159,7 @@ }; /*! -* \brief Basic turret attach script, turrets match team of vehicle attached to, turrets are destroyed by destroy event +* \brief Use JMG_Utility_Turret_Spawn instead * \Turret_Preset - Preset of the turret * \Bone_Name - Bone to hook the turret to * \author jgray @@ -859,6 +859,13 @@ Create_2D_Wave_Sound_Dialog_Player(player,soundName); } } + static void Give_Points(GameObject *player,float points) + { + int playerId = Get_Player_ID(player); + if (!playerId) + return; + Set_Score(playerId,Get_Score(playerId)+points); + } }; /*! @@ -920,11 +927,11 @@ char markerModel[16]; int markerColor; char attachBone[16]; - bool overrideTextColor; + int overrideTextColor; Vector3 textColor; - bool overrideHudColor; + int overrideHudColor; Vector3 hudColor; - ObjectiveVisibleSettingOverride(int objectiveId,const char *model,int markerColor,const char *attachBone,bool overrideTextColor,Vector3 textColor,bool overrideHudColor,Vector3 hudColor) + ObjectiveVisibleSettingOverride(int objectiveId,const char *model,int markerColor,const char *attachBone,int overrideTextColor,Vector3 textColor,int overrideHudColor,Vector3 hudColor) { this->objectiveId = objectiveId; sprintf(this->markerModel,"%s",model); @@ -935,6 +942,21 @@ this->overrideHudColor = overrideHudColor; this->hudColor = hudColor; } + static Vector3 DefaultRenegadeColors(int color) + { + switch (color) + { + case RADAR_BLIP_COLOR_NOD:return Vector3(200,0,0); + case RADAR_BLIP_COLOR_GDI:return Vector3(225,175,65); + case RADAR_BLIP_COLOR_NEUTRAL:return Vector3(225,225,240); + case RADAR_BLIP_COLOR_MUTANT:return Vector3(0,100,0); + case RADAR_BLIP_COLOR_RENEGADE:return Vector3(0,0,255); + case RADAR_BLIP_COLOR_PRIMARY_OBJECTIVE:return Vector3(50,225,50); + case RADAR_BLIP_COLOR_SECONDARY_OBJECTIVE:return Vector3(50,150,250); + case RADAR_BLIP_COLOR_TERTIARY_OBJECTIVE:return Vector3(150,50,150); + default:return Vector3(0,0,0); + } + } }; SList overrideVisibleObjectiveSettings; private: @@ -994,7 +1016,13 @@ { ObjectiveVisibleSettingOverride *overrideMarker = FindOverrideForObjective(objectiveId); if (overrideMarker && overrideMarker->overrideTextColor) - JmgUtility::MessageTeamPlayersAndType((int)overrideMarker->textColor.X,(int)overrideMarker->textColor.Y,(int)overrideMarker->textColor.Z,team,format); + if (overrideMarker->overrideTextColor == -1) + { + Vector3 color = ObjectiveVisibleSettingOverride::DefaultRenegadeColors(overrideMarker->markerColor); + JmgUtility::MessageTeamPlayersAndType((int)color.X,(int)color.Y,(int)color.Z,team,format); + } + else + JmgUtility::MessageTeamPlayersAndType((int)overrideMarker->textColor.X,(int)overrideMarker->textColor.Y,(int)overrideMarker->textColor.Z,team,format); else switch (priority) { @@ -1004,7 +1032,27 @@ default: JmgUtility::MessageTeamPlayersAndType(125,150,150,team,format); break; } } - void messagePlayerAndColor(GameObject *player,const char *format,Priority priority) + void messagePlayerAndColor(int objectiveId,GameObject *player,const char *format,Priority priority) + { + ObjectiveVisibleSettingOverride *overrideMarker = FindOverrideForObjective(objectiveId); + if (overrideMarker && overrideMarker->overrideTextColor) + if (overrideMarker->overrideTextColor == -1) + { + Vector3 color = ObjectiveVisibleSettingOverride::DefaultRenegadeColors(overrideMarker->markerColor); + JmgUtility::DisplayChatMessage(player,(int)color.X,(int)color.Y,(int)color.Z,format); + } + else + JmgUtility::DisplayChatMessage(player,(int)overrideMarker->textColor.X,(int)overrideMarker->textColor.Y,(int)overrideMarker->textColor.Z,format); + else + switch (priority) + { + case Primary: JmgUtility::DisplayChatMessage(player,50,255,50,format); break; + case Secondary: JmgUtility::DisplayChatMessage(player,50,150,250,format); break; + case Tertiary:case Unknown: JmgUtility::DisplayChatMessage(player,150,50,150,format); break; + default: JmgUtility::DisplayChatMessage(player,125,150,150,format); break; + } + } + void messagePlayerAndColorBasic(GameObject *player,const char *format,Priority priority) { switch (priority) { @@ -1309,6 +1357,9 @@ } return true; } + /// + /// Update the text of a mission + /// bool Set_Objective_Mission(int objectiveId,unsigned int nameStringId,unsigned int descriptionStringId) { ObjectiveNode *current = objectiveNodeList; @@ -1398,7 +1449,13 @@ { ObjectiveVisibleSettingOverride *overrideMarker = FindOverrideForObjective(current->id); if (overrideMarker && overrideMarker->overrideHudColor) - Set_HUD_Help_Text_Player(obj,current->nameId,Vector3(overrideMarker->hudColor.X/255.0f,overrideMarker->hudColor.Y/255.0f,overrideMarker->hudColor.Z/255.0f)); + if (overrideMarker->overrideHudColor == -1) + { + Vector3 color = ObjectiveVisibleSettingOverride::DefaultRenegadeColors(overrideMarker->markerColor); + Set_HUD_Help_Text_Player(obj,current->nameId,Vector3(color.X/255.0f,color.Y/255.0f,color.Z/255.0f)); + } + else + Set_HUD_Help_Text_Player(obj,current->nameId,Vector3(overrideMarker->hudColor.X/255.0f,overrideMarker->hudColor.Y/255.0f,overrideMarker->hudColor.Z/255.0f)); else Set_HUD_Help_Text_Player(obj,current->nameId,Vector3(0,1,0)); return; @@ -1408,7 +1465,7 @@ } void Display_Current_Objectives(GameObject *player,Priority priority) { - messagePlayerAndColor(player,formatObjectiveString(objectiveListString,objectivePrioritieStrings[priority]),priority); + messagePlayerAndColorBasic(player,formatObjectiveString(objectiveListString,objectivePrioritieStrings[priority]),priority); ObjectiveNode *current = objectiveNodeList; while (current) { @@ -1419,7 +1476,7 @@ sprintf(objectiveMsg,"*%s",formatObjectiveString(Get_Translated_String(current->nameId),current->objectiveNumber)); else sprintf(objectiveMsg,"*%s",Get_Translated_String(current->nameId)); - messagePlayerAndColor(player,objectiveMsg,priority); + messagePlayerAndColor(current->id,player,objectiveMsg,priority); } current = current->next; } @@ -1514,6 +1571,11 @@ return true; } GameObject *GetObjectiveMarker(int objectiveMarkerId,GameObject *sender,int objectiveId); + void OverrideObjectiveVisibilitySettings(int objectiveId,const char *model,int markerColor,const char *attachBone,int overrideTextColor,Vector3 textColor,int overrideHudColor,Vector3 hudColor) + { + ObjectiveVisibleSettingOverride *overrideObject = new ObjectiveVisibleSettingOverride(objectiveId,model,markerColor,attachBone,overrideTextColor,textColor,overrideHudColor,hudColor); + overrideVisibleObjectiveSettings.Add_Tail(overrideObject); + } }; class ClientNetworkObjectPositionSync @@ -2024,6 +2086,31 @@ Current = Current->next; } } + void ChangeAllWanderPointGroupIdsThatMatch(int changeId,int newId) + { + SimplePositionNode *current = SimplePositionNodeList; + while (current) + { + if (changeId == current->value) + current->value = newId; + current = current->next; + } + } + void ChangeAllWanderPointGroupIdsThatMatchAndAreInRange(int changeId,Vector3 pos,float range,int newId) + { + float rangeSq = range*range; + SimplePositionNode *current = SimplePositionNodeList; + while (current) + { + if (changeId == current->value) + { + float tempDist = JmgUtility::SimpleDistance(pos,current->position); + if (tempDist <= rangeSq) + current->value = newId; + } + current = current->next; + } + } }; /*! * \brief An object that will have its position synced by JMG_Utility_Sync_System_Controller @@ -6984,6 +7071,7 @@ void SetFacing(GameObject *obj,float facing); void Initial_Spawn(GameObject *obj); int GetPlayerLimitModifier(); + JMG_Utility_Basic_Spawner_In_Radius::SpawnFailureTypes TryPlacement(GameObject *spawned,Vector3 bottomRay); }; /*! @@ -11564,11 +11652,11 @@ * \brief Allows the visible marker, text color, and radar blip color to be overridden for a specific objective * \ObjectiveID - ID of the objective to override * \MarkerModel - Model to use instead, leave blank if you don't want it to override -* \MarkerColor - Radar color to make use of, leave -1 if you don't want it to override +* \MarkerColor - Radar color to make use of, leave -1 if you don't want it to override (RADAR_BLIP_COLOR_NOD = 0, RADAR_BLIP_COLOR_GDI, RADAR_BLIP_COLOR_NEUTRAL, RADAR_BLIP_COLOR_MUTANT, RADAR_BLIP_COLOR_RENEGADE, RADAR_BLIP_COLOR_PRIMARY_OBJECTIVE, RADAR_BLIP_COLOR_SECONDARY_OBJECTIVE, RADAR_BLIP_COLOR_TERTIARY_OBJECTIVE) * \AttachBone - Bone to attach to, leave blank if you don't want it to override -* \OverrideTextColor - 0 means don't override text color, any other number will override +* \OverrideTextColor - 0 means don't override text color, 1 means override, -1 uses default renegade team coloring, specified by MarkerColor * \TextColor - Color to use for the objective text, 0-255 -* \OverrideHudColor - 0 means don't override HUD color, any other number will override +* \OverrideHudColor - 0 means don't override text color, 1 means override, -1 uses default renegade team coloring, specified by MarkerColor * \HudColor - Color to use for the objective HUD message, 0-255 * \author jgray * \ingroup JmgUtility @@ -12326,4 +12414,273 @@ float useFacing; void Created(GameObject *obj); void Timer_Expired(GameObject *obj,int number); +}; + +/*! +* \brief Basic turret attach script, turrets match team of vehicle attached to, turrets are destroyed by destroy event +* \Turret_Preset - Preset of the turret +* \Bone_Name - Bone to hook the turret to +* \author jgray +* \ingroup JmgUtility +*/ +class JMG_Utility_Turret_Spawn : public ScriptImpClass +{ + int turretId; + bool hasDriver; + void Created(GameObject *obj); + void Custom(GameObject *obj,int message,int param,GameObject *sender); + void Killed(GameObject *obj,GameObject *killer); + void Destroyed(GameObject *obj); + void Detach(GameObject *obj); +}; + +/*! +* \brief Sends a custom on a custom from the sender +* \Custom - Custom to watch 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 +* \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_Custom_Send_Custom_Sender : public ScriptImpClass { + int recieveMessage; + int id; + int custom; + int Param; + float delay; + float randomDelay; + float randomChance; + void Created(GameObject *obj); + void Custom(GameObject *obj,int message,int param,GameObject *sender); +}; + +/*! +* \brief Disables the footstep effects of the attached infantry +* \ingroup JmgUtility +*/ +class JMG_Utility_Created_Disable_Footsteps : public ScriptImpClass { + void Created(GameObject *obj); + void Timer_Expired(GameObject *obj,int number); +}; + +/*! +* \brief Applies damage to the selected class(s) of vehicle or soldier while inside the zone(s) +* \Soldier|Motorcycle|Tracked - How much damage to apply to each type, if 0 nothing happens to that type +* \VTOL|Wheeled|Unused - How much damage to apply to each type, if 0 nothing happens to that type +* \Warhead - warhead to use +* \Delay - delay between each damage effect +* \Message - Message to display on the hud while in the zone +* \MessageRgb - Color of the displayed message RGB (0-1) +* \author jgray +* \ingroup JmgUtility +*/ +class JMG_Utility_Zone_Damage_While_In_Zone : public ScriptImpClass { + Vector3 soldierMotorcycleTracked; + Vector3 vtolWheeledUnused; + char warhead[128]; + float delay; + char message[220]; + Vector3 messageRgb; + void Created(GameObject *obj); + void Entered(GameObject *obj,GameObject *enterer); + void Exited(GameObject *obj,GameObject *exiter); + void AttachScript(GameObject *obj,float damage); +}; + +/*! +* \brief Attached by JMG_Utility_Zone_Damage_While_In_Zone +* \author jgray +* \ingroup JmgUtility +*/ +class JMG_Utility_Zone_Damage_While_In_Zone_Attached : public ScriptImpClass { + float damage; + char warhead[128]; + float delay; + char message[220]; + Vector3 messageRgb; + void Created(GameObject *obj); + void Timer_Expired(GameObject *obj,int number); + void Detach(GameObject *obj); +public: + int zoneCount; + JMG_Utility_Zone_Damage_While_In_Zone_Attached() + { + zoneCount = 0; + } +}; + +/*! +* \brief Adds a visible (and potentially damageable) prop as a driver or passenger to the vehicle +* \DriverPreset - Object that gets replaced with the player's model and health (I recommend a simple object that is not targetable and have blammo heath by default) +* \SeatBoneName - Base name for the seat bone to attach to (IE FakeSeat would give you: FakeSeat0 FakeSeat1 etc) +* \DriverAnimation - Animation to play for the driver +* \PassengerAnimation - Animation to play for the passengers +* \Damageable - Can the occupants be hurt +* \Debug - When in enabled all occupants will be visible when one person enters, useful for debugging +* \author jgray +* \ingroup JmgUtility +*/ +class JMG_Utility_Visible_Vehicle_Occupants : public ScriptImpClass { + char driverPreset[64]; + char seatBoneName[16]; + char driverAnimation[32]; + char passengerAnimation[32]; + bool damageable; + float debug; + int occupantActualIds[64]; + int occupantVisibleIds[64]; + void Created(GameObject *obj); + void Custom(GameObject *obj,int message,int param,GameObject *sender); + void Destroyed(GameObject *obj); + void AddOccupant(GameObject *obj,GameObject *sender,int seatId); +public: + JMG_Utility_Visible_Vehicle_Occupants() + { + for (int x = 0;x < 64;x++) + { + occupantActualIds[x] = 0; + occupantVisibleIds[x] = 0; + } + } +}; + +/*! +* \brief Attached by JMG_Utility_Visible_Vehicle_Occupants +* \author jgray +* \ingroup JmgUtility +*/ +class JMG_Utility_Visible_Vehicle_Occupants_Attached : public ScriptImpClass +{ + void Killed(GameObject *obj,GameObject *killer); +}; + +/*! +* \brief Attached by JMG_Utility_Visible_Vehicle_Occupants +* \author jgray +* \ingroup JmgUtility +*/ +class JMG_Utility_Visible_Vehicle_Occupants_Attached_Kill_Cleanup : public ScriptImpClass +{ + void Created(GameObject *obj); + void Timer_Expired(GameObject *obj,int number); +}; + +/*! +* \brief Disables all weapons that are listed (try not to have multiple of this script on the same zone, it'll have odd issues) by setting their ammo to 0 and then restoring it when you leave +* \Presets - a list of presets separated by the delim (IE: POW_Pistol_Player@CnC_Weapon_AutoRifle_Player_Nod@CnC_Weapon_APC_M60MG_RedTracer) +* \Delim - the character used to split the preset string, don't use , +* \Message - Message to display while holding the beacon +* \MessageRgb - Color of the displayed message RGB (0-1) +* \author jgray +* \ingroup JmgUtility +*/ +class JMG_Utility_Zone_Disable_Specific_Weapon_Presets : public ScriptImpClass { + char presets[1024]; + char delim; + char message[220]; + Vector3 messageRgb; + void Created(GameObject *obj); + void Entered(GameObject *obj,GameObject *enterer); + void Exited(GameObject *obj,GameObject *exiter); +public: + JMG_Utility_Zone_Disable_Specific_Weapon_Presets() + { + sprintf(presets,""); + delim = ' '; + sprintf(message,""); + } +}; + +/*! +* \brief Attached by JMG_Utility_Zone_Disable_Specific_Weapon_Presets +* \author jgray +* \ingroup JmgUtility +*/ +class JMG_Utility_Zone_Disable_Specific_Weapon_Presets_Attached : public ScriptImpClass { + struct StringNode + { + char preset[128]; + int bullets; + int clip; + StringNode(const char *preset) + { + bullets = 0; + clip = 0; + sprintf(this->preset,"%s",preset); + } + }; + bool holding; + SList weaponPresets; + char message[220]; + Vector3 messageRgb; + void Created(GameObject *obj); + void Timer_Expired(GameObject *obj,int number); + void Detach(GameObject *obj); + void Destroyed(GameObject *obj); +public: + int zoneCount; + JMG_Utility_Zone_Disable_Specific_Weapon_Presets_Attached() + { + zoneCount = 0; + weaponPresets.Remove_All(); + } +}; + +/*! +* \brief Like JMG_Utility_Zone_Damage_While_In_Zone but only affects certain presets +* \Presets - a list of presets separated by the delim (IE: Nod_Jet@CnC_Nod_Buggy@CnC_Nod_Minigunner_0) +* \Delim - the character used to split the preset string, don't use , +* \Damage - how much damage to do to the specified vehicles +* \Warhead - warhead to use +* \Delay - delay between each damage effect +* \Message - Message to display on the hud while in the zone +* \MessageRgb - Color of the displayed message RGB (0-1) +* \author jgray +* \ingroup JmgUtility +*/ +class JMG_Utility_Zone_Damage_While_In_Zone_Presets : public ScriptImpClass { + struct StringNode + { + char preset[128]; + StringNode(const char *preset) + { + sprintf(this->preset,"%s",preset); + } + }; + float damage; + SList presets; + char warhead[128]; + float delay; + char message[220]; + Vector3 messageRgb; + void Created(GameObject *obj); + void Entered(GameObject *obj,GameObject *enterer); + void Exited(GameObject *obj,GameObject *exiter); + void Destroyed(GameObject *obj); +}; + +/*! +* \brief Attached by JMG_Utility_Zone_Damage_While_In_Zone_Presets +* \author jgray +* \ingroup JmgUtility +*/ +class JMG_Utility_Zone_Damage_While_In_Zone_Presets_Attached : public ScriptImpClass { + float damage; + char warhead[128]; + float delay; + char message[220]; + Vector3 messageRgb; + void Created(GameObject *obj); + void Timer_Expired(GameObject *obj,int number); + void Detach(GameObject *obj); +public: + int zoneCount; + JMG_Utility_Zone_Damage_While_In_Zone_Presets_Attached() + { + zoneCount = 0; + } }; \ No newline at end of file diff -urN sourceold/scripts/obelfix.cpp source/scripts/obelfix.cpp --- sourceold/scripts/obelfix.cpp 2024-03-21 19:56:18.000000000 -0500 +++ source/scripts/obelfix.cpp 2025-02-24 20:08:32.504696400 -0600 @@ -59,8 +59,8 @@ Commands->Select_Weapon(WeaponObj, Def->Get_Name()); } } - Set_Object_Type(WeaponObj, Get_Object_Type(ObeliskObj)); Commands->Attach_Script(WeaponObj, "Obelisk_Weapon_CnC", Get_Parameter("EffectModel")); + Set_Object_Type(WeaponObj, Get_Object_Type(ObeliskObj)); WeaponID = Commands->Get_ID(WeaponObj); } } @@ -72,7 +72,6 @@ void Obelisk_Weapon_CnC::Created(GameObject* WeaponObj) { // Some settings Commands->Set_Is_Rendered(WeaponObj, false); // It's not visible - Commands->Set_Player_Type(WeaponObj, 0); // We're a Nod Obelisk, GDI will not own an Obelisk Commands->Enable_Enemy_Seen(WeaponObj, true); // We want to get notified when we see an enemy Commands->Enable_Hibernation(WeaponObj, false); // Not controlled, or whatever? Commands->Innate_Enable(WeaponObj); // Dunno :) @@ -313,8 +312,9 @@ Commands->Select_Weapon(WeaponObj, Def->Get_Name()); } } - WeaponID = Commands->Get_ID(WeaponObj); Commands->Attach_Script(WeaponObj, "Obelisk_Weapon_CnC_Ground", ""); + Set_Object_Type(WeaponObj, Get_Object_Type(ObeliskObj)); + WeaponID = Commands->Get_ID(WeaponObj); } } } @@ -363,7 +363,6 @@ void Obelisk_Weapon_CnC_Ground::Created(GameObject* WeaponObj) { // Some settings Commands->Set_Is_Rendered(WeaponObj, false); // It's not visible - Commands->Set_Player_Type(WeaponObj, 0); // We're a Nod Obelisk, GDI will not own an Obelisk Commands->Enable_Enemy_Seen(WeaponObj, true); // We want to get notified when we see an enemy Commands->Enable_Hibernation(WeaponObj, false); // Not controlled, or whatever? Commands->Innate_Enable(WeaponObj); // Dunno :) diff -urN sourceold/scripts/unstoppable.cpp source/scripts/unstoppable.cpp --- sourceold/scripts/unstoppable.cpp 2024-03-21 19:56:18.000000000 -0500 +++ source/scripts/unstoppable.cpp 2025-02-24 20:08:32.514695100 -0600 @@ -1596,3 +1596,291 @@ ScriptRegistrant UP_No_Targeting_Zone_Registrant("UP_No_Targeting_Zone", ""); /******************************************************************************************************/ + +void UP_Send_Message_Self_On_Custom::Created(GameObject* obj) +{ + if (!Commands->Is_A_Star(obj)) + { + Destroy_Script(); + } +} + +void UP_Send_Message_Self_On_Custom::Custom(GameObject* obj, int type, int param, GameObject* sender) +{ + if (type == Get_Int_Parameter("ID") && param == Get_Int_Parameter("Param")) + { + Send_Message_Player(obj, Get_Int_Parameter("Red"), Get_Int_Parameter("Green"), Get_Int_Parameter("Blue"), Get_Parameter("Message")); + + if (Get_Int_Parameter("DestroyAfterSend")) + { + Destroy_Script(); + } + } +} + +ScriptRegistrant UP_Send_Message_Self_On_Custom_Registrant("UP_Send_Message_Self_On_Custom", "ID:int,Param:int,Red=255:int,Green=255:int,Blue=255:int,Message:string,DestroyAfterSend=0:int"); + +/******************************************************************************************************/ + +void UP_Send_Message_Sender_On_Custom::Custom(GameObject* obj, int type, int param, GameObject* sender) +{ + if (type == Get_Int_Parameter("ID") && param == Get_Int_Parameter("Param")) + { + if (sender && Commands->Is_A_Star(sender)) + { + Send_Message_Player(sender, Get_Int_Parameter("Red"), Get_Int_Parameter("Green"), Get_Int_Parameter("Blue"), Get_Parameter("Message")); + + if (Get_Int_Parameter("DestroyAfterSend")) + { + Destroy_Script(); + } + } + } +} + +ScriptRegistrant UP_Send_Message_Sender_On_Custom_Registrant("UP_Send_Message_Sender_On_Custom", "ID:int,Param:int,Red=255:int,Green=255:int,Blue=255:int,Message:string,DestroyAfterSend=0:int"); + +/******************************************************************************************************/ + +void UP_Print_Console_Self_On_Custom::Created(GameObject* obj) +{ + if (!Commands->Is_A_Star(obj)) + { + Destroy_Script(); + } +} + +void UP_Print_Console_Self_On_Custom::Custom(GameObject* obj, int type, int param, GameObject* sender) +{ + if (type == Get_Int_Parameter("ID") && param == Get_Int_Parameter("Param")) + { + Print_Client_Console_Player(obj, Get_Parameter("Message"), Vector4(Get_Int_Parameter("Alpha") / 255.f, Get_Int_Parameter("Red") / 255.f, Get_Int_Parameter("Green") / 255.f, Get_Int_Parameter("Blue") / 255.f)); + + if (Get_Int_Parameter("DestroyAfterSend")) + { + Destroy_Script(); + } + } +} + +ScriptRegistrant UP_Print_Console_Self_On_Custom_Registrant("UP_Print_Console_Self_On_Custom", "ID:int,Param:int,Alpha=255:int,Red=255:int,Green=255:int,Blue=255:int,Message:string,DestroyAfterSend=0:int"); + +/******************************************************************************************************/ + +void UP_Print_Console_Sender_On_Custom::Custom(GameObject* obj, int type, int param, GameObject* sender) +{ + if (type == Get_Int_Parameter("ID") && param == Get_Int_Parameter("Param")) + { + if (sender && Commands->Is_A_Star(sender)) + { + Print_Client_Console_Player(sender, Get_Parameter("Message"), Vector4(Get_Int_Parameter("Alpha") / 255.f, Get_Int_Parameter("Red") / 255.f, Get_Int_Parameter("Green") / 255.f, Get_Int_Parameter("Blue") / 255.f)); + + if (Get_Int_Parameter("DestroyAfterSend")) + { + Destroy_Script(); + } + } + } +} + +ScriptRegistrant UP_Print_Console_Sender_On_Custom_Registrant("UP_Print_Console_Sender_On_Custom", "ID:int,Param:int,Alpha=255:int,Red=255:int,Green=255:int,Blue=255:int,Message:string,DestroyAfterSend=0:int"); + +/******************************************************************************************************/ + +void UP_Add_Chat_History_Self_On_Custom::Created(GameObject* obj) +{ + if (!Commands->Is_A_Star(obj)) + { + Destroy_Script(); + } +} + +void UP_Add_Chat_History_Self_On_Custom::Custom(GameObject* obj, int type, int param, GameObject* sender) +{ + if (type == Get_Int_Parameter("ID") && param == Get_Int_Parameter("Param")) + { + Add_Shadow_Message(Get_Player_ID(obj), Vector3(Get_Int_Parameter("Red") / 255.f, Get_Int_Parameter("Green") / 255.f, Get_Int_Parameter("Blue") / 255.f), WideStringClass(Get_Parameter("Message"))); + + if (Get_Int_Parameter("DestroyAfterSend")) + { + Destroy_Script(); + } + } +} + +ScriptRegistrant UP_Add_Chat_History_Self_On_Custom_Registrant("UP_Add_Chat_History_Self_On_Custom", "ID:int,Param:int,Red=255:int,Green=255:int,Blue=255:int,Message:string,DestroyAfterSend=0:int"); + +/******************************************************************************************************/ + +void UP_Add_Chat_History_Sender_On_Custom::Custom(GameObject* obj, int type, int param, GameObject* sender) +{ + if (type == Get_Int_Parameter("ID") && param == Get_Int_Parameter("Param")) + { + if (sender && Commands->Is_A_Star(sender)) + { + Add_Shadow_Message(Get_Player_ID(sender), Vector3(Get_Int_Parameter("Red") / 255.f, Get_Int_Parameter("Green") / 255.f, Get_Int_Parameter("Blue") / 255.f), WideStringClass(Get_Parameter("Message"))); + + if (Get_Int_Parameter("DestroyAfterSend")) + { + Destroy_Script(); + } + } + } +} + +ScriptRegistrant UP_Add_Chat_History_Sender_On_Custom_Registrant("UP_Add_Chat_History_Sender_On_Custom", "ID:int,Param:int,Red=255:int,Green=255:int,Blue=255:int,Message:string,DestroyAfterSend=0:int"); + +/******************************************************************************************************/ + +void UP_Grant_Credits_Self_On_Custom::Created(GameObject* obj) +{ + if (!Commands->Is_A_Star(obj)) + { + Destroy_Script(); + } +} + +void UP_Grant_Credits_Self_On_Custom::Custom(GameObject* obj, int type, int param, GameObject* sender) +{ + if (type == Get_Int_Parameter("ID")) + { + Commands->Give_Money(obj, (float)param, false); + + if (Get_Int_Parameter("DestroyAfterSend")) + { + Destroy_Script(); + } + } +} + +ScriptRegistrant UP_Grant_Credits_Self_On_Custom_Registrant("UP_Grant_Credits_Self_On_Custom", "ID:int,DestroyAfterSend=0:int"); + +/******************************************************************************************************/ + +void UP_Grant_Credits_Sender_On_Custom::Custom(GameObject* obj, int type, int param, GameObject* sender) +{ + if (type == Get_Int_Parameter("ID")) + { + if (sender && Commands->Is_A_Star(sender)) + { + Commands->Give_Money(sender, (float)param, false); + + if (Get_Int_Parameter("DestroyAfterSend")) + { + Destroy_Script(); + } + } + } +} + +ScriptRegistrant UP_Grant_Credits_Sender_On_Custom_Registrant("UP_Grant_Credits_Sender_On_Custom", "ID:int,DestroyAfterSend=0:int"); + +/******************************************************************************************************/ + +void UP_Grant_Credits_Team_On_Custom::Custom(GameObject* obj, int type, int param, GameObject* sender) +{ + if (type == Get_Int_Parameter("ID")) + { + if (sender && Commands->Is_A_Star(sender)) + { + int team = Get_Int_Parameter("Team"); + + for(SLNode* n = Get_Player_List()->Head(); n; n = n->Next()) + { + if (n->Data()->Get_Player_Type() == team) + { + n->Data()->Increment_Money((float)param); + } + } + + if (Get_Int_Parameter("DestroyAfterSend")) + { + Destroy_Script(); + } + } + } +} + +ScriptRegistrant UP_Grant_Credits_Team_On_Custom_Registrant("UP_Grant_Credits_Sender_On_Custom", "Team:int,ID:int,DestroyAfterSend=0:int"); + +/******************************************************************************************************/ + +void UP_Steal_Credits_On_Custom::Custom(GameObject* obj, int type, int param, GameObject* sender) +{ + if (type == Get_Int_Parameter("ID")) + { + int team = Get_Int_Parameter("Team"); + switch (team) + { + case -1: + if (sender) team = Get_Object_Type(sender); + break; + + case -2: + team = Get_Object_Type(obj); + break; + + case -3: + if (sender) team = Get_Object_Type(sender) ? 0 : 1; + break; + + case -4: + team = Get_Object_Type(obj) ? 0 : 1; + break; + } + + float percentage = Get_Float_Parameter("Percentage"); + if (percentage < 0) + { + percentage = param / 100.f; + } + + int otherTeam = team ? 0 : 1; + float stolenCredits = Steal_Team_Credits(percentage, team); + float distributedCredits = stolenCredits / Get_Team_Player_Count(otherTeam); + + for (SLNode* n = Get_Player_List()->Head(); n; n = n->Next()) + { + if (n->Data()->Get_Player_Type() == otherTeam) + { + n->Data()->Increment_Money(distributedCredits); + } + } + + if (Get_Int_Parameter("DestroyAfterSteal")) + { + Destroy_Script(); + } + } +} + +ScriptRegistrant UP_Steal_Credits_On_Custom_Registrant("UP_Steal_Credits_On_Custom", "Team=-2:int,Percentage:int,ID:int,DestroyAfterSteal=0:int"); + +/******************************************************************************************************/ + +bool UP_No_Refill::RefillHookInstalled = false; +int UP_No_Refill::AliveScriptCount = 0; + +void UP_No_Refill::Created(GameObject* obj) +{ + if (!RefillHookInstalled) + { + AddRefillHook(Refill_Hook); + RefillHookInstalled = true; + } + AliveScriptCount++; +} + +void UP_No_Refill::Destroyed(GameObject* obj) +{ + AliveScriptCount--; +} + +bool UP_No_Refill::Refill_Hook(GameObject* purchaser) +{ + return !AliveScriptCount; +} + +ScriptRegistrant UP_No_Refill_Registrant("UP_No_Refill", ""); + +/******************************************************************************************************/ \ No newline at end of file diff -urN sourceold/scripts/unstoppable.h source/scripts/unstoppable.h --- sourceold/scripts/unstoppable.h 2024-03-21 19:56:18.000000000 -0500 +++ source/scripts/unstoppable.h 2025-02-24 20:08:32.514695100 -0600 @@ -1094,4 +1094,289 @@ public: void Entered(GameObject* obj, GameObject* enterer); void Exited(GameObject* obj, GameObject* exiter); +}; + +/*! + * \brief Send Message to Self On Custom + * \author Unstoppable + * \ingroup UnstoppableScripts + * + * Sends a chat message to the attached object when a custom event is received. If the attached object is not a player, then script destroys itself. + * + * \param ID + * The custom message ID. + * \param Param + * The custom message parameter. + * \param Red + * Red tone of the message. + * \param Green + * Green tone of the message. + * \param Blue + * Blue tone of the message. + * \param Message + * The message to be displayed. + * \param DestroyAfterSend + * Destroys the script after sending the message if set to 1. + */ +class UP_Send_Message_Self_On_Custom : public ScriptImpClass +{ +public: + void Created(GameObject* obj); + void Custom(GameObject* obj, int type, int param, GameObject* sender); +}; + +/*! + * \brief Send Message to Sender On Custom + * \author Unstoppable + * \ingroup UnstoppableScripts + * + * Sends a chat message to the sender of a custom event. + * + * \param ID + * The custom message ID. + * \param Param + * The custom message parameter. + * \param Red + * Red tone of the message. + * \param Green + * Green tone of the message. + * \param Blue + * Blue tone of the message. + * \param Message + * The message to be displayed. + * \param DestroyAfterSend + * Destroys the script after sending the message if set to 1. + */ +class UP_Send_Message_Sender_On_Custom : public ScriptImpClass +{ +public: + void Custom(GameObject* obj, int type, int param, GameObject* sender); +}; + +/*! + * \brief Print Console of Self On Custom + * \author Unstoppable + * \ingroup UnstoppableScripts + * + * Prints a message to the console of the attached object when a custom event is received. If the attached object is not a player, then script destroys itself. + * + * \param ID + * The custom message ID. + * \param Param + * The custom message parameter. + * \param Alpha + * Alpha (transparency) tone of the message. + * \param Red + * Red tone of the message. + * \param Green + * Green tone of the message. + * \param Blue + * Blue tone of the message. + * \param Message + * The message to be displayed. + * \param DestroyAfterSend + * Destroys the script after printing the message if set to 1. + */ +class UP_Print_Console_Self_On_Custom : public ScriptImpClass +{ +public: + void Created(GameObject* obj); + void Custom(GameObject* obj, int type, int param, GameObject* sender); +}; + +/*! + * \brief Print Console of Sender On Custom + * \author Unstoppable + * \ingroup UnstoppableScripts + * + * Prints a message to the console of the sender of a custom event. + * + * \param ID + * The custom message ID. + * \param Param + * The custom message parameter. + * \param Alpha + * Alpha (transparency) tone of the message. + * \param Red + * Red tone of the message. + * \param Green + * Green tone of the message. + * \param Blue + * Blue tone of the message. + * \param Message + * The message to be displayed. + * \param DestroyAfterSend + * Destroys the script after printing the message if set to 1. + */ +class UP_Print_Console_Sender_On_Custom : public ScriptImpClass +{ +public: + void Custom(GameObject* obj, int type, int param, GameObject* sender); +}; + +/*! + * \brief Add Chat History to Self On Custom + * \author Unstoppable + * \ingroup UnstoppableScripts + * + * Adds a message to the chat history (without displaying in chat) of attached object when a custom event is received. If the attached object is not a player, then script destroys itself. + * + * \param ID + * The custom message ID. + * \param Param + * The custom message parameter. + * \param Red + * Red tone of the message. + * \param Green + * Green tone of the message. + * \param Blue + * Blue tone of the message. + * \param Message + * The message to be displayed. + * \param DestroyAfterSend + * Destroys the script after sending the message if set to 1. + */ +class UP_Add_Chat_History_Self_On_Custom : public ScriptImpClass +{ +public: + void Created(GameObject* obj); + void Custom(GameObject* obj, int type, int param, GameObject* sender); +}; + +/*! + * \brief Add Chat History to Sender On Custom + * \author Unstoppable + * \ingroup UnstoppableScripts + * + * Sends a chat message to the sender of a custom event. + * + * \param ID + * The custom message ID. + * \param Param + * The custom message parameter. + * \param Red + * Red tone of the message. + * \param Green + * Green tone of the message. + * \param Blue + * Blue tone of the message. + * \param Message + * The message to be displayed. + * \param DestroyAfterSend + * Destroys the script after sending the message if set to 1. + */ +class UP_Add_Chat_History_Sender_On_Custom : public ScriptImpClass +{ +public: + void Custom(GameObject* obj, int type, int param, GameObject* sender); +}; + +/*! + * \brief Grant Credits to Self On Custom + * \author Unstoppable + * \ingroup UnstoppableScripts + * + * Grants credits to attached object when a custom event is received. The amount is determined by the custom message's parameter. If the attached object is not a player, then script destroys itself. + * + * \param ID + * The custom message ID. + * \param DestroyAfterGrant + * Destroys the script after sending the message if set to 1. + */ +class UP_Grant_Credits_Self_On_Custom : public ScriptImpClass +{ +public: + void Created(GameObject* obj); + void Custom(GameObject* obj, int type, int param, GameObject* sender); +}; + +/*! + * \brief Grant Credits to Sender On Custom + * \author Unstoppable + * \ingroup UnstoppableScripts + * + * Grants credits to the sender of a custom event. The amount is determined by the custom message's parameter. + * + * \param ID + * The custom message ID. + * \param DestroyAfterGrant + * Destroys the script after sending the message if set to 1. + */ +class UP_Grant_Credits_Sender_On_Custom : public ScriptImpClass +{ +public: + void Custom(GameObject* obj, int type, int param, GameObject* sender); +}; + +/*! + * \brief Grant Credits to Team On Custom + * \author Unstoppable + * \ingroup UnstoppableScripts + * + * Grants credits to the entire team on a custom event. The amount is determined by the custom message's parameter. + * + * \param Team + * The team which receives the credits. + * \param ID + * The custom message ID. + * \param DestroyAfterGrant + * Destroys the script after sending the message if set to 1. + */ +class UP_Grant_Credits_Team_On_Custom : public ScriptImpClass +{ +public: + void Custom(GameObject* obj, int type, int param, GameObject* sender); +}; + +/*! + * \brief Steal Credits On Custom + * \author Unstoppable + * \ingroup UnstoppableScripts + * + * Steal credits from a team and evenly distributes the stolen credits to the opponent team on a custom event. + * + * \param Team + * The team which loses the credits. + * \param Percentage + * The percentage of credits to be stolen from the team. Setting to a negative value (such as -1) will use the custom message's parameter value as the percentage. + * \param ID + * The custom message ID. + * \param DestroyAfterSteal + * Destroys the script after stealing the credits if set to 1. + * + * \remark + * The "Team" parameter has 4 special values. + * -1 = Steal credits from the team of the sender object. + * -2 = Steal credits from the team of the attached object. + * -3 = Steal credits from the opponent team of the sender object. + * -4 = Steal credits from the opponent team of the attached object. + * + * \remark + * Normally, the range of "Percentage" parameter is [0, 1]. However, if the "Percentage" parameter is negative, then the custom message's parameter value's range is [0, 100]. + */ +class UP_Steal_Credits_On_Custom : public ScriptImpClass +{ +public: + void Custom(GameObject* obj, int type, int param, GameObject* sender); +}; + +/*! + * \brief No Refill + * \author Unstoppable + * \ingroup UnstoppableScripts + * + * Disables refilling as long as there is at least 1 instance of the script. + */ +class UP_No_Refill : public ScriptImpClass +{ +public: + void Created(GameObject* obj); + void Destroyed(GameObject* obj); + +protected: + static bool Refill_Hook(GameObject* purchaser); + +private: + static bool RefillHookInstalled; + static int AliveScriptCount; }; \ No newline at end of file