OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting Resources Beta Testing & Submission => Topic started by: nominesine on 03 Jan 2006, 19:53:15
-
This script gives your team mates a slightly better chance of surviving, provided that you do your job. I wrote it for a campaign mission where you play the medic.
When a unit is hit he/she will fall to the ground screaming. If the medic is fast enough (aprox. 2.5 minutes) they can be saved. The script is intended for a human medic in SP mode.
I would like some general feedback and help with the fine tuning.
Just place a single AI unit on the map, initialize the script, play a medic and shoot the friendly loon in the leg - great fun :)
The script can be initialized using a single eventHandler: this addeventhandler ["hit",{(_this select 0) setdammage 0.75; [_this select 0] exec "surgeon.sqs"}]
SURGEON.SQS - by nominesine (BETA 0.95)
_screamCount = 0
_obj = _this select 0
_obj setCaptive true
_obj removeAllEventHandlers "hit"
#scream
_screamCount = _screamCount +1
? _screamCount == 1: _obj say "eng23"
? _screamCount == 2: _obj say "eng32"
? _screamCount == 5: _obj say "eng23"
? _screamCount == 7: _obj say "eng33"
? _screamCount == 9: _obj say "eng34"
? _screamCount == 11: _obj say "eng23"
? _screamCount == 13: _obj setDamage 1
? _screamCount == 14: exit
_obj switchMove "LyingToTreatedLying"
? !(alive _obj): exit
? damage _obj < 0.75: _obj setCaptive false; exit
~9
goto "scream"
Known bugs:
* Sometimes the eventhandler causes the script to start twice from a single hit. This makes the wounded cry out twice, i.e "Help! help!" and "Medic I'm hit! Medic I'm hit!" instead of "Help!", "Medic I'm hit!" (a small problem IMO).
* If you kill the loon while he's screaming for help he might twitch a few times after death (but actually it looks rather cool).
* Even slightly wounded soldiers starts to cry like babies, rather than fighting the pain (in my mission it doesn't matter, but for a more general script I think there should be some sort of damage level before the screaming kicks in - suggestions???)
Post Scriptum: In blatant disregard for proper posting routines, I haven't suplied the script with an example mission. :P The reason for this is that the script is so simple it only takes a little proofreading skills. Hope no one minds?
-
to change the damage values for the execution, first take out the setdammage 0.75 from the eventhandler.
then, after defining _obj = _this select 0 in the script, put in these lines.
_damage = (getdammage _obj)
? _damage < 0.5: exit
_obj setdammage 0.75
_obj setUnitPos "DOWN"
note that the _obj setUnitPos "DOWN" isn't necessary. it just makes the unit go prone.
Edit: you may want to add a demo mission. although it is simple, it takes away the chance that the tester implements it improperly and will increase the speed/quantity of tests.
-
Ok, i tested your version of the script without any of my suggested modifications. I think the script works... the guys scream when i shoot them in the leg.
Only problem with it currently in my experience is that there is no action as a medic to heal other units... the other unit is always given the action to heal at you. this doesn't work, because if i play as an Officer and tell the guy to heal at the medic, he says "Roger" but lies there doing his little healing animation and screaming, which i suppose is good. what's really necessary is a companion script that gives the player the option to heal the wounded guy. a very simple one would be that the script executed in the Event handler would detect the distance of the player to the wounded unit. once the unit was, say, 2 metres from the player, this script would execute this line:player addaction ["Heal Wounded Man",exec "playerhealing.sqs"]
This script would simply play the medic animation on the player and set the wouned guys damage to 0 using the NearestObject command, or some other system. I currently don't have time to do this, as i'll be going to work in a few minutes.
Anyway, let me know what you think.