Jump to content
Sign in to follow this  
Morticus

Puting scripts in init field using scripts

Recommended Posts

Hi,

I need a little help i have the following script that spawns a unit at a possition and adds a line in the init field below:-

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_repair1 = "truck5trepair" createvehicle (getmarkerpos eb1);

[_repair, 320, 0 , 361] exec "vehi_respawn.sqs";

Now i want to change the init field in the vehicle to this :-

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">s = this execVM "vrs.sqf";

what is the correct syntax to do this please ? would it be something like this

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">[_repair,(s = this)] execVM "vrs.sqf"

Please help

Thanks

Share this post


Link to post
Share on other sites

What about:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">if (isserver) then {_repair1 execvm "vrs.sqf"};

..after you make the vehicle. It's not in the init but you should run that on the server. Er, is client calling this? Then you would need to send vehicle to server so that it could attach a respawn script to it. Or else when the client disconnected the vehicle wouldn't respawn anymore.

Share this post


Link to post
Share on other sites

this is my current script

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_airfield = getmarkerpos airfield;

"respawn_west" setmarkerpos _airfield;

HINT "REPAWN NOW MOVED TO BASE 2 PASARIO AIRFIELD";

if (! isServer) exitwith {};

_repair1 = "truck5trepair" createvehicle (getmarkerpos eb1);

[_repair, 320, 0 , 361] exec "vehi_respawn.sqs";

_refuel1 = "truck5trefuel" createvehicle (getmarkerpos eb1_1);

[_refuel1, 320, 0 , 361] exec "vehi_respawn.sqs";

_cammo = "truck5treammo" createvehicle (getmarkerpos eb1_2);

[_cammo, 320, 0 , 361] exec "vehi_respawn.sqs";

_tank1 = "M113" createvehicle (getmarkerpos eb1_3);

[_tank1, 320, 0 , 361] exec "vehi_respawn.sqs";

_tank2 = "M113" createvehicle (getmarkerpos eb1_4);

[_tank2, 320, 0 , 361] exec "vehi_respawn.sqs";

_tank3 = "Vulcan" createvehicle (getmarkerpos eb1_5);

[_tank3, 320, 0 , 361] exec "vehi_respawn.sqs";

_tank4 = "M1Abrams" createvehicle (getmarkerpos eb1_6);

[_tank4, 320, 0 , 361] exec "vehi_respawn.sqs";

_car1 = "stryker_TOW" createvehicle (getmarkerpos eb1_7);

[_car1, 320, 0 , 361] exec "vehi_respawn.sqs";

_car2 = "stryker_ICV_M2" createvehicle (getmarkerpos eb1_8);

[_car2, 320, 0 , 361] exec "vehi_respawn.sqs";

_heli1 = "AH1W" createvehicle (getmarkerpos eb1_9);

[_heli1, 320, 0 , 361] exec "vehi_respawn.sqs";

_AV8 = "Av8B" createvehicle (getmarkerpos eb1_10);

[_AV8, 320, 0 , 361] exec "vehi_respawn.sqs";

_AV8B = "AV8B2" createvehicle (getmarkerpos eb1_11);

[_AV8B, 320, 0 , 361] exec "vehi_respawn.sqs";

_AV8B1 = "AV8B2" createvehicle (getmarkerpos eb1_12);

[_AV8B1, 320, 0 , 361] exec "vehi_respawn.sqs";

I am wanting to change the init of each created empty vehicle to

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">s = this execVM "vrs.sqf";

So from my understanding the following line after the created vehicle would work ok.

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_repair1 = "truck5trepair" createvehicle (getmarkerpos eb1);

if (isserver) then {_repair1 execvm "vrs.sqf"};

and change it for each unit ?

Share this post


Link to post
Share on other sites

should do the trick...

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_VehInit = "this execVM ""vrs.sqf""";

_Veh setVehicleInit _VehInit;

processInitCommands;

Share this post


Link to post
Share on other sites

so do i add this line to each line in the sqs script? or is this for sqf?.

I have it in both formats, but i can not get the sleep 2; to work in sqf comes up with a time error

not sure why!

Mort

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  

×