diff -uwrN sourceold/scripts/jmgUtility.cpp source/scripts/jmgUtility.cpp --- sourceold/scripts/jmgUtility.cpp 2018-11-11 08:30:08.535600000 +1000 +++ source/scripts/jmgUtility.cpp 2018-11-17 10:23:57.239600000 +1000 @@ -2221,6 +2221,11 @@ startedFadeRed = false; drownTime = 0.0f; defaultSpeed = obj->As_SoldierGameObj()->Get_Max_Speed(); + waterDamageDelayTime = remainingWaterDamageDelay = Get_Int_Parameter("WaterDamageDelayTime"); + waterDamageDelayTimeRecover = Get_Int_Parameter("WaterDamageDelayTimeRecover"); + sprintf(originalSkin,""); + sprintf(originalArmor,""); + sprintf(originalModel,""); for (SLNode* node = GameObjManager::ScriptZoneGameObjList.Head(); node; node = node->Next()) { GameObject *zone = (GameObject *)node->Data(); @@ -2291,9 +2296,17 @@ const char *weap = Get_Current_Weapon(obj); if (Has_Weapon(obj,Get_Parameter("WeaponPreset")) && (!weap || _stricmp(weap,Get_Parameter("WeaponPreset")))) Commands->Select_Weapon(obj,Get_Parameter("WeaponPreset")); - if (Get_Float_Parameter("WaterDamageAmount")) + if (remainingWaterDamageDelay) + remainingWaterDamageDelay--; + if (!remainingWaterDamageDelay && Get_Float_Parameter("WaterDamageAmount")) Commands->Apply_Damage(obj,Get_Float_Parameter("WaterDamageAmount"),Get_Parameter("WaterDamageWarhead"),Commands->Find_Object(lastWaterZoneId)); } + else if (!isInWater[playerId] && remainingWaterDamageDelay < waterDamageDelayTime) + { + remainingWaterDamageDelay += waterDamageDelayTimeRecover; + if (remainingWaterDamageDelay > waterDamageDelayTime) + remainingWaterDamageDelay = waterDamageDelayTime; + } Commands->Start_Timer(obj,this,0.1f,1); } } @@ -2321,6 +2334,12 @@ if (Has_Weapon(obj,Get_Parameter("WeaponPreset"))) Remove_Weapon(obj,Get_Parameter("WeaponPreset")); obj->As_SoldierGameObj()->Set_Max_Speed(defaultSpeed); + if (_stricmp(Get_Parameter("SwimmingSkin"),"")) + Set_Skin(obj,originalSkin); + if (_stricmp(Get_Parameter("SwimmingArmor"),"")) + Commands->Set_Shield_Type(obj,originalArmor); + if (_stricmp(Get_Parameter("SwimmingModel"),"")) + Commands->Set_Model(obj,originalModel); } } if (message == 347341) @@ -2344,6 +2363,21 @@ obj->As_SoldierGameObj()->Set_Can_Play_Damage_Animations(false); obj->As_SoldierGameObj()->Set_Movement_Loiters_Allowed(false); Commands->Set_Loiters_Allowed(obj,false); + if (_stricmp(Get_Parameter("SwimmingSkin"),"")) + { + sprintf(originalSkin,"%s",Get_Skin(obj)); + Set_Skin(obj,Get_Parameter("SwimmingSkin")); + } + if (_stricmp(Get_Parameter("SwimmingArmor"),"")) + { + sprintf(originalArmor,"%s",Get_Shield_Type(obj)); + Commands->Set_Shield_Type(obj,Get_Parameter("SwimmingArmor")); + } + if (_stricmp(Get_Parameter("SwimmingModel"),"")) + { + sprintf(originalModel,"%s",Get_Model(obj)); + Commands->Set_Model(obj,Get_Parameter("SwimmingModel")); + } } waterZoneCount++; } @@ -8567,7 +8601,7 @@ repeat = Get_Int_Parameter("Repeat") ? true : false; id = Get_Int_Parameter("ID"); custom = Get_Int_Parameter("Message"); - param = Get_Int_Parameter("Param"); + paramx = Get_Int_Parameter("Param"); enabled = Get_Int_Parameter("StartsEnabled") ? true : false; enableCustom = Get_Int_Parameter("EnableCustom"); Commands->Start_Timer(obj,this,rate,1); @@ -8594,7 +8628,7 @@ { GameObject *object = !id ? obj : Commands->Find_Object(id); if (object) - Commands->Send_Custom_Event(obj,object,custom,param,0); + Commands->Send_Custom_Event(obj,object,custom,paramx,0); if (!repeat) { Destroy_Script(); @@ -8613,7 +8647,7 @@ repeat = Get_Int_Parameter("Repeat") ? true : false; id = Get_Int_Parameter("ID"); custom = Get_Int_Parameter("Message"); - param = Get_Int_Parameter("Param"); + paramx = Get_Int_Parameter("Param"); enabled = Get_Int_Parameter("StartsEnabled") ? true : false; enableCustom = Get_Int_Parameter("EnableCustom"); Commands->Start_Timer(obj,this,rate,1); @@ -8640,7 +8674,7 @@ { GameObject *object = !id ? obj : Commands->Find_Object(id); if (object) - Commands->Send_Custom_Event(obj,object,custom,param,0); + Commands->Send_Custom_Event(obj,object,custom,paramx,0); if (!repeat) { Destroy_Script(); @@ -8666,7 +8700,7 @@ repeat = Get_Int_Parameter("Repeat") ? true : false; id = Get_Int_Parameter("ID"); custom = Get_Int_Parameter("Message"); - param = Get_Int_Parameter("Param"); + paramx = Get_Int_Parameter("Param"); enabled = Get_Int_Parameter("StartsEnabled") ? true : false; enableCustom = Get_Int_Parameter("EnableCustom"); Commands->Start_Timer(obj,this,rate,1); @@ -8722,7 +8756,7 @@ { GameObject *object = !id ? obj : Commands->Find_Object(id); if (object) - Commands->Send_Custom_Event(obj,object,custom,param == -1 ? paramOverride : param,0); + Commands->Send_Custom_Event(obj,object,custom,paramx == -1 ? paramOverride : paramx,0); if (!repeat) Destroy_Script(); } @@ -9700,7 +9734,7 @@ presetId = Get_Int_Parameter("Preset_ID"); id = Get_Int_Parameter("ID"); custom = Get_Int_Parameter("Message"); - param = Get_Int_Parameter("Param"); + paramx = Get_Int_Parameter("Param"); delay = Get_Float_Parameter("Delay"); rate = Get_Float_Parameter("Rate"); minPlayers = Get_Int_Parameter("Min_Player_Count"); @@ -9726,7 +9760,7 @@ { GameObject *object = !id ? obj : Commands->Find_Object(id); if (object) - Commands->Send_Custom_Event(obj,object,custom,param,delay); + Commands->Send_Custom_Event(obj,object,custom,paramx,delay); if (!repeat) { Destroy_Script(); @@ -10413,7 +10447,7 @@ ScriptRegistrant JMG_Utility_Lock_Weapon_Selection_While_Script_Attached_Registrant("JMG_Utility_Lock_Weapon_Selection_While_Script_Attached","WeaponPreset:string"); ScriptRegistrant JMG_Utility_Swimming_zDefault_Map_Fog_Values_Registrant("JMG_Utility_Swimming_zDefault_Map_Fog_Values",""); ScriptRegistrant JMG_Utility_Swim_While_In_Zone_Registrant("JMG_Utility_Swimming_Zone","WaterColor[R|G|B]=0.28 0.43 0.55:vector3,WaterOpacity=0.5:float,WaterMinViewDistance=5.0:float,WaterMaxViewDistance=15.0:float,SwimmingSpeedMultiplier=0.75:float"); -ScriptRegistrant JMG_Utility_Swimming_Infantry_Registrant("JMG_Utility_Swimming_Infantry","WeaponPreset=Weapon_Swimming_Animations:string,DrownTime=10.0:float,StarDrownSequence=3.0:float,GaspForBreath=SFX.SwimmingGaspForBreath:string,PantingSoundEmitterModel=s_panting:string,HeartBeatSoundEmitterModel=s_heartBeat:string,DrownDamageRate=2.5:float,CatchBreathRate=0.33:float,WaterDamageAmount=0.0:float,WaterDamageWarhead=None:string,EnterWaterMessageStringId=0:int,WaterEnterMessageColor[R|G|B]=0.25 0.25 1.0:vector3"); +ScriptRegistrant JMG_Utility_Swimming_Infantry_Registrant("JMG_Utility_Swimming_Infantry","WeaponPreset=Weapon_Swimming_Animations:string,DrownTime=10.0:float,StarDrownSequence=3.0:float,GaspForBreath=SFX.SwimmingGaspForBreath:string,PantingSoundEmitterModel=s_panting:string,HeartBeatSoundEmitterModel=s_heartBeat:string,DrownDamageRate=2.5:float,CatchBreathRate=0.33:float,WaterDamageAmount=0.0:float,WaterDamageWarhead=None:string,EnterWaterMessageStringId=0:int,WaterEnterMessageColor[R|G|B]=0.25 0.25 1.0:vector3,WaterDamageDelayTime=0:int,WaterDamageDelayTimeRecover=0:int,SwimmingSkin:string,SwimmingArmor:string,SwimmingModel:string"); ScriptRegistrant JMG_Utility_Zone_Enable_Spawners_In_Range_Registrant("JMG_Utility_Zone_Enable_Spawners_In_Range","StartID:int,EndID:int,PlayerType=2:int,Enable=1:int,TriggerOnce=1:int"); ScriptRegistrant JMG_Utility_Display_Message_On_Vehicle_Enter_Registrant("JMG_Utility_Display_Message_On_Vehicle_Enter","StringId:int,MessageOverride=null:string,Color[R|G|B]=0.0 1.0 0.0:vector3,DriverOnly=1:int,ShowOnce=1:int,PlayerType=2:int"); ScriptRegistrant JMG_Utility_Zone_Apply_Damage_On_Enter_Registrant("JMG_Utility_Zone_Apply_Damage_On_Enter","ID:int,DamageAmount:float,Warhead=None:string,DamageOccupants=1:int,PlayerType=2:int,OnlyOnce=0:int"); @@ -10628,7 +10662,7 @@ ScriptRegistrant JMG_Utility_AI_Skittish_Herd_Animal_Ignore_Registrant("JMG_Utility_AI_Skittish_Herd_Animal_Ignore",""); ScriptRegistrant JMG_Utility_AI_Skittish_Herd_Animal_Controller_Registrant("JMG_Utility_AI_Skittish_Herd_Animal_Controller",""); ScriptRegistrant JMG_Utility_Custom_Display_Dialog_Box_Registrant("JMG_Utility_Custom_Display_Dialog_Box","Custom:int,Message:string,Delim=@:string"); -ScriptRegistrant JMG_Utility_Custom_Send_Custom_On_Preset_Count_Registrant("JMG_Utility_Custom_Send_Custom_On_Preset_Count","Custom:int,PresetID:int,MinCount=1,MaxCount=-1,ID=0:int,SendCustom:int,Param:int,Delay=0.0:float"); -ScriptRegistrant JMG_Utility_Custom_Send_Custom_On_Script_Count_Registrant("JMG_Utility_Custom_Send_Custom_On_Script_Count","Custom:int,Script:string,MinCount=1,MaxCount=-1,ID=0:int,SendCustom:int,Param:int,Delay=0.0:float"); +ScriptRegistrant JMG_Utility_Custom_Send_Custom_On_Preset_Count_Registrant("JMG_Utility_Custom_Send_Custom_On_Preset_Count","Custom:int,PresetID:int,MinCount=1,MaxCount=-1:int,ID=0:int,SendCustom:int,Param:int,Delay=0.0:float"); +ScriptRegistrant JMG_Utility_Custom_Send_Custom_On_Script_Count_Registrant("JMG_Utility_Custom_Send_Custom_On_Script_Count","Custom:int,Script:string,MinCount=1,MaxCount=-1:int,ID=0:int,SendCustom:int,Param:int,Delay=0.0:float"); ScriptRegistrant JMG_Utility_Poke_Send_Custom_From_Poker_Registrant("JMG_Utility_Poke_Send_Custom_From_Poker","ID=0:int,Custom=0:int,Param=0:int,Delay=0.0:float,TriggerOnce=1:int,PlayerType=2:int"); ScriptRegistrant JMG_Utility_Custom_Grant_Scaled_Score_Registrant("JMG_Utility_Custom_Grant_Scaled_Score","GrantCustom:int,Score:float,ScoreMultiplier:float,EntireTeam=0:int,MaxPlayerCount=-1:int,Repeat=1:int,GrantToSender=0:int,UpdateScaleCustom=0:int,StopUpdateCustom=0:int"); diff -uwrN sourceold/scripts/jmgUtility.h source/scripts/jmgUtility.h --- sourceold/scripts/jmgUtility.h 2018-11-11 08:30:08.537600000 +1000 +++ source/scripts/jmgUtility.h 2018-11-17 10:23:57.241600000 +1000 @@ -2056,6 +2056,11 @@ * \WaterDamageWarhead - Warhead to use when in the water, default is None * \EnterWaterMessageStringId - ID of the string in strings.tbl to display when a player enters the water, the message only displays once every 10 seconds * \WaterEnterMessageColor[R|G|B] - Color of the hud message when entering the water, 0.0-1.0 RGB +* \WaterDamageDelayTime - Amount of time in tenths of a second before the infantry will start taking damage +* \WaterDamageDelayTimeRecover - Amount of time that is recovered while out of the water (added 10 times a second) +* \SwimmingSkin - Skin to use while swimming, blank means ignore +* \SwimmingArmor - Armor to use while swimming, blank means ignore +* \SwimmingModel - Model to use while swimming, blank means ignore * \author jgray * \ingroup JmgUtility */ @@ -2071,6 +2076,12 @@ int lastWaterZoneId; time_t lastDisplayTime; float defaultSpeed; + int waterDamageDelayTime; + int waterDamageDelayTimeRecover; + int remainingWaterDamageDelay; + char originalSkin[128]; + char originalArmor[128]; + char originalModel[128]; void Created(GameObject *obj); void Timer_Expired(GameObject *obj,int number); void Custom(GameObject *obj,int message,int param,GameObject *sender); @@ -5561,7 +5572,7 @@ float speed; int id; int custom; - int param; + int paramx; bool repeat; float rate; bool enabled; @@ -5588,7 +5599,7 @@ float speed; int id; int custom; - int param; + int paramx; bool repeat; float rate; bool enabled; @@ -5621,7 +5632,7 @@ Vector3 velocityRUD; int id; int custom; - int param; + int paramx; bool repeat; float rate; bool enabled; @@ -6294,7 +6305,7 @@ int presetId; int id; int custom; - int param; + int paramx; float delay; float rate; int minPlayers;