Skip to content

Commit

Permalink
Redid user variable handling and removed User_RandomPersonality.
Browse files Browse the repository at this point in the history
- 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.
  • Loading branch information
inkoalawetrust committed Jun 16, 2022
1 parent 407a70d commit bc213ba
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 36 deletions.
5 changes: 0 additions & 5 deletions Document.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand Down
36 changes: 8 additions & 28 deletions Marine_UserVariables.zsc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
3 changes: 0 additions & 3 deletions ZScript.zsc
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,6 @@ Class SmartMarine : Actor
Super.PostBeginPlay();

InitializeSquad();
SetUserVariableDefaults();
HandleRandomPersonalityMidGame();
HandleMarineColoring();
}

Expand All @@ -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
Expand Down

0 comments on commit bc213ba

Please sign in to comment.