Jump to content
Sign in to follow this  
DTM2801

need some help with a transport script

Recommended Posts

I'm trying to make a script that is called from the init of the vehicle, like: null= call {[this] execvm "transport.sqf"};.

The vehicles are given a statuscode on entering of leaving a vehicle, using the eventhandlers.

I've put some conditions in the waypointstatements field that should move the vehicles back and forth to the markers I've put on the map.. obviously I cant get it to work and am a bit stuck atm. So some pointers are much appreciated.

This is the script I'm working on:

 private ["_transporter","_pickupPos1","_pickupPos2","_dropoffPos1""_dropoffPos2","_transporgrp","_transpoint0","_transpoint1","_transpoint2","_transpoint3","_transpoint4"];
_transporter = _this select 0;
_transportgrp = group _transporter;
_pickupPos1 = getmarkerpos "marker1";
_dropoffPos1 = getmarkerpos "marker2";
_pickupPos2 = getmarkerpos "marker2";
_dropoffPos2 = getmarkerpos "marker1";

_transporter addEventHandler ["GETIN", {(_this select 0 setVariable ["status", 2, true]); hint format ["DEBUG: %1 has status %2" ,_this select 0,(_this select 0 getVariable "status")];}];
_transporter addEventHandler ["GETOUT",{(_this select 0 setVariable ["status", 4, true]); hint format ["DEBUG: %1 has status %2",_this select 0,(_this select 0 getVariable "status")];}];
_transporter addEventHandler ["FUEL", {hint format ["%1 is unavailable; out of fuel.",_this select 0];}];
_transporter addEventHandler ["DAMMAGED", { this select 0 setCurrentWaypoint [this select 0, 1]; hint format ["%1 has been damaged, returning to base.",_this select 0];}];
_transporter addEventHandler ["KILLED", {hint format["%1 KIA",_this select 0];}];

_transpoint0 = _transportgrp addwaypoint[_pickupPos1, 10];
[_transportgrp,1] setwaypointtype "LOAD";
[_transportgrp,1] setwaypointCombatMode "BLUE";
[_transportgrp,1] setwaypointBehaviour "SAFE";
[_transportgrp,1] setwaypointSpeed "FULL";
[_transportgrp,1] setwaypointStatements ["call compile format ['%1',_this] getVariable 'status' == 2","hint 'debug wp1'"];

_transpoint1 = _transportgrp addwaypoint[_dropoffPos1, 10];
[_transportgrp,2] setwaypointtype "TR UNLOAD";
[_transportgrp,2] setwaypointTimeout [1,1,1];
[_transportgrp,2] setwaypointStatements  ["call compile format ['%1',_this] getVariable 'status' == 4","hint 'debug wp2'"];

_transpoint2 = _transportgrp addwaypoint[_pickupPos2, 10];
[_transportgrp,3] setwaypointtype "LOAD";
[_transportgrp,3] setwaypointTimeout [1,1,1];
[_transportgrp,3] setwaypointStatements  ["call compile format ['%1',_this] getVariable 'status' == 2","hint 'debug wp3'"];

_transpoint3 = _transportgrp addwaypoint[_dropoffPos2, 10];
[_transportgrp,4] setwaypointtype "TR UNLOAD";
[_transportgrp,4] setwaypointTimeout [1,1,1];
[_transportgrp,4] setwaypointStatements  ["call compile format ['%1',_this] getVariable 'status' == 4","hint 'debug wp4'"];

_transpoint4 = _transportgrp addwaypoint[_pickupPos1, 10];
[_transportgrp,5] setwaypointtype "CYCLE";

SOLVED: Problem was " instead of ' at the call compile format part

Edited by DTM2801
solved

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  

×