Home   Help Search Login Register  

Author Topic: Newly Revised Rapple script  (Read 13988 times)

0 Members and 2 Guests are viewing this topic.

Iwesshome

  • Guest
Re:Newly Revised Rapple script
« Reply #15 on: 07 Mar 2003, 13:55:08 »
Took a look at the your demo mission and totally like the design.... I was wondering as some other have stated how would you go about speeding up the descent or possibly have them coming down right after each other maybe with a 2 to 3 sec pause in between?

I have only seen one other rappel script and it looked so choppy so great work on what you did. Have you tried this script on any other choppers?

IW

Offline Delta Hawk

  • Members
  • *
  • I'm a llama!
Re:Newly Revised Rapple script
« Reply #16 on: 07 Mar 2003, 23:50:07 »
Hi,
i have no idea about scripting and all that crap...but GASH's rope looks a little too clean :-\

I know, that sounds stupid! :o But soldiers go down those rope, causing friction and between the dust, sweat, skin, dirt and such, shoulded the rope be alot more dark brown? Little on BHD?  ???  It's just an idea, i mean if you think about it...it's not like soldiers would spend hours trying to clean them, i wouldn't. Correct me if i'm wrong  :-\ maybe some soldier would TRY to clean them.

Offline Zayfod

  • ECP Team
  • *
  • Llama, softest natural fibre in the world.
Re:Newly Revised Rapple script
« Reply #17 on: 11 Mar 2003, 08:14:06 »
*****************UPDATE**************

Hi all  ;D

well this script has taken on a life of its own lately and boy its has it grown.

I see a few comments which has been great so--- "wipes sweat from brow"---here goes.

Quote
Each of them is screaming like hell and to be honest, I prefer the version where they dont slow down at the end (at least not so much).


I agree--solved



Quote
I was wondering as some other have stated how would you go about speeding up the descent or possibly have them coming down right after each other maybe with a 2 to 3 sec pause in between?

I agree--solved

Quote
...but GASH's rope looks a little too clean

I agree and its too fat--Nothing I can do Im not a model maker. In saying this I mean no disrespect to Gash at all. Its thanks to him\her that we have a rope at all.


Quote
...and dey didnt scream 4 me

ROFL @ LCD


Quote
but u need 2 change it lil cuz en i shot em dey dont die  

I agree--solved


OK so whats new? HEAPS!  ;D

They say u gotta go backwards in order to go forwards sometimes and the removal of the eventhandlers was one of these backwards steps Ive made.


#1: you can kill them as they rappel. They die, gain speed from the point where they were killed, and topple when they hit the ground.

#2: There have been reports of them letting out a yell "argh " every now and then--this has been solved cause I no longer use eventhandlers to ensure their health.

#3:Have been reports of them every now and then slowing down too much just b4 they hit the ground --this has been solved.

#4:I have spoken to New Zealand Army at length about the protocol of rappeling. Long and short of it is that when only one rope is involved they will INFACT allow 2 up to maximum 3 "they said" guys on the rope at any one time.----this has now been implemented into the script.

#5. NZ army also said the first one down stays at the rope and holds it for the others and dosn't move till all are down-------Ive done this also. Once chopper moves out he rejoins the group.  ;D

If the rope holder gets killed then the next down the rope takes his position.

#6. Chopper now turns slowly while troops rappel. If the gunner engages a tango the chopper stops turning for a while (approx 3 secs)--chopper wont turn while gunner is firing.

#7:Gunner is seperated form chopper in script so while pilot is "careless" (so he dont fly away) on a hot LZ the gunner is "combat"

#8: chopper remains at LZ for a while after troops have landed to continue aircover as they do their sweep. Then continues on its waypoints.

#9: I have added the option of smoke. If map maker wants it theyll drop smoke before they rappel.  ;D

#10: I noticed in a HOT LZ the AI would hit the dirt and all would pile up in prone position at bottom of rope--this is now solved



#NOTE IMPORTANT
I have scripted an alternative method of keeping player and AI alive (its not using setdammage cause this is no good in MP)___ It is untested so I will be asking any and all to run the script AT LEAST 15 times and report any casualties ASAP. Make sure when u do these tests u dont have any tangos around lol --this may make it hard to see if they  died in fall or were shot. ;)

Also I have lowered the height of the chopper to the lowest before itll hit a tree 21M. Ant lower that 21 M and itll risk hitting trees. Why? NZ Army says most of the time they rappel from a height no more that 5-7M cause the longer your in the air more chance of being shot.


Now if we could figure a way for script to understand if its over trees, buildings, or flat land then it would be GREAT!!

The script is now executed like this for one group in a chopper with smoke:

["initialise", [groupname], choppername, 1] exec "rappel.sqs"

The script is now executed like this for one group in a chopper with out smoke:

["initialise", [groupname], choppername, 0] exec "rappel.sqs"

The script is now executed like this for multiple groups in a chopper with smoke:

["initialise", [groupname, group2name,group3name], choppername, 1] exec "rappel.sqs"

The script is now executed like this for multiple groups in a chopper with out smoke:

["initialise", [groupname, group2name,group3name], choppername, 0] exec "rappel.sqs"


PLZ download and test the new test map New Rappel V6

Code: [Select]
;*******************************************************************************************
; rappel v6.sqs                                                                            *
; Original:                                                                                *
; By Zayfod. Strongly influenced and built on top of oneRapple.sqs By Xcess and Gastovski  *
; modified by AliMag and then again by Zayfod =) thanks AliMag!!. - 03/2003                *                                                             ;                                                                                          *                                                                        
;*******************************************************************************************


;goto appropriate part of script
   goto (_this select 0)

#initialise
   _groups = _this select 1
   _helo = _this select 2
   _smokeon_off = _this select 3

#check_smoke
   ? (_smokeon_off == 1):   _smoker = true
   ? (_smokeon_off == 0):   _smoker = false

#isolate_helo_gunner
   _helocrew = crew _helo
   _pilot = _helocrew select 0
   _gunner = _helocrew select 1
   [_gunner] join grpnull
   _gunners = []
   _gunners = _gunners + [_gunner]
   _helogunner = _gunners select 0

#local_variables
   _k = 0.5
   _helo_ammo = _helo ammo "Browning"

#groups_to_rappel
   _aunits = []
   "_aunits = _aunits + (units _x)" forEach _groups
   _i = 0
   _j = count _aunits

#rope_setup
   ? (count rappelRope) == 2 : goto "stop"
   rappelRope = [["rappel.sqs", "rope.sqs"], []]

#stop
   _helobehaviour = behaviour _helo
   _helo setbehaviour "careless"
   _helogunner setbehaviour "combat"
   _helogunner setcombatmode "red"
   _helogunner disableai "autotarget"
   _helo flyinheight 21
   dostop _helo

#chopheight
   _height = getpos _helo select 2
   ? _height < 22 : goto "rope"
   ~0.1
   goto "chopheight"

#rope
   rappelRope set [1, (rappelRope select 1) + [_helo]]
   _helo exec "rope.sqs"

#speed_check
   _xvel = velocity _helo select 0
   _yvel = velocity _helo select 1
   _zvel = velocity _helo select 2
   ?_xvel > 0.2 : _helo setvelocity [_xvel - 0.1,_yvel,_zvel]
   ?_yvel > 0.2 : _helo setvelocity [_xvel,_yvel - 0.1,_zvel]
   ?_xvel < -0.2 : _helo setvelocity [_xvel + 0.1,_yvel,_zvel]
   ?_yvel < -0.2 : _helo setvelocity [_xvel,_yvel + 0.1,_zvel]
   ? _xvel > -0.2 and _xvel < 0.2 and _yvel > -0.2 and _yvel < 0.2 : goto "start"
   ~0.01
   goto "speed_check"

#Start
   _posx = getpos _helo select 0
   _posy = getpos _helo select 1
   _posz = getpos _helo select 2
   ? (_smoker):_smokedrop = "smokeshellred" createvehicle [_posx, _posy, _posz]
   _count = 0

#dropping
   _rappeler = (_aunits select _i)
   ? not (alive _rappeler): _I = _I + 1; goto "check_j"
   _rappeler action ["getout",_helo]
   unAssignVehicle _rappeler
   ["rappel",[],_helo,_rappeler] exec "rappel.sqs"
   _chopdir = getdir _helo


#drop_wait
   ?not (alive _helo): goto "next"
   _count = _count +1
   ?_count > 300: _helo_ammo = _helo ammo "Browning"; _k = 0.5; _count = 0
   _helo setdir _chopdir
   _chopdir = _chopdir + _k
   ? (_helo ammo "Browning") < _helo_ammo: _k = 0
   _rappeler_height = getpos _rappeler select 2
   ? _rappeler_height < 10 or not (alive _rappeler): goto "next_rappeler"
   ? not (alive _rope_holder): _rope_holder = _rappeler
   ~0.01
   goto "drop_wait"

#next_rappeler
   ?_I == 0: _rope_holder = _rappeler
   dostop _rope_holder
   _rope_holder setunitpos "down"
   _I = _I + 1

#check_j
   ? _j > _i : goto"dropping"
   ~1
   ? _i == _j : goto"helo_wait"

#helo_wait
   _rappeler_height = getpos _rappeler select 2
   ? _rappeler_height <= 0.5 or not (alive _rappeler): goto "helo_cover"
   ~0.1
   goto "helo_wait"

#helo_cover
   _chopdir = getdir _helo
   _count = 0
   _count2 = 0

#helo_cover_check
   ?not (alive _helo) or not (alive _pilot): goto "next"
   _count = _count +1
   _count2 = _count2 +1
   ?_count > 300: _helo_ammo = _helo ammo "Browning"; _k = 0.5; _count = 0
   ?_count2 > 1000: goto "next"
   _helo setdir _chopdir
 Â Â Â _chopdir = _chopdir + _k
   ? (_helo ammo "Browning") < _helo_ammo: _k = 0
   ~0.01
   goto "helo_cover_check"

#next
   _helo domove (getpos _helo)
   _helo flyinheight 100
   ~3
   rappelRope set [1, (rappelRope select 1) - [_helo]]
   _helo setbehaviour _helobehaviour
   _rope_holder domove (getpos _rope_holder)
   _rope_holder setunitpos "auto"
   exit

#rappel
   _helo = _this select 2
   _man = _this select 3
   _weapon = primaryweapon _man
   _chopdir = getdir _helo
   _mendir = _chopdir + 90
   _posrandomdir = (random 3) + 2
   _negrandomdir = 0 - ((random 3) + 2)
   _neg_and_pos_array = [_posrandomdir, _negrandomdir]
   _random = random (count _neg_and_pos_array)
   _random = _random - _random % 1
   _randomdir = _neg_and_pos_array select _random
   _man setdir _mendir
   _behave = behaviour _man
   _man setbehaviour"AWARE"
   _posx = getpos _helo select 0
   _posy = getpos _helo select 1
   _posz = getpos _helo select 2
   _drop = (random 0.2) + 0.3
   _posz = _posz - 1
   _man setpos[_posx, _posy, _posz]
   _changedir = _mendir
   _dropcheck = 0.01

#loop
   _man moveincargo _helo
   _man action["getout",_helo]
   unassignvehicle _man
   _posx = getpos _helo select 0
   _posy = getpos _helo select 1
   _posz = _posz - (0 + _dropcheck)
   _dropcheck = _dropcheck + 0.02
   ?_dropcheck >= _drop: _dropcheck = _drop
 Â Â Â _man setdir _changedir
   _changedir = _changedir - _randomdir
   _man setpos [_posx, _posy, _posz]
   _man switchmove "fxfromtable"
   ?not (alive _man):goto "dead_loop"
   ~ 0.001
   ? _posz > 5 : goto "loop"

#loop2
   _man moveincargo _helo
   _man action["getout",_helo]
   unassignvehicle _man
   _man switchmove "fxfromtable"
   _posx = getpos _helo select 0
   _posy = getpos _helo select 1
   _posz = _posz - _drop
   _drop = _drop - 0.01
   ?_drop <= 0.2: _drop = 0.21
 Â Â Â _man setdir _changedir
   _changedir = _changedir - _randomdir
   _man setpos [_posx, _posy, _posz]
   ?not (alive _man):goto "dead_loop2"
   ~ 0.001
   ? _posz > 0.2 : goto "loop2"

#clear
   _mendir = getdir _man
   _man moveincargo _helo
   _man action["getout",_helo]
   unassignvehicle _man
   _man switchmove "combattocrouch"
   _man setdir _mendir
   _man setpos [_posx,_posy,0]
   _man Setbehaviour "aware"
   _man playmove "combatrunf"
   exit

#dead_loop
   _posx = getpos _helo select 0
   _posy = getpos _helo select 1
   _posz = _posz - (0 + _dropcheck)
   _dropcheck = _dropcheck + 0.02
   _man switchmove "fxfromtable"
 Â Â Â _man setdir _changedir
   _changedir = _changedir - _randomdir
   _man setpos [_posx, _posy, _posz]
   ~ 0.001
   ? _posz > 0.5 : goto "dead_loop"
   _man removeweapon _weapon
   _man switchmove "crouch"
   ~1
   _man addweapon _weapon
   exit

#dead_loop2
   _man switchmove "fxfromtable"
   _posx = getpos _helo select 0
   _posy = getpos _helo select 1
   _posz = _posz - _drop
   _drop = _drop + 0.02
 Â Â Â _man setdir _changedir
   _changedir = _changedir - _randomdir
   _man setpos [_posx, _posy, _posz]
   ~ 0.001
   ? _posz > 0.5 : goto "dead_loop2"
   _man removeweapon _weapon
   _man switchmove "crouch"
   ~1
   _man addweapon _weapon
   exit







Zay out.  :wave:
« Last Edit: 11 Mar 2003, 10:25:30 by Zayfod »
"I have come here to kick ass and chew bubble gum......an I'm all outta bubble gum!"

Ace

  • Guest
Re:Newly Revised Rapple script
« Reply #18 on: 11 Mar 2003, 09:06:16 »
u could shut them up by recording a blank .ogg file and have them say it as each 1 rappels.

Becasue I believe soldiers won't amke ay other sound when they are talking.

Offline Zayfod

  • ECP Team
  • *
  • Llama, softest natural fibre in the world.
Re:Newly Revised Rapple script
« Reply #19 on: 11 Mar 2003, 09:19:21 »
thats a good point Ace and its one I had considered but I didnt want the mapmaker to have to add any .ogg files.

I did try and make the AI say stuff just at the point they were dammaged (which BTW was hard to calculate since descent speed is  random) and they still went "argh" (in V4)  and said the comment also--any way I am hoping this is a null issue.


Anyways
 :thumbsup:
I  its solved in V6

Cheers ;D

Zay out
"I have come here to kick ass and chew bubble gum......an I'm all outta bubble gum!"

Offline snYpir

  • BIS Team
  • ****
  • OFPEC Jedi Master
    • OFPEC
Re:Newly Revised Rapple script
« Reply #20 on: 11 Mar 2003, 10:49:26 »
It looks cool, and i will test it tomorrow. The main issue I have is MP - basically, each client needs to do the switchmove command or else it just looks like the unit is standing all the way down.

Also, in the old version, if the player was a client, he would die every rappel. I almost got around this by running the rappel part of the script on the client machines instead of the server (the server simply stops the chopper and creates the rope).

This new version looks promising, and I will report back tomorrow. Thanks!
Bohemia Interactive Simulations

Offline Zayfod

  • ECP Team
  • *
  • Llama, softest natural fibre in the world.
Re:Newly Revised Rapple script
« Reply #21 on: 11 Mar 2003, 11:02:16 »
Most excellent--I have no way of testing MP without a major pain in the arse.  ;D

Zay out
"I have come here to kick ass and chew bubble gum......an I'm all outta bubble gum!"

Offline snYpir

  • BIS Team
  • ****
  • OFPEC Jedi Master
    • OFPEC
MP results
« Reply #22 on: 13 Mar 2003, 21:48:03 »
Ok, I tested your script on a dedicated server with two clients. Both clients were in the same group, in the chopper.

In SP, everything worked perfectly, with the correct seperation between rappellers.

However, in MP, there were problems. Although neither player died, there was no seperation between the units as they dropped and no switchmoves.

I think the chopper is 'local' to the dedicated server, and the actual units (and maybe groups) are 'local' to the clients.

This means that the server can't reliably do the setpos or switchmove to the clients, causing the complete screw up of the script in MP.

How to fix this? Serious coding. Here is how the script will have to work:

  • Server moves the chopper into position and 'drops' the rope
  • Server says 'go' and then the rest of the rappel script is run on all computers


I don't know if this will work, I ran out of time to test it yesterday. I'll have another go at it this morning and get back to you. :P
Bohemia Interactive Simulations

Offline Dinger

  • Contributing Member
  • **
  • where's the ultra-theoretical mega-scripting forum
Re:Newly Revised Rapple script
« Reply #23 on: 13 Mar 2003, 22:40:33 »
zayfod -- mp testing is easy:
You can run several instances of OFP on the same machine and alt-tab between them. You'll get a "FADE" warning, but it'll work fine.

As for the problem here:
I'm pretty sure that vehicles are local to the client to whom the driver is local.  Groups are local to the client to whom the leader is the player.
I think that's how it works.

A few other things:
server can't just say "Go", it has to say which helo to go.  and the order to start rappelling should be accessible from all clients.
I'd do it with something like:
ZayRappGo = MyHelo
PublicVariable "ZayRappGo"
then have a monitor script that looks for a change in ZayRappGo.  When there is a change, it goes to that unit:
_helo = ZayRappGo
_crew = crew _helo
_pax = (_Crew - [driver _helo]) - [gunner _helo]
~2
;that allows for synching between clients

Then each script counts off the wait time for each passenger, and checks if the passenger is local to the machine. if it is, it sends it out.

separation will never be glorious, but you might get it looking "ok"
Dinger/Cfit

Offline Zayfod

  • ECP Team
  • *
  • Llama, softest natural fibre in the world.
Re:Newly Revised Rapple script
« Reply #24 on: 14 Mar 2003, 01:06:56 »

***snYpir***
Thanks for the report snYpir  :) look forward to your further results.  Does this mean we need 2 versions of the script? One for server and one for client?


***dinger***
Thanks for awesome feed back dinger :) tho its a lil over my head.

Well when it comes to this kinda stuff both u guys are light years ahead of me --MP syncing and clients talking to servers b4 then can exec a script is all "Greek" to me at this stage of the game. Im a learner.

I am just flattered and happy that both u guys have shown such an interest in the script. I REALLY want to solve the MP issue. It must be possible with out any of us having a stroke  ;D

Dinger i almost understand what u said.

I tried to run 2 instances Res on my puter but got the error:

Cannot memory-map file 'RES\addons\o.pbo'

I guess my puter aint got enuff grunt.



Like I said these MP issues are best left to the experts but.............. perhaps there would be a use for the global event handlers  "Getin" and "Getout" here? Just a thought.


One other thing  ;D

U may think Im nuts (and u may be right)
but Ive added YUP U GUESSED it "cough" more to the rappel script.

Ill post this as version 7 but not till I hear your MP outcome.

what Ive added:

#1. if pilot gets killed but chopper remains intact then I give the gunner 3 seconds to scramble for the controls and pull the chopper up from its death dive to save the rappelling guys--(note all the rappellers that are still in chopper halt their rappeling while this happens--probably busy sh*tting their pants  anyways )

once the gunner (now pilot) has regained control they continue to rappel. This espesh usefull in black hawks cause I noticed the pilot can get killed quite often but chopper still operational. It makes for quite a dramatic display. The gunner becomes a hero .

If this happens while a rappeller is half way down he contiues his descent and will survive.

#2 If pilot and gunner are dead  and chopper still operational it used to be that all would rappel out together and this would cause big frame rate drop. Ive solved this so all the guys assumme the position (head between legs to kiss your arse goodbye) then once chopper has crashed and if they still alive they leap out one at a time --into the fray. quite quickly. -- they dont all sit there expecting to rappel from zero feet. lol

Zay out




Zay out.

« Last Edit: 14 Mar 2003, 01:24:26 by Zayfod »
"I have come here to kick ass and chew bubble gum......an I'm all outta bubble gum!"

Offline snYpir

  • BIS Team
  • ****
  • OFPEC Jedi Master
    • OFPEC
Re:Newly Revised Rapple script
« Reply #25 on: 14 Mar 2003, 05:50:00 »
Not suprisingly Dinger is correct. Clients are local to their own computer, as well as other members of their group.

In this instance, you have a chopper (local to the server - AI driven), with occupants that are (in many instances) not local to the server - ie players on other computers.

In V6 you move the unit in and out of the chopper to keep him alive - this works in SP because it happens instantaneously. In MP, however, the chopper is on a different computer - the move back into the chopper goes all the way back to the server, and it therefore does not happen instantaneously.

The good new is, however, that in OFP there is a workaround for everything.

You are going to need more scripts, however. I recommend the following:

  • rappel_monitor.sqs - runs on clients waiting for a message to activate from the server
  • rappel_client.sqs - also runs on clients, rappels a single unit, activiated by rappel_monitor.sqs


So, the server is running, right? When a rappel has to be done, this is what happens:

1. Rappel_monitor.sqs starts on all clients.

2. Rappel.sqs starts on server, and sets up the chopper (rappel.sqs should only ever start on the server)

3. Before sending each unit out, the server checks to see if the unit about to rappel is local. If it is local, the server takes over and runs the rappel as normal. If it is not local, it must be on a clients machine, so a public variable is sent equaling the unit that needs to rappel.

4. Rappel_monitor detects the public variable on the client, and starts rappel_client.sqs. Rappel_client rappels the client unit to the ground, and when it is near the ground, it informs the server via another public variable.

Now the rappel script relies on having a local chopper to move in and out of to prevent death, yeah? Because we can't use the chopper on the server (in rappel_client.sqs) we need to create a dummy chopper on the client to use instead.

I'll attach the MP compatible version after i run a few more tests, probaly in about an hour or so. ;D
Bohemia Interactive Simulations

Offline Zayfod

  • ECP Team
  • *
  • Llama, softest natural fibre in the world.
Re:Newly Revised Rapple script
« Reply #26 on: 14 Mar 2003, 06:16:50 »



 :o "Holy crappoler --Lord of the rings --time fer a toilet drink--whats that smell i hear?!!!"  :o



Thats complicated-- ???

SnYpir--our cyber bodies lay in your hands ;D

Zay out
"I have come here to kick ass and chew bubble gum......an I'm all outta bubble gum!"

Offline Zayfod

  • ECP Team
  • *
  • Llama, softest natural fibre in the world.
Re:Newly Revised Rapple script
« Reply #27 on: 14 Mar 2003, 06:30:52 »
Does it have to be a chopper?....maybe it could be a jeep?

Will this be a createvehicle job then instant delete?

if it is will map makers have to have a copy of the vehicle already in the map somewhere to save lag on the texture load? --

Actually if the map maker put the jeep or truck miles away hidden then you wouldnt even need to create it then delete would you? And it would be local--yes?

It would just sit there hidden


Zayfod "twiddles thumbs and waits"

 :o
« Last Edit: 14 Mar 2003, 06:36:02 by Zayfod »
"I have come here to kick ass and chew bubble gum......an I'm all outta bubble gum!"

Offline snYpir

  • BIS Team
  • ****
  • OFPEC Jedi Master
    • OFPEC
Re:Newly Revised Rapple script
« Reply #28 on: 14 Mar 2003, 07:03:24 »
Right, attached is the working, tested MP compatible version.

BUT - The switchmoves will only be seen on the computers where the rappelling units are local.

Timing for the rappel is pretty much perfect - in fact i am fairly happy with the results.

I think it would be relatively easy to write another script that simply changes the switchmoves for each unit on all machines, but i have run out of time right now - i will do it either tonight or tomorrow.

Zay - please hit me up with any questions as to how the MP version works - you'll see the core code has not been changed, it's just that I have executed certain parts of it on certain machines.

To summarise,

rappel.sqs is run as per normal on the server, whenever a rappel needs to happen.

rappel_monitor.sqs is run at the start of the mission on ALL machines.

no probs?
« Last Edit: 14 Mar 2003, 07:04:57 by snYpir »
Bohemia Interactive Simulations

Offline snYpir

  • BIS Team
  • ****
  • OFPEC Jedi Master
    • OFPEC
Re:Newly Revised Rapple script
« Reply #29 on: 14 Mar 2003, 07:09:11 »
Oh yeah - you need a gamelogic named Server in the mission as well.

I tested one chopper with two groups inside, each group led by a different client. I did not test a rappel with no clients (ie only server-side units in the chopper), but i assume that would work because it would be the same as an SP rappel.

Remember - you won't see switchmoves if you are on a client machine, and another machine is controlling the descent. (not until i write another script, anyway)
Bohemia Interactive Simulations