Home   Help Search Login Register  

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

0 Members and 1 Guest are viewing this topic.

Offline BozBog

  • Members
  • *
Go and Defend Script... dont work!
« on: 17 Jun 2007, 00:52:32 »
Hi there people, new here. Just wondering if u pro's can help wit this
script for ArmA.. dont seem to work for me..

Basically, these guys are on patrol round a city.. fair enough, this is
all done Via waypoints.. but i have 200+ enemy units coming on the
way to them, and i dont wanna fill the map with waypoints i cant see..
so i thought about using scripts to make the way points, problem is..
they dont seem to work.

Here

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

playsound "alarm"
~20
Officer sideChat "Theyre' here! Everyone up the front line and defend!."
~10
Officer sideChat "Do not let them pass the fortresses otherwise we will have to retreat!"
~5

deletewaypoint [grp4, 2]
deletewaypoint [grp5, 2]
deletewaypoint [grp6, 2]
deletewaypoint [grp7, 2]
deletewaypoint [grp8, 4]
~0.1
deletewaypoint [grp4, 1]
deletewaypoint [grp5, 1]
deletewaypoint [grp6, 1]
deletewaypoint [grp7, 1]
deletewaypoint [grp8, 3]
~0.1
deletewaypoint [grp4, 0]
deletewaypoint [grp5, 0]
deletewaypoint [grp6, 0]
deletewaypoint [grp7, 0]
deletewaypoint [grp8, 2]
~0.1
deletewaypoint [grp8, 1]
~0.1
deletewaypoint [grp8, 0]

~10
grp4 addWaypoint [position ammob, 5]
grp5 addWaypoint [position ammob, 5]
grp6 addWaypoint [position ammob, 5]
grp7 addWaypoint [position ammob, 5]
grp8 addWaypoint [position ammob, 5]

~10
Officer sideChat "Ok, everyone in position? Good. Now try your best not to let them through!"
~10
Officer sideChat "There have been report's via satelite that there are more than 200 unit's on their way"
~10
Officer sideChat "Good luck, out"

"ammob" is the ammo crate the groups (grp4,grp5,grp6,grp7,grp8) need's to go too.. i cant find any other
way of making the group go to a position without having object. All the grp's have a cycle at waypoint
number 2 except grp8 (tanks) their cycle waypoint is at number 4. Basically i wanna stop this cycle so they
move to "ammob" and defend the position.

I will also create another script where the remaining live unit's will fall back and go to the base to protect that..
where the enemy is heading.. any suggestion on this? or will the addwaypoint work once the enemy has pass
into the town (the fallback is scripted too)

I hope someone can help, i did read the commands in the WIKI.. but they dont fully explain everything clearly,
and other possible ways to use a command.

I am open for critiscm or woteva u wanna give me.. maybe other ways of making this script without much hard
work. Thxs for help

Offline LeeHunt

  • Former Staff
  • ****
  • John 21:25
Re: Go and Defend Script... dont work!
« Reply #1 on: 17 Jun 2007, 05:19:59 »
It's possible to use "domove" instead of controlling their waypoints.  Create a marker at the ammo crate "MarkerAmmo" and then in your script:

{_x domove (getmarkerpos "MarkerAmmo")} foreach units grp1

{_x domove (getmarkerpos "MarkerAmmo")} foreach units grp2

{_x domove (getmarkerpos "MarkerAmmo")} foreach units grp3

etc etc

you could also

{_x setbehaviour "Combat"} foreach units grp1

and what not to get them into combat mode.

Offline BozBog

  • Members
  • *
Re: Go and Defend Script... dont work!
« Reply #2 on: 17 Jun 2007, 10:26:40 »
Thxs matey, ill be sure to give that a try.. just hope it stops them going to their waypoints after that. :)

Offline BozBog

  • Members
  • *
Re: Go and Defend Script... dont work!
« Reply #3 on: 17 Jun 2007, 11:45:33 »
it does work.. though the unit's go back to their waypoints..

Thing is though i used CommandMove.. they both do work but none of them stops waypoints?
I hope someone can help with my waypoint problem.. otherwise i gonna have to script all the patrols..

edit: oops soz bout that.. i forgot to modify my other post.. my bad

this is wot script looks like atm

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

playsound "alarm"
~20
Officer sideChat "Theyre' here! Everyone up the front line and defend!."
~10
Officer sideChat "Do not let them pass the fortresses otherwise we will have to retreat!"
~5

deletewaypoint [grp4, 2]
deletewaypoint [grp5, 2]
deletewaypoint [grp6, 2]
deletewaypoint [grp7, 2]
deletewaypoint [grp8, 4]
~0.1
deletewaypoint [grp4, 1]
deletewaypoint [grp5, 1]
deletewaypoint [grp6, 1]
deletewaypoint [grp7, 1]
deletewaypoint [grp8, 3]
~0.1
deletewaypoint [grp4, 0]
deletewaypoint [grp5, 0]
deletewaypoint [grp6, 0]
deletewaypoint [grp7, 0]
deletewaypoint [grp8, 2]
~0.1
deletewaypoint [grp8, 1]
~0.1
deletewaypoint [grp8, 0]

~10

{_x commandmove (getmarkerpos "Defend")} foreach units grp4
{_x setbehaviour "Combat"} foreach units grp4

{_x commandmove (getmarkerpos "Defend")} foreach units grp5
{_x setbehaviour "Combat"} foreach units grp5

{_x commandmove (getmarkerpos "Defend")} foreach units grp6
{_x setbehaviour "Combat"} foreach units grp6

{_x commandmove (getmarkerpos "Defend")} foreach units grp7
{_x setbehaviour "Combat"} foreach units grp7

{_x commandmove (getmarkerpos "Defend")} foreach units grp7
{_x setbehaviour "Combat"} foreach units grp8

~10
Officer sideChat "Ok, everyone going in to position? Good. Now try your best not to let them through!"
~10
Officer sideChat "There have been report's via satelite that there are more than 200 unit's on their way"
~10
Officer sideChat "Good luck, out"
« Last Edit: 17 Jun 2007, 11:55:43 by BozBog »

Offline Cheetah

  • Former Staff
  • ****
Re: Go and Defend Script... dont work!
« Reply #4 on: 17 Jun 2007, 15:11:42 »
Might be worth checking out Kronzky's Urban Patrol Script.

Noticed that we don't have the script here at OFPEC in the Ed. Depot.
Like missions? Help with Beta Testing! or take a look at the OFPEC Missions Depot for reviewed missions!

Offline BozBog

  • Members
  • *
Re: Go and Defend Script... dont work!
« Reply #5 on: 17 Jun 2007, 15:26:47 »
Yeh that script is good.. but is there a way to turn it off so the groups can go to the base if the enemy passes a trigger? basically the patrol groups are fleeing and returning to base and staying there to fight.

Soz, im noob :/ :)

Offline BozBog

  • Members
  • *
Re: Go and Defend Script... dont work!
« Reply #6 on: 18 Jun 2007, 12:07:08 »
Bump lol not a very popular forum for ArmA people but then i mite be totally wrong about that comments.. people do have a life.. so im not offending any1 here.

I just hoping someone can just give me a quick pointer/tips on how to do this and i'll take a shot at it myself.

cya

Offline bedges

  • Administrator
  • *****
    • OFPEC The Editing Center
Re: Go and Defend Script... dont work!
« Reply #7 on: 18 Jun 2007, 14:20:36 »
no reply in less than 24 hours does not warrant bumping a thread - the minimum time is 3 days.

you have to understand that yours is not a simple question - you're basically asking someone to fix your problem for you, without having all the details in front of them. with editors busy on their own projects it's not surprising that you're getting such a weak response.

my own advice would be along the lines of what cheetah has already suggested: take kronzky's script apart, try to see what it's doing and work it out from there.
« Last Edit: 18 Jun 2007, 15:32:37 by bedges »

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: Go and Defend Script... dont work!
« Reply #8 on: 18 Jun 2007, 15:02:31 »
Do not delete any waypoint, just lock them with group LockWp true.
Then move your groups with move command, not doMove.

group move position.

Dont move all the groups to the same marker position, if the groups have many units it will be a total mess and some units will be interfering the aiming of some others. You may place as many markers as groups, make each group to move to its corresponding marker and then also set the heading formation of the group so each group heads towards the defending position from its current position.

group setFormDir heading

To check that everyone is ready use the following after the last move command.
~5
@(unitReady leader grp4)&&(unitReady leader grp5)&&(unitReady leader grp6) ...

~10
Officer sideChat "Ok, everyone going in to position? Good. Now try your best not to let them through!"
~10
Officer sideChat "There have been report's via satelite that there are more than 200 unit's on their way"
~10
Officer sideChat "Good luck, out"

Offline BozBog

  • Members
  • *
Re: Go and Defend Script... dont work!
« Reply #9 on: 18 Jun 2007, 19:59:05 »
Hey bedge's sorry bout that.. other forums hav different rules.. i guess i misread some of the rules on here.. my bad (but yeh i did read em, not fully tho cos i thought they were same as other forums) soz! Wont do that again!!

Hey mandoble.. that works! thanxs man, u did it for me.. and by the sound of it.. you did it again! (helpin sum1 fix probs) guess ur the soul of arma.

Thxs dude's for all the help, i guess i can lock the topic now.. and let it RIP or help sum1 else :).

cya!

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: Go and Defend Script... dont work!
« Reply #10 on: 18 Jun 2007, 20:20:46 »
I forgot something
You need to detect when the danger situation is gone, with a trigger or whatever else setting some global var to true and after that unlock the WPs of all your groups so they resume their planed waypoints:


;AT THE END OF YOUR SCRIPT
Code: [Select]
@danger_is_gone

?allive Officer: Officer sideChat "Enemy has been defeated"
{_x lockWp false} forEach [grp4, grp5, .... ]

Offline CrashDome

  • Members
  • *
Re: Go and Defend Script... dont work!
« Reply #11 on: 18 Jun 2007, 21:40:50 »
Couldn't he simply create a waypoint cycle with a switch?

Create your 5 waypoints with the last being CYCLE type.
Create a 6th waypoint at the ammobox.
Create a trigger of type SWITCH and make your condition whatever condition launches that script of yours.
   You can also launch the script for the text displayed or use the EFFECTs button.
Syncronize the trigger with the 5th waypoint

No deleteing waypoints, adding them, locking them, etc...

[EDIT] The 5th waypoint does not need to be of type CYCLE, but they will just stop and wait there. By making it cycle, they keep moving... unless of course you prefer them to stop at waypoint 5 and wait.
« Last Edit: 18 Jun 2007, 21:42:54 by CrashDome »

Offline BozBog

  • Members
  • *
Re: Go and Defend Script... dont work!
« Reply #12 on: 19 Jun 2007, 21:12:08 »
Hi im back again with some more problems.. Thnxs to crashdome and every1else, i managed to get it to work.. i realised that the unit's never moved because my cycle was not "Switched" to the next movement via the trigger.. thxs to crashdome :),
and Mandoble for is @unitisready sort of thing, and every1 else who tried to help.. now im having another problem.

Here's the same script, with lots of stuff removed.

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

playsound "alarm"
~20
Officer sideChat "Theyre' here! Everyone up the front line and defend!."
~10
Officer sideChat "Do not let them pass the fortresses otherwise we will have to retreat!"
~5
@(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 try your best not to let them through!"
~10
Officer sideChat "There have been report's via satelite that there are more than 200 unit's on their way"
~10
Officer sideChat "Good luck, out"
~5

(para = "ParachuteEast" createVehicle (position logic))
(para1 = "ParachuteEast" createVehicle (position logic))
(para2 = "ParachuteEast" createVehicle (position logic))
~0.01

(east = createAgent ["SoldierEB", position player,[],0,"FORM"])
(east1 = createAgent ["SoldierEB", position player,[],0,"FORM"])
(east2 = createAgent ["SoldierEB", position player,[],0,"FORM"])
~0.01

east moveInDriver para
east1 moveInDriver para1
east2 moveInDriver para2


exit
The problem im having is.. creating a paracute in the air. On the map, i have a gamelogic and i placed it hight with the "this setpos [(getpos this select 0),(getpos this select 1),+70] and i name it logic.. now on the script, i tried to create a parachute up there.. well, that part of the script works, though in game i cant see a parachute, and to create unit.. i used the wiki for this, copied the exact code and changed the word.. and it's saying error.. i tried this with createUnit command.. but realised i need a group to create the unit in.. so i decided to use the createAgent command (says to create single unit's) and i cant get any of it to work... it wont be created.. and i dont know how to name it so that it moveindriver para.

Hope someone can help :) cheers!

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: Go and Defend Script... dont work!
« Reply #13 on: 19 Jun 2007, 23:13:55 »
Parachutes seems to be always created at ground level, you need to setPos them. I added a bit of separation too so you dont have all the chutes messed up at the same spot in the space.
Code: [Select]
...
_ang = 0
para = "ParachuteEast" createVehicle [0,0,0]
para = setPos [(getPos logic select 0)+sin(_ang)*20,(getPos logic select 1)+cos(_ang)*20, getpos logic select 2]
east = createAgent ["SoldierEB", position player,[],0,"FORM"]
east moveInDriver para

_ang = _ang + 45
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 = createAgent ["SoldierEB", position player,[],0,"FORM"]
east1 moveInDriver para1

_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 = createAgent ["SoldierEB", position player,[],0,"FORM"]
east2 moveInDriver para2

Offline BozBog

  • Members
  • *
Re: Go and Defend Script... dont work!
« Reply #14 on: 20 Jun 2007, 19:11:54 »
Hey man, sorry to say.. the script doesnt work for some reason.. when i start the script it always comes up with an error for para2.. but para and para1 are not spawning too.. strange thing this. para2 error.. it says something about missing a ; which is weird..

here's the current script, i wanted to see if the error was for all three para's by add a time between their spawns, but it always jumps to para2.

Hope you can help :)

Code: [Select]
~5

_ang = 0
para = "ParachuteEast" createVehicle [0,0,0]
para = setPos [(getPos logic select 0)+sin(_ang)*20,(getPos logic select 1)+cos(_ang)*20, getpos logic select 2]
east = createAgent ["SoldierEB", position player,[],0,"FORM"]
east moveInDriver para


~10
_ang = _ang + 45
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 = createAgent ["SoldierEB", position player,[],0,"FORM"]
east1 moveInDriver para1


~10
_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 = createAgent ["SoldierEB", position player,[],0,"FORM"]
east2 moveInDriver para2


exit