Jump to content
Sign in to follow this  
L.Trale

Help with Arrays?

Recommended Posts

Hello,

I'm making a mission which includes a lot of Arrays. So I made this simple script:

cost=1;  
yourmoney = myVariable2; 
if (yourmoney  < cost) then {hint "You don't have any Tomato Seeds!"} else { yourmoney = yourmoney - cost;hint  format ["%1 Tomato Seed(s) Remaining", myVariable2];

Plant = "Land_BottlePlastic_V1_F" createVehiclelocal position player;
Plant attachTo [item, [0, 0, 0] ];
player playMove "AinvPknlMstpSnonWnonDnon_1";
sleep 1;
deleteVehicle Item;
Detach Plant;
Plant addAction ["Check State", "Actions\CheckState.sqf"];
execVM "Plant_init\Tomato_init.sqf";
myVariable2 = yourmoney; };

It works great but there is only one problem; If you use the script more than once, it breaks. i.e I plant a Tomato, then I plant another one. Everything is good until this next part:

hint "You've planted a Tomato Plant.";
sleep 10;
PlantS2 = "Sign_Pointer_F" createVehiclelocal position Plant;
PlantS2 attachTo [Plant, [0, 0, 0.2] ];
sleep 20;
DeleteVehicle PlantS2;
PlantS3 = "Sign_Pointer_Pink_F" createVehiclelocal position Plant;
PlantS3 attachTo [Plant, [0, 0, 0.2] ];
sleep 20;
DeleteVehicle PlantS3;
PlantS4 = "Sign_Pointer_Yellow_F" createVehiclelocal position Plant;
PlantS4 attachTo [Plant, [0, 0, 0.2] ];
sleep 30;
DeleteVehicle PlantS4;
PlantS5 = "Sign_Pointer_Green_F" createVehiclelocal position Plant;
PlantS5 attachTo [Plant, [0, 0, 0.2] ];
Plant addAction ["Harvest Tomato", "Actions\Harvest_Tomato.sqf"];

Then the only one plant grows, and the other just sits there. I've tried createVehiclelocal, but no luck.

I've also tried to use private arrays:

 private ["Plant", "PlantS2", "PlantS3", "PlantS4"]; [code]

Any help? Thanks.

Edited by L.Trale

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  

×