Home   Help Search Login Register  

Author Topic: Go and Defend Script... dont work!  (Read 6295 times)

0 Members and 1 Guest are viewing this topic.

Offline BozBog

  • Members
  • *
Re: Go and Defend Script... dont work!
« Reply #30 on: 22 Jun 2007, 17:02:24 »
Lol i guess i wont need that bit of code then, thxs for the help LCD.. and the tip too Mandoble :p... so, my script.. can anyone help?

Quote
lool i making another script now.. so the unit's can fallback.. i kno i ask too much.. if thats ok? lol but im wonderin how do i make the unit move to the vehicle and get in it? I dont wanna use moveInCargo.. as it jumps em in.. is there any other way? thxs so much.

Code: [Select]
~10
Officer sideChat "Damn! everybody fall back now! Fall back to the base!!"
~10
Officer sideChat "There's more than 200 unit's here, you people will be overrun!"
~10
Officer sideChat "See you back at the base! Out"

truck1 move (getmarkerpos safehaven)
truck2 move (getmarkerpos safehaven1)

grp4 move (getmarkerpos safehaven)
grp5 move (getmarkerpos safehaven)
grp6 move (getmarkerpos safehaven1)
grp7 move (getmarkerpos safehaven1)

@(unitReady leader truck1)&&(unitReady leader truck2)

grp4 action ["getin", vehicle truck1]
grp5 action ["getin", vehicle truck1]
grp6 action ["getin", vehicle truck2]
grp7 action ["getin", vehicle truck2]

@(unitReady leader grp4)&&(unitReady leader grp5)&&(unitReady leader grp6)&&(unitReady leader grp7)

truck1 move (getPos Officer)
truck2 move (getPos Officer)

exit
this code doesnt work .

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: Go and Defend Script... dont work!
« Reply #31 on: 22 Jun 2007, 17:11:15 »
use assignAsCargo for each unit in your groups when both, corresponding truck driver and leader of units group are ready and between the move commands and the check for ready insert a ~4 then issue also an allowgetin command.

Offline BozBog

  • Members
  • *
Re: Go and Defend Script... dont work!
« Reply #32 on: 22 Jun 2007, 17:38:48 »
Hey mando, is this what you mean? i changed the para's to this script, as when the unit's were spotted trigger, the other script was executed and the para's came flying over the fallback trigger.. so i put the para's in the fallback trigger.. so they attack you when you are running to safe haven).. so here's the script.. the last parts dont work.. the unit's do not move to their position at safe haven at all...

Code: [Select]
; *****************************************************
; ** Fallback *****************************************
; *****************************************************

_specops = createGroup east;
~5
_ang = 0
para1 = "ParachuteEast" createVehicle [0,0,0]
para1 setPos [(getPos logic select 0)+sin(_ang)*20,(getPos logic select 1)+cos(_ang)*20, getpos logic select 2]
east1 = _specops createUnit ["SoldierEB", (position player), [] ,0 ,"seargent"]
east1 moveInDriver para1


~5
_ang = _ang + 45
para2 = "ParachuteEast" createVehicle [0,0,0]
para2 setPos [(getPos logic select 0)+sin(_ang)*20,(getPos logic select 1)+cos(_ang)*20, getpos logic select 2]
east2 = _specops createUnit ["SoldierEB", (position player), [] ,0 ,"seargent"]
east2 moveInDriver para2


~5
_ang = _ang + 45
para3 = "ParachuteEast" createVehicle [0,0,0]
para3 setPos [(getPos logic select 0)+sin(_ang)*20,(getPos logic select 1)+cos(_ang)*20, getpos logic select 2]
east3 = _specops createUnit ["SoldierEB", (position player), [] ,0 ,"seargent"]
east3 moveInDriver para3


~5
_ang = _ang + 45
para4 = "ParachuteEast" createVehicle [0,0,0]
para4 setPos [(getPos logic select 0)+sin(_ang)*20,(getPos logic select 1)+cos(_ang)*20, getpos logic select 2]
east4 = _specops createUnit ["SoldierEB", (position player), [] ,0 ,"seargent"]
east4 moveInDriver para4


~5
_ang = _ang + 45
para5 = "ParachuteEast" createVehicle [0,0,0]
para5 setPos [(getPos logic select 0)+sin(_ang)*20,(getPos logic select 1)+cos(_ang)*20, getpos logic select 2]
east5 = _specops createUnit ["SoldierEB", (position player), [] ,0 ,"seargent"]
east5 moveInDriver para5


~5
_ang = _ang + 45
para6 = "ParachuteEast" createVehicle [0,0,0]
para6 setPos [(getPos logic select 0)+sin(_ang)*20,(getPos logic select 1)+cos(_ang)*20, getpos logic select 2]
east6 = _specops createUnit ["SoldierEB", (position player), [] ,0 ,"seargent"]
east6 moveInDriver para6


~5
_ang = _ang + 45
para7 = "ParachuteEast" createVehicle [0,0,0]
para7 setPos [(getPos logic select 0)+sin(_ang)*20,(getPos logic select 1)+cos(_ang)*20, getpos logic select 2]
east7 = _specops createUnit ["SoldierEB", (position player), [] ,0 ,"seargent"]
east7 moveInDriver para7


~5
_ang = _ang + 45
para8 = "ParachuteEast" createVehicle [0,0,0]
para8 setPos [(getPos logic select 0)+sin(_ang)*20,(getPos logic select 1)+cos(_ang)*20, getpos logic select 2]
east8 = _specops createUnit ["SoldierEB", (position player), [] ,0 ,"seargent"]
east8 moveInDriver para8


~5
_ang = _ang + 45
para9 = "ParachuteEast" createVehicle [0,0,0]
para9 setPos [(getPos logic select 0)+sin(_ang)*20,(getPos logic select 1)+cos(_ang)*20, getpos logic select 2]
east9 = _specops createUnit ["SoldierEB", (position player), [] ,0 ,"seargent"]
~0.1
east9 moveInDriver para9

~10
Officer sideChat "Damn! everybody fall back now! Fall back to the base!!"
~10
Officer sideChat "There's more than 200 unit's here, you people will be overrun!"
~10
Officer sideChat "See you back at the base! Out"
~12

truck1 sideChat "We are on our way, all unit's meet at the safe haven immediately, the tanks can come home now"

truck1 move getmarkerpos "safehaven"
truck2 move getmarkerpos "safehaven1"

grp4 move getmarkerpos "safehaven"
grp5 move getmarkerpos "safehaven"
grp6 move getmarkerpos "safehaven1"
grp7 move getmarkerpos "safehaven1"

grp8 move getPos Officer

@(unitReady leader truck1)&&(unitReady leader truck2)

({_x assignAsCargo truck1}forEach units grp4)
({_x assignAsCargo truck1}forEach units grp5)
({_x assignAsCargo truck2}forEach units grp6)
({_x assignAsCargo truck2}forEach units grp7)

~4
([grp4,grp5,grp6,grp7]allowGetIn true)

@(unitReady leader grp4)&&(unitReady leader grp5)&&(unitReady leader grp6)&&(unitReady leader grp7)

truck1 move (getPos Officer)
truck2 move (getPos Officer)

exit

but i changed it to

Code: [Select]
grp4 move getmarkerpos "safehaven"
glad i got that part working. cheers :)

EDITx2: CR*P cant seem to get all the unit's to get in the trucks.. seems only the leader's get in.. weird.
« Last Edit: 22 Jun 2007, 18:53:51 by BozBog »

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: Go and Defend Script... dont work!
« Reply #33 on: 22 Jun 2007, 19:26:43 »
Move the ~4 below the allowgetin
and with this
@(unitReady leader grp4)&&(unitReady leader grp5)&&(unitReady leader grp6)&&(unitReady leader grp7)
you are only checking that your leaders are ready, not that anyother alive unit is in the trucks.

Offline BozBog

  • Members
  • *
Re: Go and Defend Script... dont work!
« Reply #34 on: 22 Jun 2007, 21:43:09 »
Lol mad and crazy.. i cant seem to get this script to work.. of course im an ArmA noob.. so.. hope thats fine lol :)

The problem's with the scripts are

Code: [Select]
[{_x allowGetIn true}forEach units grp4]
[{_x allowGetIn true}forEach units grp5]
[{_x allowGetIn true}forEach units grp6]
[{_x allowGetIn true}forEach units grp7]
~4

@(unitReady grp4)&&(unitReady grp5)&&(unitReady grp6)&&(unitReady grp7)

exit

these parts..

The top part.. cant seem to get ALL the unit's into the trucks (this comes up with error.. but last time, only the leaders jumped in the trucks..)

the bottom part.. Mando is rite, it checked the leader earlier.. i dont know how to check for all the units..

i tried it with this.. dont work

Code: [Select]
@(grp4 in vehicle)&&(grp5 in vehicle)&&(grp6 in vehicle)&&(grp7 in vehicle)
« Last Edit: 22 Jun 2007, 21:47:01 by BozBog »

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: Go and Defend Script... dont work!
« Reply #35 on: 22 Jun 2007, 22:39:04 »
@{alive _x} count units grp# == {_x in vehicle#} count units grp#

Offline BozBog

  • Members
  • *
Re: Go and Defend Script... dont work!
« Reply #36 on: 23 Jun 2007, 19:32:21 »
Argh i sorta wanted to clean up my script.. so i seperated part's of them, including where the truck picks up the units.. so that the truck move's individually when a grp finished getting inside it.. soo i created another script for that.. and i cant get it to work.. lol i've given up on this almost, so iv'e uploaded the mission files.. hope noone steals my ideas'/ scripts' without asking me.. i just posting for help thats all :) cheers.

edit:

Well.. i thought about it.. ive posted the scripts below in order they start to give you guys an idea and any possible changes that could be made.. ill point out where it dont work.

Basically the mission starts.. you walk around with your group until all of a sudden an alarm sounds.. the trigger is activated when it is OPFOR detected by BLUFOR
and this script starts.. seems to be fine here.

Defend.sqs
Code: [Select]
; *****************************************************
; ** Defend Position **********************************
; *****************************************************

playsound "alarm"
~20
Officer sideChat "Theyre' here! Everyone up the front line and defend!."
~15

@(unitReady leader grp4)&&(unitReady leader grp5)&&(unitReady leader grp6)&&(unitReady leader grp7)&&(unitReady leader grp8)
~10
Officer sideChat "Ok, everyone going in to position? Good. Now do not to let them through!"
~10
Officer sideChat "Good luck, out"

exit

;******CREDIT******************************

;**Mandoble - Wicked Scripting ************

;**Cheetah - Trying to help ***************

;**Crashdome - Also trying to help ********

;**Lee - Trying to help too ***************

;**Surdus Priest - Good Advice ************

Then all the cycle waypoints stops, and the unit's move to their position and attack any enemy on sight.. the waypoint they move to defend has a lockWP in it.

Then if any enemy guys get's pasts the machine guns into the town.. another script start's telling everyone to fall back.. so it's up to the player's ability to stop them getting into the town, otherwise this script will start.

Fallback.sqs
Code: [Select]
; *****************************************************
; ** Fallback *****************************************
; *****************************************************

(truck1 setGroupId ["Zulu","GroupColor5"])
(truck2 setGroupId ["Buffalo","GroupColor5"])
(truck3 setGroupId ["Yankee","GroupColor5"])
(truck4 setGroupId ["Kilo","GroupColor5"])
([] exec "para.sqs")
~7
Officer sideChat "Damn! everybody fall back now! Fall back to the base!!"
~10
Officer sideChat "There's more than 200 unit's here, you people will be overrun!"
~5
Officer sideChat "See you back at the base! Out"
~7

([grp4,truck1,baselog1]exec "trucktobase.sqs")
~0.1
([grp5,truck2,baselog2]exec "trucktobase.sqs")
~0.1
([grp6,truck3,baselog3]exec "trucktobase.sqs")
~0.1
([grp7,truck4,baselog4]exec "trucktobase.sqs")

grp8 move getPos Officer

exit

At the same time this script start's to make parachuters drop... well THEY DONT!!!! ARRRGGHHHHHH it worked when the code from para.sqs was in the fallback.sqs.. but not now! argh

para.sqs
Code: [Select]
; *****************************************************
; ** Para *********************************************
; *****************************************************

_specops = createGroup east;
~5
_ang = 0
para1 = "ParachuteEast" createVehicle [0,0,0]
para1 setPos [(getPos logic select 0)+sin(_ang)*20,(getPos logic select 1)+cos(_ang)*20, getpos logic select 2]
east1 = _specops createUnit ["SoldierEB", (position player), [] ,0 ,"seargent"]
east1 moveInDriver para1


~5
_ang = _ang + 45
para2 = "ParachuteEast" createVehicle [0,0,0]
para2 setPos [(getPos logic select 0)+sin(_ang)*20,(getPos logic select 1)+cos(_ang)*20, getpos logic select 2]
east2 = _specops createUnit ["SoldierEB", (position player), [] ,0 ,"seargent"]
east2 moveInDriver para2


~5
_ang = _ang + 45
para3 = "ParachuteEast" createVehicle [0,0,0]
para3 setPos [(getPos logic select 0)+sin(_ang)*20,(getPos logic select 1)+cos(_ang)*20, getpos logic select 2]
east3 = _specops createUnit ["SoldierEB", (position player), [] ,0 ,"seargent"]
east3 moveInDriver para3


~5
_ang = _ang + 45
para4 = "ParachuteEast" createVehicle [0,0,0]
para4 setPos [(getPos logic select 0)+sin(_ang)*20,(getPos logic select 1)+cos(_ang)*20, getpos logic select 2]
east4 = _specops createUnit ["SoldierEB", (position player), [] ,0 ,"seargent"]
east4 moveInDriver para4


~5
_ang = _ang + 45
para5 = "ParachuteEast" createVehicle [0,0,0]
para5 setPos [(getPos logic select 0)+sin(_ang)*20,(getPos logic select 1)+cos(_ang)*20, getpos logic select 2]
east5 = _specops createUnit ["SoldierEB", (position player), [] ,0 ,"seargent"]
east5 moveInDriver para5


~5
_ang = _ang + 45
para6 = "ParachuteEast" createVehicle [0,0,0]
para6 setPos [(getPos logic select 0)+sin(_ang)*20,(getPos logic select 1)+cos(_ang)*20, getpos logic select 2]
east6 = _specops createUnit ["SoldierEB", (position player), [] ,0 ,"seargent"]
east6 moveInDriver para6


~5
_ang = _ang + 45
para7 = "ParachuteEast" createVehicle [0,0,0]
para7 setPos [(getPos logic select 0)+sin(_ang)*20,(getPos logic select 1)+cos(_ang)*20, getpos logic select 2]
east7 = _specops createUnit ["SoldierEB", (position player), [] ,0 ,"seargent"]
east7 moveInDriver para7


~5
_ang = _ang + 45
para8 = "ParachuteEast" createVehicle [0,0,0]
para8 setPos [(getPos logic select 0)+sin(_ang)*20,(getPos logic select 1)+cos(_ang)*20, getpos logic select 2]
east8 = _specops createUnit ["SoldierEB", (position player), [] ,0 ,"seargent"]
east8 moveInDriver para8


~5
_ang = _ang + 45
para9 = "ParachuteEast" createVehicle [0,0,0]
para9 setPos [(getPos logic select 0)+sin(_ang)*20,(getPos logic select 1)+cos(_ang)*20, getpos logic select 2]
east9 = _specops createUnit ["SoldierEB", (position player), [] ,0 ,"seargent"]
~0.1
east9 moveInDriver para9

exit

Nearer the end of fallback.sqs.. another script start's.. i made this so that it checks the vehicle's individually so they dont rely on one piece of code to make them all leave at the same time.. i wanted idividuality.

trucktobase.sqs
Code: [Select]
; *******************************************************
; ** BacktoBase *****************************************
; *******************************************************

_grp = _this select 0
_veh = _this select 1
_pos = _this select 2

(?!(alive _grp) : goto "truckmove")
(?!(alive _veh) : goto "unitmove")
goto "getin"


#truckmove
_veh sideChat "Looks like there is no one to take back to the base, out"

_veh move (getPos _pos)
@(unitReady units _veh)

exit

#unitmove
_grp sideChat "Looks like WE have to make our own way to the base, Out"

_grp move (getPos _pos)
@(unitReady units _grp)

exit


#getin
_grp move (getPos _veh)

@(unitReady units _grp)
_veh sideChat "We're ready, Out"
({_x assignAsCargo _veh}forEach units _grp)

~1

([_grp]allowGetIn true)
@(unitReady units _grp)

_veh move (getPos _pos)
@(unitReady units _veh)

exit

The problem here.. ARGHHHH ARRGGHHH lool it's this line

Code: [Select]
_veh = _this select 1
ERROR ZERO DIVISOR.. WTF????

Hope someone can really help. Cheers



« Last Edit: 23 Jun 2007, 23:23:26 by BozBog »

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: Go and Defend Script... dont work!
« Reply #37 on: 24 Jun 2007, 01:41:55 »
Code: [Select]
(?!(alive _grp) : goto "truckmove")
(?!(alive _veh) : goto "unitmove")

 :blink: :blink: :blink: :blink:

_grp is a group?
If so
Code: [Select]
? ({alive _x} count units _grp) == 0: goto "truckmove"
? !(alive _veh) : goto "unitmove"

Offline BozBog

  • Members
  • *
Re: Go and Defend Script... dont work!
« Reply #38 on: 24 Jun 2007, 02:04:38 »
Ahh lol that helped a bit lol it didnt seem to work, so i deleted it hehe, it's been replaced now.. about
Code: [Select]
_veh = _this select 1 what does the error Zero Divisor mean?

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: Go and Defend Script... dont work!
« Reply #39 on: 24 Jun 2007, 02:19:58 »
May be you are executing that script with less than three parameters. Look how do you execute that back to base script.

Offline BozBog

  • Members
  • *
Re: Go and Defend Script... dont work!
« Reply #40 on: 24 Jun 2007, 02:56:17 »
Code: [Select]
([grp4,truck1,baselog1]exec "trucktobase.sqs")
~0.1
([grp5,truck2,baselog2]exec "trucktobase.sqs")
~0.1
([grp6,truck3,baselog3]exec "trucktobase.sqs")
~0.1
([grp7,truck4,baselog4]exec "trucktobase.sqs")

Lol im using all 3 parameters.. maybe something has changed in the patch or summin... but then it couldnt cos it works elsewhere.. weird.

Offline BozBog

  • Members
  • *
Re: Go and Defend Script... dont work!
« Reply #41 on: 24 Jun 2007, 15:33:16 »
I know why this isnt working.. because none of the scripts are being executed.. wth! i put a radio check in the scripts i want executed.. but theyre not playing! guess that's the reason why... can someone give me a pointer on how to execute a script from within a script? cant seem to figure it out..

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: Go and Defend Script... dont work!
« Reply #42 on: 24 Jun 2007, 15:58:39 »
As you do, with exec for SQS and execVM for SQF. Anyway, why do you put ( ) there?

Offline BozBog

  • Members
  • *
Re: Go and Defend Script... dont work!
« Reply #43 on: 24 Jun 2007, 16:16:37 »
Because either way i do it.. none of the scripts execute.. ever.. this is getting weirder and weirder.. and annoying too.. maybe there's a bug in the commands?

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: Go and Defend Script... dont work!
« Reply #44 on: 24 Jun 2007, 16:48:36 »
Check where you execute all the scripts and the conditions that should be met (any if, ? or @ before the execs)