Home   Help Search Login Register  

Author Topic: coc_boat (for group)  (Read 752 times)

0 Members and 1 Guest are viewing this topic.

coffee

  • Guest
coc_boat (for group)
« on: 31 Jan 2005, 13:58:10 »
As a player (coc_diver) you can board a boat out at sea, in the coc_boat test mission made by Blanco.

Refer to this page:
http://www.ofpec.com/yabbse/index.php?board=27;action=display;threadid=16685

But if you are a team of divers, how to make them get in as well? how to make/modify the scripts?

Grateful for help!

« Last Edit: 31 Jan 2005, 14:07:42 by coffee »

CopyrightPhilly

  • Guest
Re:coc_boat (for group)
« Reply #1 on: 31 Jan 2005, 19:25:25 »
not sure if this is what you are after

Code: [Select]
mygrp = group leadername; "_x moveincargo vehiclename" foreach units mygrp
leadername=name of the unit thats the leader of the group
vehiclename=name of the vehical that you want them to be moved into
« Last Edit: 31 Jan 2005, 19:27:41 by CopyrightPhilly »

coffee

  • Guest
Re:coc_boat (for group)
« Reply #2 on: 31 Jan 2005, 20:33:43 »
no luck on this one, but maybe i do it wrong(i'm a beginner with skripts). I have tried to set your command in a trigger and in the getin.sqs like this:

................................................................
mygrp = group he

; remove the action
vehicle player removeaction GETINBOAT
; disembark the COC_lar7SWM, the invisible COC_vehicle

player action ["eject",vehicle player]

@player == vehicle player && typeof vehicle player != "COC_lar7SWM"

; find the boat
_boat = nearestobject [player,shiptype]

; movein
player moveincargo _boat

"_x moveincargo boat1" foreach units mygrp

@(player in _boat)
[_boat] exec "COC_boat.sqs"
.........................................................

only me(leader) is boarding the boat with no error message and the others are still in the water.


Offline Blanco

  • Former Staff
  • ****
Re:coc_boat (for group)
« Reply #3 on: 31 Jan 2005, 21:57:26 »
The reason I made it only for the player is because AI COC_divers are not able to move in the water, they can float, but they can't swim.
So there is no way (I know about) to make this work for groups.
 
Search or search or search before you ask.

coffee

  • Guest
Re:coc_boat (for group)
« Reply #4 on: 01 Feb 2005, 12:01:00 »
Well, i seem to have found the solution to my problem now.  ;D
After some experiments with setpos and getpos i managed to end up with this script:

movein.sqs
.....................................................................
#START

; get in position

"_x setpos [getpos boat1 select 0, getpos ap select 1,4]"foreach units ap

~1

"_x setPos getPos boat1"foreach units ap

~1

; get in as cargo

"_x moveincargo boat1"foreach units ap

#END
.................................................................

boat1=name of boat
ap=name of player

There probably are some adjustments to be done to get it more fluid.
Feel free to give some advice!

Edited:
i have adjusted the script a little but there is more to be done i think. Sometimes one of the divers dosen't move in.
« Last Edit: 01 Feb 2005, 13:42:04 by coffee »

Offline Blanco

  • Former Staff
  • ****
Re:coc_boat (for group)
« Reply #5 on: 01 Feb 2005, 16:40:47 »
When a coc_diver is in th water, he's already in a vehicle. So when he has to board a boat , you have to eject him first.
I don't think you can moveincargo a unit from one vehicle into another without ejecting him first. That's why I did this :


Code: [Select]
....
player action ["eject",vehicle player]

@player == vehicle player && typeof vehicle player != "COC_lar7SWM"

; find the boat
_boat = nearestobject [player,shiptype]

; movein
player moveincargo _boat

Once the player disembarks he's can drown.
The wait until line (@) checks when he's out of the COC_lar7SWM vehicle, than I "moveincargo" him in the boat.

So I suggest to use the eject line and @ line on all units in the group. (via foreach maybe)...

 

 

« Last Edit: 01 Feb 2005, 16:44:07 by Blanco »
Search or search or search before you ask.

Offline The-Architect

  • Former Staff
  • ****
  • Bite my shiny metal...
    • Bob's Un-official Flashpoint Page
Re:coc_boat (for group)
« Reply #6 on: 04 Feb 2005, 03:18:20 »
Can't you write a short and simple script which setpos's the guys onto dry land somewhere safe and then setpos's them into the boat? All done lightning fast.
James Andrew Wilkinson 1977 - 2005 R.I.P.
"If it ain't the friggin' incoming it's the friggin' outgoing. Only difference is who gets the friggin' grease, and that ain't no friggin' difference at all."

Offline Blanco

  • Former Staff
  • ****
Re:coc_boat (for group)
« Reply #7 on: 04 Feb 2005, 04:14:43 »
Yes, that's possible, but you'll need a new argument for that position on land because it depends on the island.

Another problem would be, what if the boat has less cargoplaces then there are units in the group?
Is there a way to check how many cargoplaces there are in a vehicle?


Search or search or search before you ask.

coffee

  • Guest
Re:coc_boat (for group)
« Reply #8 on: 04 Feb 2005, 15:55:01 »
With this script:

................................................................
#START

; get in position
"_x setpos [getpos boat1 select 0, getpos ap select 1,4]"foreach units ap

~1

"_x setPos getPos boat1"foreach units player

player action ["eject",vehicle player]

@player == vehicle player && typeof vehicle player != "COC_lar7SWM"

; get in as cargo
"_x moveincargo boat1"foreach units player

#END
......................................................................

- if i understand this right, the units is set to position 4 meters above the boat before movein. Is it the same or different with a setpos somewhere on land? my idea was to get the units out of the water first somehow, and then the game counts them as they were on land?. Anyway it works. Can it be so because the units no longer are counted as a vehicle(in coc_lar7)when they are above the water for the moment? anyway it works even if it they sort of "dropping" into the boat.

By the way,  how can i get these two lines:

player action ["eject",vehicle player]
@player == vehicle player && typeof vehicle player != "COC_lar7SWM"

- to be active for all of the team instead for just the player?

Offline Blanco

  • Former Staff
  • ****
Re:coc_boat (for group)
« Reply #9 on: 04 Feb 2005, 18:18:34 »
Quote
Can it be so because the units no longer are counted as a vehicle(in coc_lar7)when they are above the water for the moment?


Yes, the coc_lar7 is deleted when the player steps out of the water


Code: [Select]
"_x setpos [getpos boat1 select 0, getpos ap select 1,4]"foreach units ap
this should be

Code: [Select]
"_x setpos [getpos boat1 select 0, getpos boat1 select 1,4]"foreach units apBy the way,  how can i get these two lines:

Quote
player action ["eject",vehicle player]
@player == vehicle player && typeof vehicle player != "COC_lar7SWM"

- to be active for all of the team instead for just the player?


You can check every unit in the group, put all AI units in a array and run a other script (or intergrate it in the same script) with every element in that aray

something like this :

Code: [Select]
_grp = group player
_c = count units _grp

player action ["eject",vehicle player]
@player == vehicle player && typeof vehicle player != "COC_lar7SWM"

if (_c > 0) then {goto "isgroup"} else {exit}


#isgroup
_AI_array = []
_i = 0

#AI_or_player

_unit = units _grp select _i
?_unit != player && alive _unit : _AI_array = _AI_array + [_unit]
_i = _i + 1
?_i < _c : goto "AI_or_player"

_i = 0
#eject
_unit = _AI_array select _i

_unit action ["eject",vehicle _unit]
@_unit == vehicle _unit && typeof vehicle _unit != "COC_lar7SWM"
_AI_array = _AI_array - [_unit]
~0.5
_i = _i + 1
?_i < count _AI_array : goto "eject"

exit

Not tested tho...

But is this for MP?
If not... how do you make AI follow you in the water?











« Last Edit: 05 Feb 2005, 00:45:10 by Blanco »
Search or search or search before you ask.

coffee

  • Guest
Re:coc_boat (for group)
« Reply #10 on: 05 Feb 2005, 10:08:00 »
I got a diver test mission(CoCsabotage) made by the CoC team that i use as a start point. It's a "aihelper" script in there that help the divers follow you.

link: http://www.downloads.thechainofcommand.net/missions.htm

B.T.W thanks for your input!

Offline Blanco

  • Former Staff
  • ****
Re:coc_boat (for group)
« Reply #11 on: 05 Feb 2005, 14:03:31 »
wow, cool script! I didn't know that  :)
They follow you really good.
It's done via setvelocity, clever.

Only one small problem : sometimes they don't jump into the water again when they are on shore,
It needs some time before they do it.



Search or search or search before you ask.