Jump to content

How to set textures on vehicles?


Recommended Posts

Hi,

 

first my English is not the best (german) so I'm really sorry for that :-(

 

 

I try to set textures on my vehicles but it's not working that good...

 

The textures getting applyed but after respawning that vehicle (abadoned or destroyed) the textures are not loading again....

 

 

Can someone help me with that?

 

Thanks!

Link to comment
Share on other sites

  • 1 year later...

At the risk of saying "me too" and/or generating too many forum posts, can I resurrect this thread and add "not just textures, but default loadouts I set in Eden Editor on base vehicles using init".

 

I tried adding an addMPEventhandler  set for MPRespawn but no dice - they are there on startup but on first respawn they're back to factory default settings.

 

Looking at the code, I feel I need to add something into fn_vMonitor.sqf to inherit the init script values from the original mapped entity. Does that sound right?

 

I'm not a guru at scripting but if someone could give me at least a pointer to the area I need to be in to get this working that would be really great - thanks!

Link to comment
Share on other sites

We use a custom respawn script, afaik it's not the original vehicle that respawns it's a newly spawned vehicle.  This brings it's problems but also has it's advantages.  For stuff that you'd normally put in the init of a vehicle simply put it in fn_vsetup02.sqf (functions/vehicle).  And if needed apply the correct 'filter' so it's not executed on each and every vehicle.

 

Let me know if you have more questions about this :) 

Link to comment
Share on other sites

Thanks for the super fast reply, Stanhope! Funnily enough, I'd just trawled through and found the fn_vsetup02 and was experimenting to see if it was overwriting the original entity - as I blew a heli up at base to check, your message came up! :) I get it now - I just need to extend the checks which at the moment group "_humming" (the AH-9 Pawnee) set in motion for them all.

 

I guess there is no way of being able to interrogate the init params on the original (now destroyed) entity that could be checked on and potentially duplicated on the newly created vehicle?

 

I can see the advantages of the script approach as it does lend itself to more complicated functions, I can see in the code substitution of loadouts and randomising of textures, which would be a pain to copy/paste into every init, so I definitely get your problem/advantage bit.

Link to comment
Share on other sites

OK, beginning to piece this together (I think). I tried using

 

private _name = name _vehicle;

 

at the top of fn_vSetup02, after
 

private _vehicle = _this select 0;

 

and made a filter with an


 

//===== littlebird digital skin
if(_vehicleType in _humming) then {
        if ( _name == "GH_1" ) then {
                _vehicle addWeapon "CMFlareLauncher";
                _vehicle addmagazine "300Rnd_CMFlare_Chaff_Magazine";
                _vehicle addmagazine "300Rnd_CMFlare_Chaff_Magazine";
                _vehicle setObjectTextureGlobal[0, '#(rgb,8,8,3)color(1,0,0,1)'];
        }
        else
        {
                _camo = selectRandom [
                'A3\Air_F\Heli_Light_01\Data\Heli_Light_01_ext_BLUFOR_CO.paa',
                'A3\Air_F\Heli_Light_01\Data\Heli_Light_01_ext_ION_CO.paa',
                'A3\Air_F\Heli_Light_01\Data\skins\Heli_Light_01_ext_wasp_co.paa',
                'A3\Air_F\Heli_Light_01\Data\skins\heli_light_01_ext_digital_co.paa',
                'A3\Air_F\Heli_Light_01\Data\skins\heli_light_01_ext_digital_co.paa'
                ];
                _vehicle setObjectTextureGlobal[0, _camo];
        }
}

 

 

 

 but I'm guessing I'm too late to the party to do anything with that as it's referencing something that doesn't exist any more? GH_1 is the spawn name of the heli at base I'm trying to change to colour of in the above example - and it is an AH9 Pawnee in my changed version.

 

I see there's a couple of createvehicles in fn_vBasemonitor.sqf. Am I right in thinking that this is where the actual respawn takes place, and is then handed over to vSetup02 - by which time it's too late to grab the original name? Would I be better off doing some checks in there instead - I can see references to the init property of the entity (_i) in vBasemonitor. Or am I on completely the wrong tree? :)

 

Link to comment
Share on other sites

I euh, mmh.  I'm not gonna be able to help you till tomorrow afternoon.

Thing is that i've got an SQL exam tomorrow, on paper.  And we're not allowed to make syntax mistakes so I'm not gonna be digging into SQF right now :) 

 

I'll have a look at this once I get home from my exam tomorrow.

Link to comment
Share on other sites

No worries Stanhope and good luck for your exam tomorrow. Back away from the forums! :)

PS Am working on a proximity detection for the jumppad the heli is respawning on in vsetup02 . I think I'll get the result I'm after that way but it's a little convoluted.

Link to comment
Share on other sites

2 minutes ago, ansin11 said:

Use the default editor respawn module, it does all the work for you.

What do you mean - just tick the box in the Eden editor? Won't that conflict with the I&A respawn routines - I have had issues trying that in the past where 50% of the time the object respawning detonates! Or do you mean disable the init code with vsetup02 in it?

Link to comment
Share on other sites

I mean place the respawn module, put some code in it and synch it to the desired objects. Obviously this will interfere with the I & A code, because for some reason I & A 3 never uses any given routines except for like three triggers.

Link to comment
Share on other sites

16 hours ago, gigglebok said:

I guess there is no way of being able to interrogate the init params on the original (now destroyed) entity that could be checked on and potentially duplicated on the newly created vehicle?

Not that I'm aware of no.

 

16 hours ago, gigglebok said:

I see there's a couple of createvehicles in fn_vBasemonitor.sqf. Am I right in thinking that this is where the actual respawn takes place, and is then handed over to vSetup02 - by which time it's too late to grab the original name? Would I be better off doing some checks in there instead - I can see references to the init property of the entity (_i) in vBasemonitor. Or am I on completely the wrong tree? :)

I wouldn't know :)  I didn't write the script and whenever I change something in the vsetup it's supposed to take effect for all vehicles of that class so i've never run into such an issue.

 

15 hours ago, gigglebok said:

What do you mean - just tick the box in the Eden editor? Won't that conflict with the I&A respawn routines - I have had issues trying that in the past where 50% of the time the object respawning detonates! Or do you mean disable the init code with vsetup02 in it?

If you use the vanilla respawn thing simply remove the line of code that calls the respawn script from the init of the vehicle.  (Can't exactly remember what that is but i'll probably be a bunch of params followed by spawn AW_fnc_basemonitor?)

 

By the way do you want to change the color and add flares for all the pawnees spawned by the mission or only for 1 specific pawnee?

Link to comment
Share on other sites

Quote

By the way do you want to change the color and add flares for all the pawnees spawned by the mission or only for 1 specific pawnee?

Just for a handful - but it's ok, thanks to your pointers I have done a crash course in scripting and realised how far off the rails I was with the above. Using the jump pad crosses I was able to assign the correct attributes to the newly spawned vehicle that sat on that particular cross. So I've worked out in a roundabout way how to do what I wanted - by checking distance from newly spawned pawnee (used to be GH_1 - but vsetup02/vbasemonitor/bis respawn anonymises it) to corresponding jump pad cross that it sits on - "GH_1_pad". I've never done any serious ARMA scripting but I've been a coder for 40 years(!) so it didn't take long to get something going - if you can give me any pointers on improving it then please do - this might be useful to others, it certainly wasn't immediately obvious for example how to get the distance from a quoted name tag on an editor field to a spawned object. I'm just randomly throwing a colour on the other pawnees in the below.
In doing so I've also answered the OP's question, so that made me feel quite good too :)

 

Quote

 

//===== littlebird digital skin
if(_vehicleType in _humming) then {
    private _humming_loadout = [[[["arifle_MXC_F"],[2]],[["SmokeShell","SmokeShellBlue","30Rnd_65x39_caseless_mag","RPG32_F","Titan_AT"],[2,2,4,6,6]],[["FirstAidKit","ToolKit","ItemGPS"],[10,1,1]],[[],[]]],false];
    if ( ( _vehicle distance ( missionNamespace getVariable[ "GH_1_pad", objNull] ) ) < 5 ) then // are we within 5 metres?
    {
        [_vehicle,_humming_loadout] call bis_fnc_initAmmoBox;

        _vehicle addWeapon "CMFlareLauncher";
        _vehicle addmagazine "300Rnd_CMFlare_Chaff_Magazine";
        _vehicle addmagazine "300Rnd_CMFlare_Chaff_Magazine";
        _vehicle setObjectTextureGlobal[0, '#(rgb,8,8,3)color(1,0,0,1)']; // red
    }
    else // don't add ammo stuff, but use a random colour

    {
                _camo = selectRandom [
                '#(rgb,8,8,3)color(0.2,0.2,0.2,1)',  // grey
                '#(rgb,8,8,3)color(1,0.65,0,1)',  // orange
                '#(rgb,8,8,3)color(0,0.5,1,1)',  // royal blue
                '#(rgb,8,8,3)color(1,0,1,1)', // magenta
                '#(rgb,8,8,3)color(0,1,1,1)', // cyan
                '#(rgb,8,8,3)color(1,1,0,1)' // yellow
                    ];
                 _vehicle setObjectTextureGlobal[0, _camo];
        };

    };

 

 

Link to comment
Share on other sites

2 hours ago, ansin11 said:

There a reason you use the missionNamespace? Why not use the object?

I've never done scripting before - but when I tried to use GetMarkerPos (It's a string, so GetPos wasn't having it, as that expects an Object) it reckoned it was 22km away from the object that it was sitting on. If there's a better way please do tell as I'm a complete n00b at scripting. This definitely worked but it did seem a little odd.

Link to comment
Share on other sites

Your landing pad is a marker? That seems weird to me.

 

getMarkerPos will work for markers placed in the Eden Editor or created with createMarker. However, I find it unlikely that you would actually want to use a marker for comparison here... But that's just an assumption.

 

distance expects two Positions or objects. Comes in handy here, I would just pass the landing pad object (set the object name in the Editor) and the _vehicle. Alternatively, you could also hardcode the reference position (in format [X, Y, Z]) by right clicking the spot (or object) you want and choosing "Export position" from the menu. This will copy the position array (of your cursor position or the object you right clicked on) to your clipboard and you can just pass that to distance.

 

Note to @Stanhope: Make sure to thoroughly consider using the respawn module from the Editor for I & A 4. It allows you to run code on the respawning vehicle(s) (We love magic variables!), can be synched to multiple vehicles and does pretty much everything for you. You can also create it on the fly (as far as I know) using BIS_fnc_moduleRespawnVehicle. No excuses. It's better.

Link to comment
Share on other sites

Quote

Your landing pad is a marker?

No - but I couldn't find any easy function to do type conversion from "string" - i.e. my landing pad object name in quotes - to "object" - which is what distance expects - other than converting it into an object from namespace. Just shoving it in like ( _vehicle distance "GH_1" ) fails with a type error telling me I can't mix array with string. I looked around for a type conversion from string to object and found the above using missionNamespace.

 

I suspect from the above you're trying to tell me there's an easier method to do this but unfortunately, like I say, I'm a complete n00b at scripting so without showing me exactly how I should be rewriting it I'm not sure what you're getting at - to be clear, how should I reference an individual editor object in a distance calculation like everybody else apparently is doing on the planet (except me). Don't ask me any more questions highlighting my complete inability to script please - just post what I should be doing and be done with it!

Link to comment
Share on other sites

If you name your landing pad GH_1_pad, then that's it's object variable name. So:

On 15/01/2018 at 7:39 PM, gigglebok said:

if ( ( _vehicle distance ( missionNamespace getVariable[ "GH_1_pad", objNull] ) ) < 5 ) then

Can be

On 15/01/2018 at 7:39 PM, gigglebok said:

if ( _vehicle distance GH_1_pad < 5 ) then

 

Link to comment
Share on other sites

1 hour ago, Ryko said:

If you name your landing pad GH_1_pad, then that's it's object variable name. So:

Can be

 

OMG! So simple, I missed it. Thanks Ryko! I assumed I had to use a string of the label and never realised BIS made it easy for us! 

Link to comment
Share on other sites

4 minutes ago, Ryko said:

Thank you for posting your code about missionNameSpace - there are times I need to translate a string to an object and that is very helpful!

No worries! We're all here to learn off each other - I could see some good possibilities for it too - like concatenating a dynamic reference to objects in a loop. I thought it might have helped me extract the initial "init" from the original object too but once I got the above working I was a happy I&A bunny :)

Thanks for explaining something that I really couldn't find a reference to anywhere in the BIS docs - it goes on about strings, arrays, objects, positions but nowhere did I find out that simply using the editor name as a variable makes it the same object. Guess my 40 years of coding count against me for that!

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Forum Statistics

    11.1k
    Total Topics
    66.4k
    Total Posts
×
×
  • Create New...