Skip to content

Commit

Permalink
Merge pull request #2 from David-Lor/develop
Browse files Browse the repository at this point in the history
1.1.1
  • Loading branch information
David-Lor authored Jul 7, 2020
2 parents dd15190 + 81d1ea2 commit b229351
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,12 @@ _All lists of items (models & weapons) are separated by comma (`,`) or semi-colo
- `offensive`: focus on attacking the enemy team
- `suicidal`: more aggresive attack
- _stationary & suicidal seem to take no effect, so is better to stick to just **defensive** and **offensive**_
- `MaxPeds`: maximum alive peds on the team (if not specified, the MaxPedsPerTeam setting will be used)

## SETTINGS

- `Hotkey`: the single hotkey used on the script ([Reference](https://docs.microsoft.com/en-us/dotnet/api/system.windows.input.key?view=netcore-3.1#fields))
- `MaxPedsPerTeam`: maximum alive peds on each team (true/false)
- `MaxPedsPerTeam`: maximum alive peds on each team - teams with the setting MaxPeds will ignore this option
- `NoWantedLevel`: if true, disable wanted level during the battle (true/false)
- `ShowBlipsOnPeds`: if true, each spawned ped will have a blip on the map (true/false)
- `DropWeaponOnDead`: if false, dead peds won't drop their weapons - they will remain stick to their bodies (true/false)
Expand All @@ -66,6 +67,7 @@ _All lists of items (models & weapons) are separated by comma (`,`) or semi-colo

## Changelog

- 1.1.1 - Options to set ped limit per team
- 1.0.1
- Support settings through .ini file
- Change if-else to switch in OnKeyUp
Expand Down
8 changes: 7 additions & 1 deletion SimpleGangWar.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ public class SimpleGangWar : Script {
private static bool runToSpawnpoint = true;
private static int idleInterval = 500;
private static int battleInterval = 100;
private static int maxPedsAllies;
private static int maxPedsEnemies;

// From here, internal script variables - do not change!

Expand Down Expand Up @@ -121,6 +123,9 @@ public SimpleGangWar() {
idleInterval = config.GetValue<int>(SettingsHeader.General, "IdleInterval", idleInterval);
battleInterval = config.GetValue<int>(SettingsHeader.General, "BattleInterval", battleInterval);

maxPedsAllies = config.GetValue<int>(SettingsHeader.Allies, "MaxPeds", maxPedsPerTeam);
maxPedsEnemies = config.GetValue<int>(SettingsHeader.Enemies, "MaxPeds", maxPedsPerTeam);

relationshipGroupAllies = World.AddRelationshipGroup("simplegangwar_allies");
relationshipGroupEnemies = World.AddRelationshipGroup("simplegangwar_enemies");
int relationshipGroupPlayer = Game.Player.Character.RelationshipGroup;
Expand Down Expand Up @@ -190,8 +195,9 @@ private void SetupBattle() {

private void SpawnPeds(bool alliedTeam) {
List<Ped> spawnedPedsList = alliedTeam ? spawnedAllies : spawnedEnemies;
int maxPeds = alliedTeam ? maxPedsAllies : maxPedsEnemies;

while (spawnedPedsList.Count < maxPedsPerTeam) {
while (spawnedPedsList.Count < maxPeds) {
SpawnRandomPed(alliedTeam);
}
}
Expand Down

0 comments on commit b229351

Please sign in to comment.