diff --git a/Document.txt b/Document.txt index c51509e..9db966f 100644 --- a/Document.txt +++ b/Document.txt @@ -220,6 +220,9 @@ 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_DefaultOrder: Specifies if the marine should follow the player or wander around by default. +- By default, the marine looks for any friendly players in its' line of sight, if there are none, he will wonder by default, if there is one, he will follow them by default. +- The other two options are "follow" and "wander", which are fairly self explanatory. 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. diff --git a/MarineFunctions.zsc b/MarineFunctions.zsc index 0a1a85c..0986168 100644 --- a/MarineFunctions.zsc +++ b/MarineFunctions.zsc @@ -338,7 +338,7 @@ Mixin Class MarineFunctions XY_Spread = Angle + BulletSpreadXY; - Actor Puff = LineAttack (XY_Spread,8192,SlopeBullshit,Random (6,10),"HitScan","SmartMarinePuff",LAF_OVERRIDEZ,offsetz:SpawnHeight,0,-6); + Actor Puff = LineAttack (XY_Spread,8192,SlopeBullshit,Random[GunShot] (6,10),"HitScan","SmartMarinePuff",LAF_OVERRIDEZ,offsetz:SpawnHeight,0,-6); //Bullet impact splash handling. //The splashes only work with solid surfaces because I tried getting them to work with swimmable 3D floors for 2 days straight to no avail. diff --git a/Marine_UserVariables.zsc b/Marine_UserVariables.zsc index 0f363bd..1480deb 100644 --- a/Marine_UserVariables.zsc +++ b/Marine_UserVariables.zsc @@ -29,6 +29,45 @@ Extend Class SmartMarine 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. + + If (!bFriendly) Return; //The rest is only relevant to player allies. + + Array VisibleFriends; + //Friendly marine with no default order specified. + If (!User_DefaultOrder || User_DefaultOrder ~== "") + { + //This tries to pick a random visible player for the marine to follow, if no friendly players are in sight, the marine will wander instead. + //Find all visible players friendly to you. + For (Int I = 0; I < MAXPLAYERS; I++) + { + If (!PlayerInGame[I]) Continue; + + If (IsFriend (Players[I].Mo) && CheckSight (Players[I].Mo, SF_IGNOREVISIBILITY|SF_IGNOREWATERBOUNDARY)) + VisibleFriends.Push (Players[I].Mo); + } + + //Found at least one visible friendly player to follow. + If (VisibleFriends.Size() - 1 >= 0) + {a_log ("friend found"); + SetFriendPlayer (VisibleFriends[Random (0, VisibleFriends.Size() - 1)].Player); //Randomly pick a visible friend to follow. + CurrentMarineOrder = ORDER_FOLLOW; + } + //No friendplayer, or they are out of sight + Else If (!FriendPlayer || FriendPlayer && !CheckSight (Players[FriendPlayer].Mo, SF_IGNOREVISIBILITY|SF_IGNOREWATERBOUNDARY)) + {if (!FriendPlayer) a_log ("no friend in sight"); + CurrentMarineOrder = ORDER_WANDER; + bDontFollowPlayers = True; + } + } + Else If (User_DefaultOrder ~== "Follow") + { + CurrentMarineOrder = ORDER_FOLLOW; + } + Else If (User_DefaultOrder ~== "Wander") + { + CurrentMarineOrder = ORDER_WANDER; + bDontFollowPlayers = True; + } } Void HandleRandomPersonalityMidGame() @@ -61,4 +100,5 @@ Extend Class SmartMarine String User_Color; String User_SquadName; Bool User_Leader; + String User_DefaultOrder; } \ No newline at end of file diff --git a/Sprites/Lying down/MARDA1.png b/Sprites/Lying down/MAR3A1.png similarity index 100% rename from Sprites/Lying down/MARDA1.png rename to Sprites/Lying down/MAR3A1.png diff --git a/Sprites/Lying down/MARDA2A8.png b/Sprites/Lying down/MAR3A2A8.png similarity index 100% rename from Sprites/Lying down/MARDA2A8.png rename to Sprites/Lying down/MAR3A2A8.png diff --git a/Sprites/Lying down/MARDA3A7.png b/Sprites/Lying down/MAR3A3A7.png similarity index 100% rename from Sprites/Lying down/MARDA3A7.png rename to Sprites/Lying down/MAR3A3A7.png diff --git a/Sprites/Lying down/MARDA4A6.png b/Sprites/Lying down/MAR3A4A6.png similarity index 100% rename from Sprites/Lying down/MARDA4A6.png rename to Sprites/Lying down/MAR3A4A6.png diff --git a/Sprites/Lying down/MARDA5.png b/Sprites/Lying down/MAR3A5.png similarity index 100% rename from Sprites/Lying down/MARDA5.png rename to Sprites/Lying down/MAR3A5.png diff --git a/Sprites/Lying down/MARDB1.png b/Sprites/Lying down/MAR3B1.png similarity index 100% rename from Sprites/Lying down/MARDB1.png rename to Sprites/Lying down/MAR3B1.png diff --git a/Sprites/Lying down/MARDB2B8.png b/Sprites/Lying down/MAR3B2B8.png similarity index 100% rename from Sprites/Lying down/MARDB2B8.png rename to Sprites/Lying down/MAR3B2B8.png diff --git a/Sprites/Lying down/MARDB3B7.png b/Sprites/Lying down/MAR3B3B7.png similarity index 100% rename from Sprites/Lying down/MARDB3B7.png rename to Sprites/Lying down/MAR3B3B7.png diff --git a/Sprites/Lying down/MARDB4B6.png b/Sprites/Lying down/MAR3B4B6.png similarity index 100% rename from Sprites/Lying down/MARDB4B6.png rename to Sprites/Lying down/MAR3B4B6.png diff --git a/Sprites/Lying down/MARDB5.png b/Sprites/Lying down/MAR3B5.png similarity index 100% rename from Sprites/Lying down/MARDB5.png rename to Sprites/Lying down/MAR3B5.png diff --git a/ZScript.zsc b/ZScript.zsc index 20fa410..0b7ec47 100644 --- a/ZScript.zsc +++ b/ZScript.zsc @@ -24,7 +24,7 @@ Class SmartMarine : Actor //$Title AI Marine //$Category Marines //$Sprite MARIC1 - Health 120; + Health 100; GibHealth 20; Height 56; DeathHeight 12; @@ -66,6 +66,7 @@ Class SmartMarine : Actor { Super.PostBeginPlay(); + GiveInventory ("GreenArmor",1); //Yep, the marines wear actual armor. InitializeSquad(); SetUserVariableDefaults(); HandleRandomPersonalityMidGame(); @@ -434,9 +435,8 @@ Class SmartMarine : Actor { //Uses the same RNG as A_Jump's random jump chance, but also only jumps if the marine has no goal. And is ordered to wander around aimlessly. If (CurrentMarineOrder == ORDER_WANDER && !Goal && Random[pr_cajump](0,256) < 12) - { Return ResolveState ("StandStill"); - } + Return State (Null); } Loop; @@ -816,15 +816,15 @@ Class SmartMarine : Actor TNT1 A 0 A_JumpIf (SM_ShouldDodgeProjectile(User_DodgeRange),"Evade"); MARM A 3; TNT1 A 0 A_JumpIf (CountInv("PowerStrength") > 0,3); - MARM B 8 A_CustomMeleeAttack (Random(4,8),"Marine/Melee","Marine/MeleeMiss",'Melee',False); //Blunt force attack, so no blood. + MARM B 8 A_CustomMeleeAttack (Random[Punch](4,8),"Marine/Melee","Marine/MeleeMiss",'Melee',False); //Blunt force attack, so no blood. MARM A 0 A_Jump (96,"ChangePosition"); //If you are in melee range of your enemy, you are probably fucked. Goto See; - MARM B 6 A_CustomMeleeAttack (Random(16,32),"Marine/PowerMelee","Marine/MeleeMiss",'Melee'); //Powerful blunt force attack, so YES blood. + MARM B 6 A_CustomMeleeAttack (Random[Punch](40,80),"Marine/PowerMelee","Marine/MeleeMiss",'Melee'); //Powerful blunt force attack, so YES blood. MARM A 0 A_Jump (96/2,"ChangePosition"); //If you are in melee range of your enemy with a berserk pack, you are probably not THAT fucked. Goto See; RifleBurst: - MARD AB 0 {LieDown = (!Crouching && Random[pr_cajump](0,255) < 32);} //Small chance for the marine to shoot lying down. If not already behind cover. Or in the air. + MAR3 AB 0 {LieDown = (!Crouching && Random[pr_cajump](0,255) < 32);} //Small chance for the marine to shoot lying down. If not already behind cover. Or in the air. MAR2 A 0 //Run out of sight of the target to reload. { If (AmmoUsed > 19) @@ -840,7 +840,7 @@ Class SmartMarine : Actor If (LieDown) { Height = 16; - Sprite = GetSpriteIndex ("MARD"); + Sprite = GetSpriteIndex ("MAR3"); } } MAR2 A 0 //The bullet spread is determined before the shot, so that it can be checked by SM_CantHitTarget(), so the marines won't even shoot their allies by accident. @@ -880,7 +880,7 @@ Class SmartMarine : Actor { SM_MarineBulletAttack(8); //Shoot down lower than normal, since you are lying down. Height = 16; - Sprite = GetSpriteIndex ("MARD"); + Sprite = GetSpriteIndex ("MAR3"); Frame = 1; } Else @@ -914,7 +914,7 @@ Class SmartMarine : Actor If (LieDown) { Height = 16; - Sprite = GetSpriteIndex ("MARD"); + Sprite = GetSpriteIndex ("MAR3"); } If (Random[pr_monsterrefire](0,255) < 96)