Jump to content
Sign in to follow this  
combat-agent

Few Questions

Recommended Posts

Im making a CTI missions. Each side can create 15 vehicles. The number of vehicles is controlled by the array. The array contains 15 names for the vehicles, when the array is empty the player can no longer create vehicles.

PROBLEM #1

I gave the array a Name.

RVN = [RV1,RV2,RV3,RV4,RV5,RV6,RV7,RV8,RV9,RV10,RV11,RV12,RV13,RV14,RV15]

an error comes up,

heres what the error said:

"RVM = RVM - _RVM|#|' error -: Type string, Expected Number, Array

heres my script:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_vehicle = _this select 0

_pos = _this select 1

_vehicle = "RAZ"

_pos = getpos player

? (Count RVN) == 0: Hint "You can not create anymore vehicles";exit

_RVN = RVN Select 0

hint Format["%1", _rvn]

RVN = RVN - _RVN

_RVM = RVM Select 0

RVM = RVM - _RVM

_RVN = _vehicle createVehicle getpos _pos

[_RVN,_RVM] exec "scripts/Dialog/Tracker.sqs"

exit

What i tried to do was remove name.

Where am I going wrong here?

Share this post


Link to post
Share on other sites

You need brackets around whatever you're subtracting from an array even if it's just one element (so it's array-array, not array-string). Like this:

arr = ["one", "two", "three"];

arr2 = ["one", "two", "three"];

_str = arr2 select 2;

arr = arr - [_str];

hint format ["%1", arr];

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  

×