Log in to reply
 

How do you give micheal a duffel bag in c# script?



  • How do you give micheal a duffel bag in c# script?



  • @M8T You spawn the duffel bag as you would any object or prop. Then you use the attach.to function. The only difficult part is getting the coordinates right.

    Would look something like this in SHVDN2, Michael and Bag being declared as varibles in this example:

    NameOfDuffelBag.AttachTo(Michael, 0, new Vector3(PedValXFloat, PedValYFloat, PedHeightFloat), new Vector3(PedValPFloat, PedValRFloat, PedValYawFloat));

    You need to identify the boneindex as well - i.e where you want the bag to go.

    Not crazy difficult but would definitely recommend you look at some tutorials or just experiment yourself first. If you want to do this as part of an animation scene, then the complexity is much greater. Personally I never watched the Youtube tutorials because all they care about are views and subscriptions - this explains why they rarely give you the code, they prefer you painfully watch their whole video rather than have the courtesy of just sharing the code from the tutorial.

    Or you could use the native function or something similar, not sure which one.:
    void ATTACH_ENTITY_TO_ENTITY(Entity entity1, Entity entity2, int boneIndex, float xPos, float yPos, float zPos, float xRot, float yRot, float zRot, BOOL p9, BOOL useSoftPinning, BOOL collision, BOOL isPed, int vertexIndex, BOOL fixedRot)



  • @JohnFromGWN But how would you specifically give it to the char as part of the clothes. Attaching the prop is a bit glitchy.



  • @M8T oh i see what you mean. The bag is part of the clothes, rather than a prop or object. Sorry about that. Yeah, that makes it super easy but the character must have the bag as part of their wardrobe, Michael for example.

    You use a native function called ped component variation. One simple way to get the values is to use Menyoo. You create an outfit including the bag and save it as an outfit xml file. Then you can get all the values for components as well as all props like hats or glasses .

    Function.Call(Hash.SET_PED_COMPONENT_VARIATION, Game.Player.Character, 9, 1, 1, 2); //
    Above, 9 is for the bag (tasks), the first 1 is for the drawable, the second 1 is for the texture (usually a colour), the last parameter is always 2. This ONLY applies to Michael, I mean the actual values and whether the bag is available or not - it won't be with addon peds.

    void SET_PED_COMPONENT_VARIATION(Ped ped, int componentId, int drawableId, int textureId, int paletteId) // 0x262B14F48D29DE80 0xD4F7B05C b323

    paletteId/palletColor - 0 to 3.
    enum PedVariationData
    {
    PED_VARIATION_FACE = 0,
    PED_VARIATION_HEAD = 1,
    PED_VARIATION_HAIR = 2,
    PED_VARIATION_TORSO = 3,
    PED_VARIATION_LEGS = 4,
    PED_VARIATION_HANDS = 5,
    PED_VARIATION_FEET = 6,
    PED_VARIATION_EYES = 7,
    PED_VARIATION_ACCESSORIES = 8,
    PED_VARIATION_TASKS = 9,
    PED_VARIATION_TEXTURES = 10,
    PED_VARIATION_TORSO2 = 11
    };
    Usage:
    SET_PED_COMPONENT_VARIATION(playerPed, PED_VARIATION_FACE, GET_NUMBER_OF_PED_DRAWABLE_VARIATIONS(playerPed, PED_VARIATION_FACE), GET_NUMBER_OF_PED_TEXTURE_VARIATIONS(playerPed, PED_VARIATION_FACE, 0), 2);



  • @M8T because clothing is random, you will likely need to script not only the component for the bag but also the hair, torso, legs etc. You can set the wardrobe to default thru a native as well but not that useful. In passing, with MP characters you can change facial features so there is another set of native functions for those. You could end up with 15+ lines of code for a customized spawn.



  • @JohnFromGWN Thank you!



  • @JohnFromGWN btw what would you set the hash to if you want to remove the bag?



  • @M8T You can verify the values with a trainer but my guess would be 9,0,0,2. Sry don't have PC presently. Actually this is where using the native function to set default values can be useful assuming the bag is not a default component. In other words you start with the default values to ensure a consistent spawn, then set your customizations.


Log in to reply
 

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