Jump to content
Sign in to follow this  
DespairsRay

Help mixing two scripts.

Recommended Posts

Hello!

I want to mix two scripts together. Been playing ofp for years and really enjoy playing with the AI. I found the paramedic script a while back but it seemed like it was more for cutscenes. Two soldiers would come and pick up the dead (had to name him) and carry them off. I wished I could of used it on the battle field so they would come pick up the dead as the battle went along. But the script wasn't set up this way.

The other day I downloaded the WWI mod and it came with this neat script where you could get people to come and bury the dead (as to reduce lag, since WWI was a war of attrition of course).

You could set it up on anyone, with a trigger and init line code. I really like how this works. But I was wondering if someone could put this together so... with the paramedic script

people come and pick up INJURED soldiers and carry them off to a safe position of my choosing or a few meters away (nothing big) and then heal them, as to return to the fight.

The WWI mod had it set up so it detects whos dead. and the person comes by and buries them. The paramedic scripts has 2 people working in conjunction to simulate picking up the body but its set up in a way where you have to name the dead and be really specific.

--------------------------------------

paramedic.sqs

;**********************

; paraMedic.sqs *

; AliMag - 03/2003 *

;**********************

goto (_this select 0)

#CARRY

_dead = _this select 1

_s1 = _this select 2

_s2 = _this select 3

_dest = _this select 4

_beh = [(behaviour _s1), (behaviour _s2)]

_s1 setBehaviour "CARELESS"

_s2 setBehaviour "CARELESS"

#CARRY_MAIN

_s1 setSpeedMode "FULL"

_s2 setSpeedMode "FULL"

_u = _dead select 0

? ("man" countType [_u]) == 0 : goto "BAD"

? (alive _u) : _u setDammage 1

_pos3 = [_u, 1.5, (getDir _u)] call getRelPos

_pos4 = [_u, 1.5, (getDir _u)-180] call getRelPos

_s1 move _pos3

_s2 move _pos4

@ ((_s1 distance _u) < 5) or !(canStand _s1) or !(canStand _s2)

@ ((unitReady _s1) and (unitReady _s2)) or !(canStand _s1) or !(canStand _s2)

? !(canStand _s1) or !(canStand _s2) : goto "STOP"

_s1 setPos _pos3

_s2 setPos _pos4

_s1 setSpeedMode "LIMITED"

_s2 setSpeedMode "LIMITED"

_s1 setDir (getDir _u)

_s2 setDir (getDir _u)

~0.5

_s1 switchMove "FXFromKneel"

_s2 switchMove "FXFromKneel"

~1

_s1 move _dest

["WALK", _s1, _s2, _u] exec "paraMedic.sqs"

#CARRY_LOOP

? !(canStand _s1) or !(canStand _s2) : goto "STOP"

_pos1 = [_s1, 1.5, (getDir _s1)-180] call getRelPos

_u setPos [(_pos1 select 0), (_pos1 select 1), 0.7]

_u setDir (getDir _s1)

? (_s1 distance _s2) == 3 : goto "NEXT"

_pos2 = [_s1, 3, (getDir _s1)-180] call getRelPos

_s2 setPos _pos2

_s2 setDir (getDir _s1)

#NEXT

~0.01

? !(unitReady _s1) : goto "CARRY_LOOP"

_dead = _dead - [_u]

deleteVehicle _u

? (count _dead > 0) : goto "CARRY_MAIN"

#END

_s1 setBehaviour (_beh select 0)

_s2 setBehaviour (_beh select 1)

exit

#STOP

_s1 setBehaviour "COMBAT"

_s2 setBehaviour "COMBAT"

_s1 move (getPos _s1)

_s2 move (getPos _s2)

exit

#WALK

_s1 = _this select 1

_s2 = _this select 2

_u = _this select 3

#WALK_LOOP

_s2 playMove "StandWalkF"

~1.7

? !(isNull _u) and (canStand _s1) and (canStand _s2) : goto "WALK_LOOP"

exit

#BAD

_dead = _dead - [_u]

? (count _dead == 0) : goto "END"

goto "CARRY_MAIN"

-----------------------------

From the WWI mod

deadlistadd.sqs

;adds every dead unit in a list called "dealist", used by deadpic.sqs

;create a big trigger covering every units, activated once, by everybody, with on activation field :

;deadlist=[];"driver _x addeventhandler [{killed},{_this exec {\PGM_scripts\deadlistadd.sqs}}]" foreach thislist

_unit = _this select 0

~0.5

deadlist = deadlist + [_unit]

~0.5

exit

------------------------

deadpic.sqs

;[unit] exec "\PGM_scripts\deadpic.sqs" in the init line of dead pickers, or using a trigger

_Unit = _this select 0

group driver _unit setcombatmode "blue"

group driver _unit setbehaviour "careless"

driver _unit allowfleeing 0

_pos = getpos _unit

#FindTarget

~0.01

? !(Alive driver _Unit): Exit

? (count deadlist == 0) : goto "FindTarget"

~random 1

? (count deadlist == 0) : goto "FindTarget"

_Tgt = deadlist select 0

deadlist = deadlist - [_tgt]

#Sprint

~1

? !(Alive driver _Unit): Exit

_Unit domove getpos _Tgt

@ (_Unit distance _tgt <= 10) or !(alive driver _unit) or (unitready driver _Unit)

? !(Alive driver _Unit): Exit

_grave = "grave" createvehicle [0,0,0]

_grave setdir getdir _tgt

~0.1

_grave setpos getpos _Tgt

@ (unitready driver _Unit) or !(alive driver _unit)

? !(Alive driver _Unit): Exit

~1

_unit action ["HIDEBODY", _Tgt]

~3

? (count deadlist == 0) : _Unit domove _pos

~1

goto "FindTarget"

Exit

---------------------------------

How it was used with the pbo with the scripts in case this helps...

Deadpic.sqs / deadlistadd.sqs => grave diggers burying dead bodies (to avoid lag due to many dead units)

Example : [this] exec {\PGM_SCRIPTS\deadpic.sqs} (in the init line of dead pickers)

And : deadlist=[];"driver _x addeventhandler [{killed},{_this exec {\PGM_scripts\deadlistadd.sqs}}]" foreach thislist

(in a big trigger covering every units, activated once, by everybody, in the on activation field)

=====================================

I found in the command references you can check if a units hands are injured...can this be used? or either legs or severely injured.

I use a mix of the SLX and ECP mod, so people bleed, would be nice to use a nice combo of the script in battles, when the squad medic isn't around.

Can someone knowledgeable help?

Share this post


Link to post
Share on other sites

I guess you could give the units that the medics are going to pick up "hit" and/or "damaged" eventhandlers, which would run the script? So in the deadlist trigger, you'd write this:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

deadlist=[];"driver _x addeventhandler [{hit},{_this exec {\PGM_scripts\deadlistadd.sqs}}]" foreach thislist

In that one, all units which are in the trigger area would run the script when they are hit. Then you'd have to script the medics to put the wounded into a stretcher instead of six feet under. Can't help on that right now as I'm in a cafe (and soon heading out for a beer)

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×