From bc213ba70fd013f4af90205f2f0282d5c4cf2b70 Mon Sep 17 00:00:00 2001 From: inkoalawetrust <56005600+inkoalawetrust@users.noreply.github.com> Date: Thu, 16 Jun 2022 03:51:02 +0300 Subject: [PATCH] Redid user variable handling and removed User_RandomPersonality. - Changed the way defaults are given to user variables to just use the //$UserVariableDefault key, I was aware of this key, but it was buggy and broken. And was only fixed exactly after I finished the prior update. - Removed the User_RandomPersonality user variable. --- Document.txt | 5 ----- Marine_UserVariables.zsc | 36 ++++++++---------------------------- ZScript.zsc | 3 --- 3 files changed, 8 insertions(+), 36 deletions(-) diff --git a/Document.txt b/Document.txt index bdba9c2..a5ff2fe 100644 --- a/Document.txt +++ b/Document.txt @@ -49,7 +49,6 @@ The editor name of their No Crouch Zone map spots (More info below) is "No Crouc - Random (Randomly pick a color.) - Default (Use the default shade of green. Similar to just leaving User_Color empty.) - Most of the marines' behaviour can be configured on a per actor basis using user variables. -- Can have a randomized personality, that gives the marine a random armor color, different attention spans and chances to throw a grenade etc. Adding a custom value to a user variable prevents it from being randomized. - They also have a rifle that they sometimes drop, which you can pick up and use yourself. - The rifle fires at full auto, and needs reloading after firing 20 rounds, just like when the marines use them. You can reload before the magazine fully runs out too. - It also features animated digital sights complete with an animation for looking in and out of them, using the sights increases your accuracy as well. @@ -218,10 +217,6 @@ User_FearDistance: The distance that the marine runs away to, if his target is s - Default is 2048 map units, a value of 0 or less makes them fearless. (Within reason, so they still avoid grenades for example.) User_Color: Can be used to give the marines different armor colors. - Default is no translation, the available colors are Default, Gray, Red, White, Black, Blue, Yellow, Orange, Pink, Dark Green, Dark Red, and Random, which randomly picks any of the afformentioned colors. -User_RandomPersonality: When on, it randomizes several user variables that could be considered aspects of the marines' personality, such as: -- User_SearchTime, User_GrenadeThreshold, User_TurretThreshold, User_RetreatAttempts, User_FearDistance, and User_Color. -- If any of those variables have any values besides their defaults, then they won't be randomized, so you can still for example have marines with random grenade and turret thresholds, but the same melee chance. -- The variable can be set to true again in-game using SetUserVariable() in ACS, allowing you to randomize a marines' personality mid-game, if you want to do that for some reason. STATIONARY TURRET MARINE VARIABLES: - User_RunFromGrenades: When turned on, the stationary marine will leave his turret to run from any grenades about to explode, like the marines normally do. diff --git a/Marine_UserVariables.zsc b/Marine_UserVariables.zsc index 77b6d20..fc67997 100644 --- a/Marine_UserVariables.zsc +++ b/Marine_UserVariables.zsc @@ -18,45 +18,25 @@ Extend Class SmartMarine A_SetTranslation (String.Format("Marine_%s", User_Color)); } - Void SetUserVariableDefaults() - { - //The //$UserDefaultValue editor key is buggy, so this code still needs to be used. - If (User_SearchTime == 0) User_SearchTime = 500; //The amount of time the marine tries to chase it's target, after it has died or gone out of sight. - If (User_GrenadeThreshold == 0) User_GrenadeThreshold = 240; //Default threshold that needs to be reached or surpassed, for the marine to throw a grenade. - If (User_RetreatAttempts == 0) User_RetreatAttempts = 10; //Default amount of attempts the marine makes to run for cover to reload. - If (User_AlertRange == 0) User_AlertRange = 384; //Default range in which marines alert each other of enemies. - If (User_EnemyAlertHearingRange == 0) User_EnemyAlertHearingRange = 1024; //Default range in which marines can hear the alerts of enemy marines. - If (User_DodgeRange == 0) User_DodgeRange = 384; //Default range in which marines dodge projectiles. - If (User_TurretThreshold == 0) User_TurretThreshold = 100; //Default chance for the marine to use a turret. - If (User_FearDistance == 0) User_FearDistance = 2048; //The default distance the marines keeps from powerful enemies. - } - - Void HandleRandomPersonalityMidGame() - { - If (User_RandomPersonality) - { - If (!User_SearchTime) User_SearchTime = 500*FRandom (-0.6,3.0); - If (!User_GrenadeThreshold) User_GrenadeThreshold = 240*FRandom (-0.75,2.0); - If (!User_RetreatAttempts) User_RetreatAttempts = Random (7,15); - If (!User_FearDistance) User_FearDistance = 2048*FRandom (0.75,2.0); - If (!User_TurretThreshold) User_TurretThreshold = 100*Frandom (0.5,1.5); - If (!User_Color || User_Color ~== "") User_Color = "Random"; - User_RandomPersonality = False; - } - } - + //$UserDefaultValue 500 Int User_SearchTime; + //$UserDefaultValue 240 Int User_GrenadeThreshold; + //$UserDefaultValue 10 Int User_RetreatAttempts; + //$UserDefaultValue 100 Int User_TurretThreshold; + //$UserDefaultValue 384 Double User_AlertRange; + //$UserDefaultValue 1024 Double User_EnemyAlertHearingRange; + //$UserDefaultValue 2048 Double User_FearDistance; + //$UserDefaultValue 384 Double User_DodgeRange; Bool User_DisobeyCommands; Bool User_NoReload; Bool User_NoCover; - Bool User_RandomPersonality; Bool User_NoRifleDrop; String User_Color; String User_SquadName; diff --git a/ZScript.zsc b/ZScript.zsc index 89df474..3f4c839 100644 --- a/ZScript.zsc +++ b/ZScript.zsc @@ -68,8 +68,6 @@ Class SmartMarine : Actor Super.PostBeginPlay(); InitializeSquad(); - SetUserVariableDefaults(); - HandleRandomPersonalityMidGame(); HandleMarineColoring(); } @@ -94,7 +92,6 @@ Class SmartMarine : Actor //Once the dodge delay is over, remove the point to the previous projectile. If (!DodgeDelay && PreviousProjectile) PreviousProjectile = Null; - HandleRandomPersonalityMidGame(); //Allows switching on User_RandomPersonality mid-game, to randomize the marine in-game... if you want that for some reason. If (!bFriendly) Species = "HostileSmartMarine"; Else