Home   Help Search Login Register  

Author Topic: How to make trigger accept only healthy "man" type units to thislist?  (Read 1695 times)

0 Members and 1 Guest are viewing this topic.

Offline MakkaraTheMan

  • Members
  • *
  • Moikkuli from Finland :)
    • www.lifeline.fi
Hello.

I'm still trying to solve a few condition problems to my -nearest friendly AI unit carrying wounded- script. This is the main thing that is now missing/i donno how to do it:
 
How to make a trigger(covering the whole map) to accept only healthy "man" type units to it's thislist command?

healthywest = thislist

healthyeast = thislist

healthyres = thislist

Can anyone assist please?

Offline ModestNovice

  • Members
  • *
well:

make a marker where you want the unit to move it they are not allowed in, name it: not_allowed


Trigger:
Code: [Select]
condition: true

OnAct: { if (getDammage _x == 0) then {} else {player setPos (getmarkerPos "not_allowed")} } foreach thisList
"The road became empty and the people disappeared. The clouds ran away; opened up the sky, and one by one I watched every constellation die."
- Sean "Slug" Daley

Offline MakkaraTheMan

  • Members
  • *
  • Moikkuli from Finland :)
    • www.lifeline.fi
Thanks for the reply :)

To not allow unit's to move to a certain marker is not the problem here, hmm... i'm not shure what this code is actually ment to do ??? Or i just don't understand it's whole potential... :dunno:
Anyway that code might come in handy, if i need to deny acces to a marker. Thank you sir!

It might be my bad english or something... but what i'm trying to do is:

After one soldier is badly hit anywhere on the map. Then i'd like the nearest healthy soldier (he is just a helper, not a medic!) to move to the wounded soldiers position.

Finding a wounded soldier, and his basic scripting, and his simple group actions/scripting, is solved by trigger/eventhandler "hit" or "dammaged". That is not a huge problem at the moment, but to find his "helper" is.

Here are my scripting problems:
How to sort out one single soldier with full health, from all of the friendly units and vehicles on the map, after somebody is wounded(not in a vehicle)?

Is it the best way to do that with a repeatedly unit counting trigger? Or is there a code, that could be launched from the same script that is handling the wounded soldier? Or any code? I know there are some "nearestobject" or "knownunits" -functions out there, but i donno how to use them.

The first thing that came to my mind was, that get the nearest "healthy helper" from the wouded soldiers own group. Ok, but i dont know how to do that?

Secondly what if the wounded is the last person alive from his original group? Then he needs the nearest guy from the other group... and so on. Thats why i think that the "helper" should be sorted out from all of the friendly troops around. I donno how to do that.

If the wounded is the last person alive on the map... Tough luck. Anyway it is not realistic that people are left crowling back when others are running somewhere. Allso the repeatedly done "miracle" healings with the medic units, are not realistic. The miracles are done in the field hospitals, not in the field under fire. And if you are badly hit, you are not moving anywhere. If this is "helper" thing is possible to do, then i think it would be possible to script that for multiplayer and arma too. Maby adding some score system for "helping" wounded to the evacuation area or fieldhospital.... and so on. This is what i'm trying to do here. Please assist :)
« Last Edit: 01 Oct 2008, 13:10:56 by MakkaraTheMan »

Walter_E_Kurtz

  • Guest
Question: why do you want a trigger the size of the whole map? This does not help you find the nearest helper unit and, to my mind, appears very inefficient.


What I'd do: get a list of friendly units within 50 metres of the wounded guy, find a healthy one among them and assign him as the helper.

How: this would have to be repeated for the other two sides (East & Res), taking West as the example

Create a trigger (50m by 50m, activated by West, repeatedly) named HurtWest and placed out of the way. For neatness' sake WestHelperSearch = false, ought to be added to init.sqs,

then the script called by the wounded soldier (HurtWest.sqs) might be something like this:
Code: [Select]
_WoundedWest = _this select 0

hint "HurtWest run"

#Restart

;stop script if wounded soldier has been killed, ie. taken another bullet
~1
? !alive _WoundedWest: exit
? WestHelperSearch = true: goto "CryForHelp"

;move trigger to wounded soldier to look for helpers
;WestHelperSearch is true when the trigger is in use searching for allied units
;and prevents two wounded people from fighting over it
WestHelperSearch = true
HurtWest setPos (getpos _WoundedWest)
~1
_friendsWest = list HurtWest
WestHelperSearch = false

;begin search of array for healthy friendly
_numberfriendlies =  count _friendsWest

hint format ["%1", _numberfriendlies]

;(it might make sense to do this backwards, but I assume those earlier in the array are nearer the wounded)

_i = -1
#loop
_i = _i + 1
?(_i == _numberfriendlies): goto "CryForHelp"

_query = (_friendsWest select _i)
? (getDammage _query > 0.1): goto "loop"
;? ( _query = player): goto "loop"                  <--- NB Not tested

;helper has been found, execute the carry script
;format is whatever you want, for example
;[_WoundedWest, _query] exec "carry.sqs"      <--- enter the format you want here

;the following is just so you can test the script
[_query] join (grpNull)
_query doMove (getPos _WoundedWest)

exit


; if no helpers are found, wounded are to cry for help and restart the helper search
; writhing movements and sound would have to be defined
#CryForHelp
;_WoundedWest playmove ...
;_WoundedWest say ...
~5
hint "Cry for Help"
;_WoundedWest playmove ... (slightly different)
~5
goto "Restart"
you might want to add an escape clause, in case the player is selected as helper

then carry.sqs would start something like:
Code: [Select]
_Wounded = _this select 0
_Helper = _this select 1

_Helper doMove (getPos _Wounded)

;wait while helper moves to wounded's position
#Wait
~2
_dist = _Helper distance _Wounded
? (_dist > 2): goto "Wait"

...
« Last Edit: 03 Oct 2008, 00:55:32 by Walter_E_Kurtz »

Offline MakkaraTheMan

  • Members
  • *
  • Moikkuli from Finland :)
    • www.lifeline.fi
Hello!

Thank you very much for that reply Walter :) I've been testing your script for a while, and it works pretty well.

You were right about that trigger size. the smaller is doing the job quite well. Hint text is showing how meny friendlies are near, selecting a helper for each wounded, if not, then crying for help and everything...
This is truly going foward now, and its fantasticooo!!!!! :clap:

There are still few problems remaining and i cant solve them:

1. The "escape" for the player does not work. error... :( So if the player is inside the trigger area, it will allways select the player as the helper. I think that would become a very irritating thing for players at some point...
Code: [Select]
? ( _query = player): goto "loop" I don't mean that that shouldn't never happen for the player, but allways is too much. 

2. When the player is not under the trigger, and if there are friendlies around the wounded, the trigger seems to select the helper from the outer border of the trigger, and not from the center, near the wounded.

That's why it would be much better if that trigger or script could choose the nearest available healthy soldier. I was wondering if the general barrons http://www.ofpec.com/ed_depot/index.php?action=details&id=106&page=0
findunits.sqf function would help? I donno how to use that ???

I also found a couple of codes, but i couldn't/donno how to use them:
Code: [Select]
_distance = 9999
_target = objnull
_i = (count eastlist) - 1
#loop
_unit = eastlist select _i
? not alive _unit : goto "next"
? player distance _unit < _distance  : _distance = player distance _unit; _target = _unit
#next
_i = _i - 1
? _i >= 0 : goto "loop"
and
Code: [Select]
_men = _this select 0
_unarmedman = _this select 1
_deadmen = []

_num = 0
#check
_man = _men select _num
?not alive _man && ((count weapons _man)>0):_deadmen = _deadmen + [_man]
_num = _num + 1
?_num!=(count _men):goto "check"

###########################
#find nearest deadbody

_nearesdis = 10000
_num = 0

#check2
?((_deadmen select _num) distance _unarmedman)<_nearesdis:_nearesdis = ((_deadmen select _num) distance _unarmedman); _nearestman = _num
_num = _num + 1
?_num!=(count _deadmen):goto "check2"

_nearestman = _deadmen select _nearestman
_unarmedman domove getpos _nearestman

@(_unarmedman distance _nearestman)<1

_unarmedman action ["take weapon",_nearestman,0,0,(primaryweapon _nearestman)]

3. If the selected helper is wounded in the middle of the helper script, the helper will receive a new helper for himself, but the "original" first wounded guy will be lying without helper, crying for help. So the trigger/script is not getting him a new helper. Donno why?

I was thinking if the code -setcaptive true- could help in this thing. I mean, if the selected helper and the wounded are set as "captives", would that help to sort them out from the triggers selection process to find new suitable helpers? Donno how to do that...

Please assist :dunno:

Walter_E_Kurtz

  • Guest
I haven't got time for a fulsome reply yet, but I'll probably update this post as things occur to me.

Things that I think also need consideration:
A What mod are you using this with? I'm assuming Prof Tournesol's World War One. However, it would be nice to have an addon-free test-bed. Would you be willing to share your eventHandlers that get these scripts started?

B Need to make sure only "man" type units are admitted, otherwise vehicles would be going to the rescue.


Answers (so far):
1 I think that's because two equals signs are needed in the condition part; try
Code: [Select]
? ( _query == player): goto "loop"
Quote
3. If the selected helper is wounded in the middle of the helper script, the helper will receive a new helper for himself, but the "original" first wounded guy will be lying without helper, crying for help. So the trigger/script is not getting him a new helper. Donno why?
The first wounded guy will indeed be without a helper, but won't be crying for help. The 'CryingForHelp' loop is just a long pause in case friendly units move into the vicinity, at which point one should be assigned as helper.
If you are using HurtWest.sqs to launch carry.sqs, maybe carry.sqs should include the condition:
Code: [Select]
?!(alive _Helper): [_Wounded] exec "HurtWest.sqs"

Offline MakkaraTheMan

  • Members
  • *
  • Moikkuli from Finland :)
    • www.lifeline.fi
Hello.

I'm sorry my reply's are slow. I'm having busy times at work, so this bloody thing is getting me a nervous breakdown... or something :P

I'll try to answer your questions Walter:
Quote
A What mod are you using this with? I'm assuming Prof Tournesol's World War One. However, it would be nice to have an addon-free test-bed. Would you be willing to share your eventHandlers that get these scripts started?
A I'm using mostly FDFmod (Finnish Defence Forces mod). My testmission is now addon free. I'm willing to share all of my crappy scripts and missions :good:
Code: [Select]
Trigger, whole map
west
Present
"_x addeventhandler [""hit"",{_this exec ""woundsmonitor1.sqs""}]" foreach thislist

Quote
B Need to make sure only "man" type units are admitted, otherwise vehicles would be going to the rescue.
B Yes that is a problem, i donno how to get that work. The "hit" eventhandler is counting in all vehicles and man units. But you can get the "shooter" from that ehandler. The "dammaged" ehandler is more unit friendly, but doesn't offer the shooter. I'm willing to change it to dammaged, if that makes the whole thing much easier.

here is the woundsmonitor1.sqs
Code: [Select]
_guy = _this select 0;
_shooter = _this select 1
_orgroup = units group _guy;
_leader = leader group _guy
_origroup = group this
_enemy = east_units
_Mediheli = Mediheli;
_Medivac = Medivac
_Reinforce = Reinforce;
_cargo = (crew _Mediheli) - [Driver _Mediheli, Gunner _Mediheli];
_aunits = _cargo;
_j = (count _aunits);
_i = 0
_pilot = [driver _Mediheli];
_gunner = [Gunner _Mediheli];


#START;
?!(alive _guy) : goto "EXIT"
;@!(_guy in Vehicle)-------------notworking?
;@(vehicle _guy) != _guy---------notworking?
?!(alive _shooter) : goto "GETDAMMAGE"

titleText ["Wounded Extraction Simulation Example\n", "plain down"]

{_x disableAI "TARGET"} forEach units _origroup

"_x commandTarget _shooter" forEach units _origroup

;{_x setcombatmode "YELLOW"} forEach units _origroup

;{_x setspeedmode "LIMITED"} forEach units _origroup

;{_x setbehaviour "COMBAT"} forEach units _origroup

;(_orgroup select _i) setcombatmode "YELLOW"
_leader setcombatmode "YELLOW"

;(_orgroup select _i) setspeedmode "LIMITED"
_leader setspeedmode "LIMITED"

;(_orgroup select _i) setbehaviour "COMBAT"
_leader setbehaviour "COMBAT"

;(_orgroup select _i) setformation "LINE"
_leader setformation "LINE"

_leader setunitpos "DOWN"

~3.0

;[_origroup, -getdir _shooter, 50] exec "rush.sqs"


#GETDAMMAGE

?(getdammage _guy >= 0.5): goto "HEAVYDAMMAGE"

?(getdammage _guy <= 0.5): goto "EXIT"



#HEAVYDAMMAGE
;_guy removeAllEventHandlers "dammaged"

;_guy removeAllEventhandlers "hit"

[_guy] Join GrpNull;

_guy SetCaptive true;

_guy globalchat "null";



#SELECTHELPER
;~0.1
;_h=(count _orgroup)
;_h=_h+2
;_helper = (_orgroup select 1)
;(_orgroup select _i)
;[_helper] Join GrpNull
;_helper SetCaptive true;
;_distance = 9999
;_helper = objnull
;_i = (count westlist) - 1
;#loop
;_unit = westlist select _i
;? not alive _unit : goto "next"
;? _guy distance _unit < _distance  : _distance = _guy distance _unit; _helper = _unit
;#next
;_i = _i - 1
;? _i >= 0 : goto "loop"

;_helper SetCaptive true;



[_guy] exec "HurtWest.sqs"



#HEAVY;

_guy globalchat "heavy";

_guy setunitpos "DOWN";

_guy setcombatmode "BLUE";

_guy switchMove "LyingToTreatedLying";

_guy sidechat "I'M BADLY HIT... I Can't move...";

~3.0

_guy switchMove "LyingDying";

_guy globalchat "tajupois";


#EXIT
exit

here is the HurtWest.sqs
Code: [Select]
_WoundedWest = _this select 0

hint "HurtWest run"

#Restart

;stop script if wounded soldier has been killed, ie. taken another bullet
~1
? !alive _WoundedWest: exit
? WestHelperSearch = true: goto "CryForHelp"

;move trigger to wounded soldier to look for helpers
;WestHelperSearch is true when the trigger is in use searching for allied units
;and prevents two wounded people from fighting over it

WestHelperSearch = true
HurtWest setPos getpos _WoundedWest
~1
_friendsWest = list HurtWest
WestHelperSearch = false

;begin search of array for healthy friendly
_numberfriendlies =  count _friendsWest

hint format ["%1", _numberfriendlies]

;(it might make sense to do this backwards, but I assume those earlier in the array are nearer the wounded)

_i = -1
#loop
_i = _i + 1
?(_i == _numberfriendlies): goto "CryForHelp"

_query = (_friendsWest select _i)
? (getDammage _query >= 0.1): goto "CryForHelp"

;? ( _query == player): goto "loop"
;<--- NB Not tested, is tested, and not working...

;helper has been found, execute the carry script
;format is whatever you want, for example

[_WoundedWest, _query] exec "carry.sqs"
;<--- enter the format you want

exit

; if no helpers are found, wounded are to cry for help and restart the helper search
; writhing movements and sound would have to be defined
#CryForHelp
;_WoundedWest playmove ...
;_WoundedWest say ...
~5
hint "Cry for Help"
;_WoundedWest playmove ... (slightly different)
~5
goto "Restart"

here is the carry.sqs when the helper is found
Code: [Select]
_guy = _this select 0
_helper = _this select 1
_origroup = group this
_leader = leader group this
_Mediheli = Mediheli
_enemy = east_units
_jsp = getmarkerpos "Medivac_marker"
_Reinforce = Reinforce_heli
_cargo = (crew _Mediheli) - [Gunner _Mediheli]
_aunits = _cargo
_j = (count _aunits)
_i = 0
_pilot = [driver _Mediheli]
_gunner = [Gunner _Mediheli]



#HELPERACTION
_leader domove getpos _guy
"_x commandWatch _shooter" forEach units _origroup
@(unitReady _leader)
_leader setunitpos "AUTO"
;[_origroup, -getdir _shooter, 40] exec "rush.sqs"
_helper doMove getPos _guy
_helper setdammage 0.1
? !(canStand _helper) or !(alive _helper) : goto "NEWHELPER"

_helper SetCaptive true;

_helper setcombatmode "BLUE";

_helper sidechat "ROGER, MOVING OUT TO THE WOUNDED";

;wait while helper moves to wounded's position
@(unitReady _helper)
_helper sidechat "READY"

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

_helper domove _pos3

@(unitReady _helper)

_helper setPos _pos3

_helper setSpeedMode "LIMITED"

_helper setbehaviour "AWARE"

_helper setDir (getDir _guy)
~1.0
_helper switchMove "FXFromKneel"
~1.0
_helper domove getmarkerpos "Medivac_marker"


#CARRY_LOOP
? !(canStand _helper) or !(alive _helper) : goto "NEWHELPER"

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

_guy setPos [(_pos1 select 0), (_pos1 select 1), 0]

_guy setDir (getDir _helper)

~0.3

?!(unitReady _helper) : goto "CARRY_LOOP"


#NEXT3
~2.0

_helper setunitpos "AUTO"

_helper setcombatmode "AUTO"

_helper setbehaviour "AWARE"

_helper SetCaptive false;

#MEDIVAC
;@ ((_enemy distance _guy) < 200)

@(unitReady Pilotmediheli)
_guy globalchat "pilotti on valmis";
~1.0
@!(Pilotmediheli in _Mediheli)
_guy globalchat "pilotti ei ole sisällä";
~1.0
@(speed _Mediheli <= 1);
_guy globalchat "nopeus ok";
~1.0
@(getpos _Mediheli select 2) <= 1
_guy globalchat "korkeus ok";
~1.0
@(_Mediheli Distance Base <= 100);
_guy globalchat "etäisyys ok";
~1.0
@(speed _Mediheli <= 1);
_guy globalchat "nopeus ok";
~1.0
@(getpos _Mediheli select 2) <= 1
_guy globalchat "korkeus ok";
~1.0
@(unitReady Pilotmediheli)
_guy globalchat "pilotti on valmis";
~1.0
@!(Pilotmediheli in _Mediheli)
_guy globalchat "pilotti ei ole sisällä";
~5.0
_guy globalchat "kutsuu mediheliä";
[_guy] exec "Medivac.sqs"

#EXIT
exit

#NEWHELPER
[_guy] exec "HurtWest.sqs"

exit

here is the Medivac.sqs after the helper has carryed the wounded _guy to the Medivac_marker
Code: [Select]
_guy = _this select 0
_orgroup = group this
_Mediheli = Mediheli
_enemy = east_units
_jsp = getmarkerpos "Medivac_marker"
_Reinforce = Reinforce_heli
_cargo = (crew _Mediheli) - [Gunner _Mediheli]
_aunits = _cargo
_j = (count _aunits)
_i = 0
_pilot = [driver _Mediheli]
_gunner = [Gunner _Mediheli]


#START

?!(alive _guy) exit
?!(alive _Mediheli) exit

Pilotmediheli MoveInDriver _Mediheli
Pilotmediheli setcombatmode "BLUE"
Pilotmediheli setbehaviour "CARELESS"
~0.5

gunnermediheli MoveInGunner _Mediheli
gunnermediheli setcombatmode "RED"
~1.0
_guy setunitpos "AUTO"
_guy globalchat "5"

@(speed _Mediheli <= 1)
_Mediheli setfuel 1

_Mediheli setcaptive true
_Mediheli flyinheight 50

Pilotmediheli domove getpos _guy
Pilotmediheli sidechat "MEDIVAC ON THE WAY"

@(unitReady Pilotmediheli)

Pilotmediheli domove getpos _guy

;@(_Mediheli Distance getpos _guy < 500)
@ ((Pilotmediheli distance _guy) < 500)

_hloc = "HeliH" createvehicle getpos _guy

_Mediheli flyinheight 15
Pilotmediheli sidechat format ["MEDIVAC LANDING %1", getpos _guy]
~1.0
@(unitReady Pilotmediheli)
~5.0
Pilotmediheli domove getpos _guy
~1.0
_Mediheli land "GETIN"

@(unitReady Pilotmediheli)

unassignvehicle gunnermediheli

@(unitReady gunnermediheli)

@!(gunnermediheli in _Mediheli)

gunnermediheli setbehaviour "AWARE"

gunnermediheli setunitpos "UP"

gunnermediheli setcombatmode "BLUE"

gunnermediheli domove getpos _guy


#CARRY_MAIN
@(unitReady gunnermediheli)
@ ((gunnermediheli distance _guy) < 50)

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

gunnermediheli domove _pos3

@(unitReady gunnermediheli)

?!(canStand gunnermediheli) : goto "EXIT"
?!(alive gunnermediheli) : : goto "EXIT"

gunnermediheli setPos _pos3

gunnermediheli setSpeedMode "FULL"

gunnermediheli setDir (getDir _guy)
~1.0
gunnermediheli switchMove "FXFromKneel"
~1.0
gunnermediheli domove getpos _Mediheli

#CARRY_LOOP
? !(canStand gunnermediheli) : goto "STOP"
?(_Mediheli Distance _guy < 7) then (_guy MoveInCargo _Mediheli)

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

_guy setPos [(_pos1 select 0), (_pos1 select 1), 0.02]

_guy setDir (getDir gunnermediheli)

gunnermediheli setbehaviour "AWARE"

gunnermediheli setunitpos "UP"

#NEXT3
~0.2
? !(unitReady gunnermediheli) : goto "CARRY_LOOP"
;_guy assignascargo _Mediheli
_guy MoveInCargo _Mediheli
? (count _aunits >10) : goto "MOVEON"
@(unitReady gunnermediheli)



#MOVEON

@(unitReady gunnermediheli)
~1.0
deletevehicle _hloc
~1.0

gunnermediheli assignasGunner _Mediheli

gunnermediheli MoveInGunner _Mediheli

gunnermediheli setbehaviour "COMBAT"

Pilotmediheli sidechat "MEDIVAC RETURNING TO BASE ...OVER"
~1.0
_Mediheli domove getpos Base

_Mediheli flyinheight 50
@(unitReady Pilotmediheli)
@(_Mediheli Distance Base < 300)

_Mediheli land "GET OUT"

@(unitReady Pilotmediheli)

_Mediheli land "LAND"
~5.0
@(speed _Mediheli <= 1)
~1.0
@(getpos _Mediheli select 2) <= 1


#GETOUTHELI
unassignvehicle _guy
~1.0
unassignvehicle _guy
_guy action ["EJECT", _Mediheli]

@!(_guy in _Mediheli)

_guy domove getpos Field_hospital

Pilotmediheli sidechat "Medivac complete"

unassignvehicle Pilotmediheli
Pilotmediheli action ["EJECT", _Mediheli];

@!(Pilotmediheli in _Mediheli)
Pilotmediheli globalchat "Medihelin pilotti ulkona"
~1.0

@(unitReady Pilotmediheli)
Pilotmediheli globalchat "Medihelin pilotti valmis"
~1.0

@(unitReady Pilotreinforce);
Pilotreinforce globalchat "reinforce valmis"
~1.0

@!(Pilotreinforce in _Reinforce);
Pilotreinforce globalchat "reinforce pilotti ulkona"
~1.0

@(speed _Reinforce <= 1)
Pilotreinforce globalchat "reinforce nopeus ok"
~1.0

@(getpos _Reinforce select 2) <= 1
Pilotreinforce globalchat "reinforce korkeus ok"
~1.0

@(_Reinforce Distance Base2 < 100)
Pilotreinforce globalchat "reinforce etäisyys ok"
~1.0

@(speed _Reinforce <= 1)
Pilotreinforce globalchat "reinforce nopeus ok"
~1.0

@(getpos _Reinforce select 2) <= 1
Pilotreinforce globalchat "reinforce korkeus ok"
~1.0

@(unitReady Pilotreinforce);
Pilotreinforce globalchat "reinforce valmis"
~1.0

@!(Pilotreinforce in _Reinforce);
Pilotreinforce globalchat "reinforce pilotti ulkona"

[_guy] exec "Reinforce.sqs"

#EXIT
exit

here is the getRelpos.sqf that the _helper and the wounded _guy are using
Code: [Select]
// getRelPos.sqf
// AliMag - 02/2003
// return relative position from _obj using distance and direction

private ["_obj","_dis","_posX","_posY","_dir","_pos"];

_obj = _this select 0;
_dis = _this select 1;
_dir = _this select 2;

_posX = getPos _obj select 0;
_posY = getPos _obj select 1;
_pos = [_posX + ((sin _dir) * _dis), _posY + ((cos _dir) * _dis), 0];
_pos

Here is the Reinforce.sqs that the wounded _guy is using after visiting the field hospital
Code: [Select]
_guy = _this select 0
;_orgroup = group this
_Reinforce = Reinforce_heli
_reinf = getmarkerpos "Reinforce_marker"
_cargo = (crew _Reinforce) - [Driver _Reinforce, Gunner _Reinforce];
_aunits = _cargo;
_j = (count _aunits)
_i = 0
_pilot = [driver _Reinforce];
_gunner = [Gunner _Reinforce];

;HeliHEmpty
;HeliH
 
#GETBACK;
?!(alive _guy): exit
?!(alive _Reinforce): exit

Pilotreinforce MoveInDriver _Reinforce;
Pilotreinforce setcombatmode "BLUE";
Pilotreinforce setbehaviour "CARELESS";
~0.5

gunnerreinforce MoveInGunner _Reinforce;
gunnerreinforce setcombatmode "RED";
;_Reinforce FlyInHeight 90;


#GETIN
@(getdammage _guy <0.5)

_guy domove getpos Base2;

@(unitReady _guy);

_guy MoveInCargo _Reinforce;

@(_guy in _Reinforce);
~10.0

#MOVEON2;
_Reinforce domove _reinf;
@(unitReady Pilotreinforce);
~1.0
_hloc2 = "HeliHempty" createvehicle _reinf

_Reinforce land "LAND";
~5.0
@(speed _Reinforce <= 1);
@(getpos _Reinforce select 2) <= 1

~1.0
unassignvehicle Pilotreinforce;
@!(Pilotreinforce in _Reinforce);


#NEXT1;
unassignvehicle _guy;
~1.0
_guy action ["EJECT", _Reinforce];
@!(_guy in _Reinforce);

Pilotreinforce globalchat "Reinforcement complete";

deletevehicle _hloc2

_guy addEventHandler ["hit", {_this exec "woundsmonitor.sqs"}]

[_guy] join (_orgroup select _i)
~1.0
_guy commandfollow (leader _orgroup);
~1.0
_guy groupchat "I'm back in business";

_guy setunitpos "AUTO";

_guy SetCaptive false

_guy globalchat "READY";
~1.0
Pilotreinforce MoveInDriver _Reinforce

_Reinforce domove getpos Base2

@(unitReady Pilotreinforce);

_Reinforce land "LAND";

unassignvehicle Pilotreinforce

@(unitReady Pilotreinforce);

@!(_Pilotreinforce in _Reinforce);

Pilotreinforce sidechat "Reinforce Ready";

#EXIT
exit

And here is the init.sqs
Code: [Select]
WestHelperSearch = false
getRelPos = preprocessFile "getRelPos.sqf"

I hope this helps... to help me out here. :dunno:

Down below is the example mission.  :P

Walter_E_Kurtz

  • Guest
Here's version 4 with a few wrinkles ironed out:

for a start, it really is addon-free (you had some BAS dependencies remaining).

Suggestions:
1. do not assign eventhandlers through "triggers + thislist" as everything then has them applied. I added a Resistance Hunter to shoot at the men, and even he started running the scripts.
2. get rid of the scripting to make the group target the shooter as it is messy, adds nothing and does not go back to normal afterwards. If you're making sniper-hunting squads, instead use triggers linked (with F2) to the sniper, with the format "Vehicle, detected by West", and then run the rush script.
3. I'm not sure why the group leader is meant to move to the wounded in carry.sqs
4. Need to figure out why so many messages occur twice.
5. Once the scripts are working, the helipads 'Base' and 'Base2' should be made invisible.
« Last Edit: 16 Oct 2008, 03:06:49 by Walter_E_Kurtz »