Log in to reply
 

How to, Spawn Fully upgraded kit Vehicles?





  • @FoxtrotDelta I don't know if this is similar or relevant to what you are asking about but I'll post it anyway, just in case.

    As you know, I have the photo mod that I use for my screenshots. So tonight I was thinking that it would be great if I could spawn the cars with random selections of their tuning parts visible in the photos.

    When I first spawned the car (it was a Supra with 10 spoilers), the game said it had 0 spoilers, until I got into the car. That made me remember something that @sjaak327 said in the modkit tuning thread the other day about him setting the ModKitID to 0 when you got into the car, to force the game to give it a valid ModKit ID.

    So I set my test mod to spawn the car and then set the ModKit ID to 0. Suddenly, the game reported that the vehicle had 10 spoilers. By adding a small random number addition, I can now spawn the car with any of the spoilers, without having to get into the car first.

    So if that's the kind of thing you mean, yes, it seems you can but I think it has to be done by script. This is the first time I have ever looked at this, so anything I have said whilst seeming to work, could still be way off mark.

    As I say, this might have no connection to what you are discussing, I just thought it was worth mentioning.



  • @LeeC2202 yes that's what i am talking about. you got it!.



  • @FoxtrotDelta As you can see... this works just fine and dandy. 3 runs of my mod and 3 different outcomes. :slight_smile: I actually have it working on Spoilers, Front and Rear Bumpers and the Bonnet/Hood.

    0_1490840293786_spoilers.jpg



  • @LeeC2202 noice.



  • @LeeC2202 so when u spawn a car, the spoiler is there automatically right? No need of trainer or shop?

    Edit: gr8 illustration by the way. Thumbs up



  • @FoxtrotDelta Yep, it takes a very short period of time for the model to load first time, like a fraction of a second, but no trainer or shop is involved.

    I am sure anyone else that has done anything with vehicles and modkits will already know about how to do this, but this bit of code is basically what I do.

    Function.Call(Hash.SET_VEHICLE_MOD_KIT, _targetVehicle, 0);
    
    int modKitID = Function.Call<int>(Hash.GET_VEHICLE_MOD_KIT, _targetVehicle);
    
    if (modKitID > 0 && modKitID < 255)
    {
    	int Spoilers = _targetVehicle.GetModCount(VehicleMod.Spoilers);
    	if (Spoilers > 0) _targetVehicle.SetMod(VehicleMod.Spoilers, cAutoSnap.modRandomNumber.Next(Spoilers + 1), true);
    }


  • @LeeC2202 awesome simple n easy. Just need to create mod kits now. Thanks, you have been a great help



  • @LeeC2202 Is there any way to assure that certain modifications always spawn together? Like in a group? So for example if I wanted this spoiler to always spawn with that bumper it would do so?



  • @nathanjamesddg151 You could build presets, maybe a simple struct to hold groups of values. That way you would spawn the vehicle and then apply the values that were held in that struct.

    You could define those in ini files or data files per model. It would be fairly easy to do.



  • @LeeC2202 that's good to know.



  • When I opened this, I thought this thread would be on how to spawn cars with their modkits fully tuned (like max engine, max brakes, etc), rather than how to create a mesh with everything already built-in, as it were. I'd be much more interested in how to accomplish the former, tbh.



  • @FoxtrotDelta sorry mate not been on for a few days so couldn't answer, looks like Lee sorted it well tho :D



  • @meimeiriver it is about the former. But it's a request for information . not a tutorial :)


  • MODERATOR

    @LeeC2202 said in How to, Spawn Fully upgraded kit Vehicles?:
    <> it takes a very short period of time for the model to load first time, like a fraction of a second, but no trainer or shop is involved.

    Function.Call(Hash.SET_VEHICLE_MOD_KIT, _targetVehicle, 0);
    
    int modKitID = Function.Call<int>(Hash.GET_VEHICLE_MOD_KIT, _targetVehicle);
    
    if (modKitID > 0 && modKitID < 255)
    {
    	int Spoilers = _targetVehicle.GetModCount(VehicleMod.Spoilers);
    	if (Spoilers > 0) _targetVehicle.SetMod(VehicleMod.Spoilers, cAutoSnap.modRandomNumber.Next(Spoilers + 1), true);
    }
    

    Does this mean there's hope for me that there'll be a seperate script in the foreseeable future so I won't have to worry about a valid modkit_ID anymore? Pls ftloG...


Log in to reply
 

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