Jump to content
Sign in to follow this  
Seltiix

Create Vehicle with a trigger, that gets a name

Recommended Posts

Im currently editing my mission. And When You destroy a vehicle a trigger triggers

The trigger conditions is as following : !alive transport1

When "transport1" dies, on the activation:

_heli = createVehicle ["B_Heli_Attack_01_F", (getMarkerPos "spawn"), [], 0, "CAN_COLLIDE"];

I want the heli that spawns to have a name Example : heli3, so i can use it in further tasks and strings!

Any help is appriciated

Share this post


Link to post
Share on other sites

Part of the code I just make for one mission.

_camionCargado1 = "B_Truck_01_box_F" createVehicle (getMarkerPos "posContenedor1");

_VarName="hemttcargado1";
_camionCargado1 SetVehicleVarName _VarName;
_camionCargado1 Call Compile Format ["%1=_This ; PublicVariable ""%1""",_VarName];

hemttcargado1 setDamage 0.8; //For Testing purposes

Share this post


Link to post
Share on other sites
SetVehicleVarName is the command you are looking for, you then need to PV the name aswell so all connected computers have the same reference object for the name
_heli = createVehicle ["B_Heli_Attack_01_F", (getMarkerPos "spawn"), [], 0, "CAN_COLLIDE"];
_heliname = "Heli3";
_heli setVehicleVarName _heliname;
_heli call compile format ["%1=_This ; PublicVariable ""%1""",_heliname];

Share this post


Link to post
Share on other sites

Call compile is old and busted, missionNamespace is the new hotness. :)

_vehicleObject = createVehicle ["B_Truck_01_box_F", getMarkerPos "posContenedor1", [], 0, ""];

_vehicleName = "hemttcargado1";

missionNamespace setVariable [_vehicleName,_vehicleObject];
publicVariable _vehicleName;

hemttcargado1 setDamage 1; //For Testing purposes

Share this post


Link to post
Share on other sites
Call compile is old and busted, missionNamespace is the new hotness. :)

_vehicleObject = createVehicle ["B_Truck_01_box_F", getMarkerPos "posContenedor1", [], 0, ""];

_vehicleName = "hemttcargado1";

missionNamespace setVariable [_vehicleName,_vehicleObject];
publicVariable _vehicleName;

hemttcargado1 setDamage 1; //For Testing purposes

Just need to find out where to put it all, i've been on it for so long im now confused...

---------- Post added at 20:33 ---------- Previous post was at 20:28 ----------

SetVehicleVarName is the command you are looking for, you then need to PV the name aswell so all connected computers have the same reference object for the name
_heli = createVehicle ["B_Heli_Attack_01_F", (getMarkerPos "spawn"), [], 0, "CAN_COLLIDE"];
_heliname = "Heli3";
_heli setVehicleVarName _heliname;
_heli call compile format ["%1=_This ; PublicVariable ""%1""",_heliname];

How does the trigger know about this name? An execVm?

---------- Post added at 20:36 ---------- Previous post was at 20:33 ----------

Example in the trigger put : execVm "???.sqf";

Share this post


Link to post
Share on other sites

Here's a quick demo mission.

init.sqf:

sleep 1;
_null = [west, "tskdestroyTruck", ["Blow up that truck!", "Destroy Truck", "Truck"], transport1, true] spawn BIS_fnc_taskCreate;  

spawnHeli.sqf:

_null = ["tskDestroyTruck", "SUCCEEDED"] spawn BIS_fnc_taskSetState; 

if (isServer) then {
_vehicleObject = createVehicle ["B_Heli_Attack_01_F", getMarkerPos "spawn", [], 0, ""];

_vehicleName = "heli3";

missionNamespace setVariable [_vehicleName,_vehicleObject];
publicVariable _vehicleName;
};

waitUntil {!isNil "heli3"};

_null = [west, "tskGetInHeli", ["Get in the helicopter!", "Board Helicopter", "Helicopter"], heli3, true] spawn BIS_fnc_taskCreate;  

First trigger condition: !alive transport1

First trigger onAct: _null = [] execVM "spawnHeli.sqf";

Second trigger condition: player in heli3

Second trigger onAct: _null = ["tskGetInheli", "SUCCEEDED"] spawn BIS_fnc_taskSetState; heli3 vehicleChat "Lets do this!";

Share this post


Link to post
Share on other sites

My mobile is Beeing retarded... Anyway,

Thank YOU, Have my cookies ;)

The part : spawn BIS_fnc_taskCreate; Does that make a popup in the middle of the screen?

Share this post


Link to post
Share on other sites

Yes, the true at the end of the arguments means it'll automatically assign the task to the player.

Share this post


Link to post
Share on other sites
My mobile is Beeing retarded... Anyway,

Thank YOU, Have my cookies ;)

The part : spawn BIS_fnc_taskCreate; Does that make a popup in the middle of the screen?

It's not your mobile:

Note:

1. New member's posts are auto-moderated, please don't re-post the same message over&over again.

2. New members are required to fill captcha before posting new answers/threads.

3. New members are limited in editing/accessing variety of profile & forum features.

These limitations are removed for regular forum users.

Source: Forum rules you've just recently accepted.

Share this post


Link to post
Share on other sites
Myke;2494802']It's not your mobile:

Source: Forum rules you've just recently accepted.

After every post I get a blank page... Didn't think it was supposed to be like that!

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×