Welcome, Guest Wednesday 23rd April 2014, 09:41:26
   Home   Help Search Login Register  

OFPEC Forum

Author Topic: Heli Transport  (Read 272 times)
0 Members and 1 Guest are viewing this topic.
Delta83_DK
*
Offline Offline


« on: 30 Apr 2011, 01:51:33 »

Hi Guys

I have a problem with a fairly simple script.
I have seen some good examples here in forum, and I have tried to make my own.

When I arrive at the helipad the script is activated, and then the sidechat just keeps going "Loop".
I have inserted all the sidechats, just to see where the script gets stuck.
But as I can see, the condition to get to the "Pickup" has been met, but nothing happens.
I have tried to input the line "Helo_1 distance H_1 < 20" in the condition-field of the trigger, and the script still gets activated, so the condition to go futher in the script must be met?

It is most likely a rookie-mistake, but can someone see the problem?


I have this in a trigger right at the Helipad :

Code:
Condition : ((vehicle Helo_1) in thisList) and ((getPos (vehicle Helo_1) select 2) < 2) && Helo_1 Distance H_1<10
On Act. : [] exec "Chopper_Transport.sqs"


Chopper_Transport.sqs

Code:
; Helo transport

;Unit = Player_1
;Chopper = Helo_1
;Helipad = H_1
;Group = Grp_1


Player_1 Sidechat "Boardingscript activated"

#Loop

~3

Player_1 Sidechat "Loop"

? Helo_1 distance H_1 < 20 Then Goto "Pickup"

~3

Goto "Loop"

#Pickup

Player_1 Sidechat "Helo reached Pickup point"

Player_1 sidechat "(Grp_1) Group 1 Boarding Chopper"

~3

{_x AssignAsCargo helo_1} forEach units group grp_1

units group grp_1 orderGetIn true

?{{_x in helo_1} count units group grp_1 == count units group grp_1} then titleText["Lets go home", "PLAIN DOWN"] and goto "Exit"

#Exit

~1

Player_1 Sidechat "Exit boarding script"

~3

Exit
Logged
SaOk
Missions Depot Staff
*****
Offline Offline



WWW
« Reply #1 on: 30 Apr 2011, 10:14:14 »

Code:
? Helo_1 distance H_1 < 20 Then Goto "Pickup"

Needs to be:

Code:
? Helo_1 distance H_1 < 20: Goto "Pickup"

Edit:
Also the later line should look like this:
Code:
?{{_x in helo_1} count (units group grp_1) == count (units group grp_1)}: titleText["Lets go home", "PLAIN DOWN"] ; goto "Exit"

Edit2:
Its also good to use "(" and ")" as much as possible. If there is long lines the system may not count it right without those. Here is whole script fixed:
Code:
; Helo transport
;Unit = Player_1
;Chopper = Helo_1
;Helipad = H_1
;Group = Grp_1
Player_1 Sidechat "Boardingscript activated";
#Loop
~3
Player_1 Sidechat "Loop";
? Helo_1 distance H_1 < 20: Goto "Pickup"
~3
Goto "Loop"
#Pickup
Player_1 Sidechat "Helo reached Pickup point";
Player_1 sidechat "(Grp_1) Group 1 Boarding Chopper";
~3
{_x AssignAsCargo helo_1;} forEach (units grp_1);
(units (grp_1)) orderGetIn true;
#WaitCargo
~2
?{{_x in helo_1} count (units grp_1) == count (units grp_1)}: titleText["Lets go home", "PLAIN DOWN"];goto "Exit";
goto "WaitCargo"
#Exit
~1
Player_1 Sidechat "Exit boarding script";
~3
Exit
« Last Edit: 30 Apr 2011, 10:22:57 by SaOk » Logged
Delta83_DK
*
Offline Offline


« Reply #2 on: 30 Apr 2011, 13:54:04 »

Great!. Thx a lot  Smiley
Very nice to see people taking time to help others.
One more question : What is the difference between "()" and "{}"
Logged
SaOk
Missions Depot Staff
*****
Offline Offline



WWW
« Reply #3 on: 04 May 2011, 09:31:27 »

With "()", you determine in what order things are calculated. Like in math (2*2+1=5 2*(2+1)=6). Sometime if "()" are not used, the game may try to count complex things in wrong order giving an error.

"{}" outline code/functions. E.g. to commit function, that adds M16, for each unit in group that have a member unitname1.

Code:
{_x addweapon "M16";} foreach (units (group unitname1));
Logged
Pages: [1]   Go Up
  Send this topicPrint  
 
Jump to: