Jump to content
tommytom1

Creating deliver supplies task, with dynamic counter on how many supplies delivered

Recommended Posts

i need help with making a deliver supplies task and have a counter that keeps track of how many supplies have been delivered

Wat im trying to do is have the description update and tell you how much supplies were delivered, so it goes as "1/3 supplies delivered" then 2/3 etc
heres wat i have right now

 

_radioObjects = ["Object1", "Object2","Object3"];

sd = {_radioObjects inArea "trig1"} count _radioObjects; 


 "del", 
 [ 
  format ["Cargo %1 /3",sd], 
  "Deliver the supplies", 
  " " 
 ] 
] call BIS_fnc_taskSetDescription;
😞 its not working

Share this post


Link to post
Share on other sites

objects can't be string. (objects' classes are)

 

Try with

_radioObjects = [Object1, Object2,Object3];

if these objects exist of course.

Share this post


Link to post
Share on other sites

@pierremgi  hey thx for the help, i just tried this and im getting the following error message

 

'...bject2,Object3];
sd = {_radioObjects |#|inArea "trig1"} count _radioObjects; 

Error type Object, Expected number

Share this post


Link to post
Share on other sites

yes, normal

Always check the syntax for every command, if you don't know it by heart!

inArea needs a position or a single object for checking the presence in a marker (like you) or a location or a trigger.

So, if you pass an array of objects, the command treats this array as a position [x,y,z] and find the first object as x and so on. So error type object instead of expected number.

The correct syntax is: {_x inArea "trig1"} count _radioObjects;

where _x is a special (magic) variable.

 

Or... use inAreaArray instead.

Furthermore, your code { <check>} count _radioObjects will work only for a boolean FALSE or TRUE.

On the contrary of inArea throwing a boolean, inAreaArray returns .. an array (of objects inside the area).

So, always follow the syntax

Your code is simple:

SD = count (_radioObjects inAreaArray "trig1");

 

 

Share this post


Link to post
Share on other sites
17 minutes ago, pierremgi said:

yes, normal

Always check the syntax for every command, if you don't know it by heart!

inArea needs a position or a single object for checking the presence in a marker (like you) or a location or a trigger.

So, if you pass an array of objects, the command treats this array as a position [x,y,z] and find the first object as x and so on. So error type object instead of expected number.

 

Use inAreaArray instead.

Ok thx, just tried inareaArray and im getting this error; 
'...bjects = [Object1,Object2,Object3];
sd |#|= {_radioObjects inAreaArray  "trig1"} c...'
Error generic error in expression

im so bad 😧

Share this post


Link to post
Share on other sites
Just now, tommytom1 said:

Ok thx, just tried inareaArray and im getting this error; 
'...bjects = [Object1,Object2,Object3];
sd |#|= {_radioObjects inAreaArray  "trig1"} c...'
Error generic error in expression

im so bad 😧

Read the entire post.

Share this post


Link to post
Share on other sites
11 minutes ago, pierremgi said:

Read the entire post.

Ok lol we're not getting any more errors but the counter part still isnt working, wen i put an object into the trigger it still says 0/3

_radioObjects = [Object1,Object2,Object3];
sd = count (_radioObjects inAreaArray "trig1");   


 "del", 
 [ 
  format ["Cargo %1 /3",sd], 
  "Deliver the supplies", 
  " " 
 ] 
] call BIS_fnc_taskSetDescription;
thats wat i got, im not sure why its not working 😕

Share this post


Link to post
Share on other sites
12 minutes ago, tommytom1 said:

wen i put an object into the trigger

How are you moving the objects? if its a pickup object that you pickup and then drop from your inventory, the object will no longer be Object# as its destroyed when you pick it up and a new item spawned when dropped. You need to explain more what these objects are and how they are transported to the trigger.

Share this post


Link to post
Share on other sites
Just now, Larrow said:

How are you moving the objects? if its a pickup object that you pickup and then drop from your inventory, the object will no longer be Object# as its destroyed when you pick it up and a new item spawned when dropped. You need to explain more what these objects are and how they are transported to the trigger.

cargo container being loaded onto a flat bed using boxloader

Share this post


Link to post
Share on other sites

The trigger??? a trigger has a variable like trig1 with no quote. "trig1" can be a marker, not a trigger.

Share this post


Link to post
Share on other sites
9 minutes ago, pierremgi said:

The trigger??? a trigger has a variable like trig1 with no quote. "trig1" can be a marker, not a trigger.

thx it works now

Share this post


Link to post
Share on other sites
On 8/23/2022 at 2:21 PM, pierremgi said:

The trigger??? a trigger has a variable like trig1 with no quote. "trig1" can be a marker, not a trigger.


hey im  back again and was wondering if u could help me with somthing else, im trying to make the task destination update and change wen ever a supply object is delivered to the trigger, the best way i thought to do this was to 
attach a logic entity to each object and have a trigger that looks like this:

onAct: Game logic
Type: Present
Repeatable
Cond: this
onAct: 
{deleteVehicle _x} forEach thisList; 
["del", Object1M] call BIS_fnc_taskSetDestination;
["del", Object2M] call BIS_fnc_taskSetDestination;
["del", Object3M] call BIS_fnc_taskSetDestination;
 

this works for object 1 and 3 but i always run into issue with Object2M which is attached to Object2, and it doesnt
set the task destination like it does with the other two objects. after i deliver the third object the task set destination just never works for the last object (Object2)
this is the attachTo trigger
 

Anyplayer, Not present
["del", Object1M] call BIS_fnc_taskSetDestination;
Object1M attachTo [Object1,[0, 0, 0]]; 
Object2M attachTo [Object2,[0, 0, 0]]; 
Object3M attachTo [Object3,[0, 0, 0]]; 
 

so basically im trust tryna make it set the task destination to the next _radioObjects that isnt already in the trigger
 

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

×