Log in to reply
 

[SCRIPT] [WIP] - Lively World



  • Quick question, I'm working on using the injector to add custom and add on police vehicles to the game, but I'm wondering what the full list of locations is. Thanks a bunch to anyone who can help! (ex: Airp, Armyb, desrt, lago, etc)



  • I recompiled your source on Github with some additional debug info for the BarnFind event and the crash occurred at the call of ApplyDamage().

    04/28/2018 12:14:25 - Checking for wrecks
    04/28/2018 12:14:26 - Rendering Ardent as wrecked
    04/28/2018 12:14:26 - Making vehicle random matte color
    04/28/2018 12:14:26 - Applying parameters
    04/28/2018 12:14:26 - Damaging vehicle
    [EOF]

    void Barn(Vehicle v)
    {
        if (CanWeUse(v))
        {
            File.AppendAllText(@"scripts\LivelyWorldDebug.txt", "\n" + DateTime.Now + " - Rendering " + v.FriendlyName + " as wrecked");
            if (MatteColor.Count == 0)
            {
                foreach (VehicleColor color in Enum.GetValues(typeof(VehicleColor)))
                {
                    if (color.ToString().ToLowerInvariant().Contains("matte") || color.ToString().ToLowerInvariant().Contains("worn")) MatteColor.Add(color);
                }
            }
    
            if (MatteColor.Count > 0)
            {
                File.AppendAllText(@"scripts\LivelyWorldDebug.txt", "\n" + DateTime.Now + " - Making vehicle random matte color");
                VehicleColor color = MatteColor[RandomInt(0, MatteColor.Count - 1)];
                v.PrimaryColor = color;
                v.SecondaryColor = color;
            }
            else
            {
                File.AppendAllText(@"scripts\LivelyWorldDebug.txt", "\n" + DateTime.Now + " - Making vehicle matte black");
                v.PrimaryColor = VehicleColor.MatteBlack;
                v.SecondaryColor = VehicleColor.MatteBlack;
    
            }
    
            File.AppendAllText(@"scripts\LivelyWorldDebug.txt", "\n" + DateTime.Now + " - Applying parameters");
    
            v.IsDriveable = false;
            v.PearlescentColor = VehicleColor.MatteBlack;
            v.EngineCanDegrade = true;
            v.EngineHealth = 500;
            v.EngineRunning = false;
    
            File.AppendAllText(@"scripts\LivelyWorldDebug.txt", "\n" + DateTime.Now + " - Damaging vehicle");
            v.ApplyDamage(v.Position + Vector3.WorldDown, 20f, 10);
    
            File.AppendAllText(@"scripts\LivelyWorldDebug.txt", "\n" + DateTime.Now + " - Calling native scorch rendering");
            Function.Call(Hash.SET_ENTITY_RENDER_SCORCHED, v, true);
            //Function.Call(Hash.SET_VEHICLE_DOOR_BROKEN, v, 4, true);
    
            File.AppendAllText(@"scripts\LivelyWorldDebug.txt", "\n" + DateTime.Now + " - Breaking doors");
            for (int i = -2; i < 10; i++)
            {
                File.AppendAllText(@"scripts\LivelyWorldDebug.txt", "\n" + DateTime.Now + " - - Broke door #" + i.ToString());
                Function.Call(Hash.SET_VEHICLE_DOOR_BROKEN, v, i, true); //if (i != 1)
            }
            int tire = RandomInt(0, 4);
            File.AppendAllText(@"scripts\LivelyWorldDebug.txt", "\n" + DateTime.Now + " - Bursting tire #" + tire.ToString());
            if (RandomInt(0, 10) >= 5) Function.Call(Hash.SET_VEHICLE_TYRE_BURST, v, tire, true, 1000);
            else Function.Call(Hash.SET_VEHICLE_TYRE_BURST, v, tire, false, 300);
            File.AppendAllText(@"scripts\LivelyWorldDebug.txt", "\n" + DateTime.Now + " - Blacklisting vehicle from further random events");
            BlacklistedVehicles.Add(v);
            File.AppendAllText(@"scripts\LivelyWorldDebug.txt", "\n" + DateTime.Now + " - Setting decorator");
            SetDecorBool("IsAWreck", v, true);
        }
    }
    

    With ApplyDamage compiled out, zero issues so far!



  • @Eddlm Absolutely loving the newer versions. I had been running on the old 0.4 version for ages and the new stuff really is phenomenal. Keep up the great work! =)

    After still more spawned planes exploding along Great Ocean Highway, I've been thinking of another tweak for the spawner for air traffic: using the ground height at coords native to check the position 100 metres in front of the current position, and then aborting the spawn (or changing altitude or trying another angle offset from the player?) if the target position is at higher altitude than the aircraft's spawned altitude plus 10 metres or so, or even just the same altitude. That rise-over-run is a bit too steep for most aircraft, except for fighter jets, regardless of forward airspeed. This could reduce aircraft smashing into terrain a great deal. =)

    As a refinement of my previous suggestion, an actual airspeed attribute for the air spawner would also go a long way to making the aircraft less explodey.

    One other suggestion: with the latest VanillaWorks Extended, a lot of vanilla vehicles are now replaced with liveried vehicles. This is good and bad: good in that those vehicles now show up in traffic for moar imershun, but bad in that anything that wants to use one of those vehicles for a special purpose will now generate with randomly spawned liveries. It's subtly strange when a wreck spawns with a commercial decal, since for any wrecked commercial vehicle dumped into a canal the company would simply be charged for its recovery -- whereas a wrecked unmarked vehicle would be left to rot until they could figure out what to do with it.

    Might it be possible to include a new XML attribute for the spawner like livery="false" that automatically sets their livery to 0 after the wreck system spawns them in? If the attribute is absent, it doesn't touch the setting; if present and false, it attempts to set the livery to 0 always; if present and true, it re-randomises the livery to ensure variety.

    [edit] Ooh, right, one more for good measure. Is there any way that the system could be possible of adding a chance modifier to each of the scenarios and events? I notice a ton of car thieves spawning at night, for instance, and would love to bump that down a little to taste.

    I don't want to step on your toes so I haven't tried hacking any of these in myself. =)

    To save you the effort of finding them, my wishlist thus far is:

    • Add option to remove calls to ApplyDamage in wreck find scenario, since it crashes for some users (my suspected culprit is increased-deformation handling data)
    • Prohibit all emergency vehicles (Vehicle.HasSiren) from spawning with bicycles as it looks incorrect at best and silly at worst ;-)
    • Increase aircraft spawn velocity to 60 m/s if Vehicle.Model.IsPlane, to prevent stalls of newly spawned aircraft
    • Attribute in spawner that specifies desired airspeed of a spawned aircraft, falling back to default 30 m/s (helicopters) or 60 m/s (jets/planes) if not present
    • Add props under wheels of stripped cars for greater immersion
    • Abort spawn/alter direction of spawn/spawn at very high altitude if aircraft would have to climb to avoid collision with terrain shortly after spawning; single altitude check of terrain ahead of aircraft would be sufficient for most scenarios
    • Attribute in spawner that removes or forces vehicle liveries if present, ignores if absent
    • Chance modifiers for specific scenarios to spawn without disabling them entirely


  • I didn’t understand how to add events to blacklist in xml if I want to disable them.
    Can anyone explain or show an example please


Log in to reply
 

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