Log in to reply
 

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=UnholyHellbringer

    with 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.


Log in to reply
 

Looks like your connection to GTA5-Mods.com Forums was lost, please wait while we try to reconnect.