This is the support thread for the riot mod released at https://www.gta5-mods.com/scripts/net-riot-mod-2020
Aldebaraan
View profile on GTA5-Mods.com »
Posts made by Aldebaraan
-
[SCRIPT][RELEASED](.NET) Riot Mod (2020)
-
Ped spawn error
I'm getting a NullReferenceException at "if (ped.Exists())" line in the following script:
private Ped SpawnRandomPed(List<Ped> ListPeds, string[] ModelsList, string[] WeaponsList, int Accuracy, int Health, int BodyArmor, int RelationshipGroup) { string ModelName = RandomChoice<string>(ModelsList); string WeaponName = RandomChoice<string>(WeaponsList); PedHash pedSpawn; WeaponHash weaponGive; if (!Enum.TryParse<PedHash>(ModelName, true, out pedSpawn)) { Wait(2000); throw new FormatException("Ped name " + ModelName + " does not exist!"); } if (!Enum.TryParse<WeaponHash>(WeaponName, true, out weaponGive)) { Wait(2000); throw new FormatException("Weapon name " + WeaponName + " does not exist!"); } Vector3 PositionToUse; if (ListPeds == spawnedBodyguard) { PositionToUse = Game.Player.Character.GetOffsetInWorldCoords(new Vector3(-8, 0, 0)); } else { if (Game.Player.Character.IsInVehicle()) { PedMinSpawnDistanceReal = PedMinSpawnDistance + 60; PedMaxSpawnDistanceReal = PedMaxSpawnDistance + 60; } else { PedMinSpawnDistanceReal = PedMinSpawnDistance; PedMaxSpawnDistanceReal = PedMaxSpawnDistance; } RandomDistance = Function.Call<float>(Hash.GET_RANDOM_FLOAT_IN_RANGE, PedMinSpawnDistanceReal, PedMaxSpawnDistanceReal); PositionToUse = Game.Player.Character.Position.Around(PedMaxSpawnDistance); } Ped ped = World.CreatePed(pedSpawn, PositionToUse); WritePedDataToFile(ModelName, WeaponName, Accuracy, Health, BodyArmor, RelationshipGroup); if (ped.Exists()) { if (ListPeds == spawnedBodyguard) { Function.Call(Hash.SET_PED_AS_GROUP_MEMBER, ped, relationshipGroupPlayer); ped.RelationshipGroup = Game.Player.Character.RelationshipGroup; ped.CanBeTargetted = true; Function.Call(Hash.SET_PED_AS_GROUP_LEADER, Game.Player.Character, relationshipGroupPlayer); } else { ped.RelationshipGroup = RelationshipGroup; } } }
I don't know why this is happening. I even made a log (WritePedDataToFile) to see if there was anything wrong with the values but there is not.
-
Problem with added models
My mod has a ini where users can define the models that a ped will spawn as:
Ini:
[StormtrooperSpawnSettings]
MaxMembers=2
Accuracy=10
Health=140
BodyArmor=100
OnlyAttackPlayer=false
Models=stormtrooper
Weapons=UnholyHellbringerwith vanilla models it works fine. But in the case of addon models it throws a null exception error.
Here's the code:private Ped SpawnRandomPed(List<Ped> ListPeds, string[] ModelsList, string[] WeaponsList, int Accuracy, int Health, int BodyArmor, bool OnlyAttackPlayer, bool WillAttackSelf, int RelationshipGroup)
{
string ModelName = RandomChoice<string>(ModelsList);PedHash pedSpawn; if (!Enum.TryParse<PedHash>(ModelName, true, out pedSpawn)) { throw new FormatException("Ped name " + ModelName + " does not exist!"); } Vector3 PositionToUse; RandomDistance = Function.Call<float>(Hash.GET_RANDOM_FLOAT_IN_RANGE, PedMinSpawnDistance, PedMaxSpawnDistance); PositionToUse = Game.Player.Character.Position.Around(PedMaxSpawnDistance); Ped ped = World.CreatePed(pedSpawn, PositionToUse);
}
How can i make the game recognize the models? When i apply them to my character it works.
-
Give NOOSE and Marines helmets
I'm trying to make the Swat01SMY (NOOSE agent) and Marine03SMY (Fully equipped Marine) always wear their helmets. But when spawned the NOOSE agents never get a helmet/goggles and the marines only get the gas mask and helmet SOMETIMES. How can i do that?