hellfish6 7 Posted August 14, 2003 I haven't come across anything like this in my searches here or at OFPEC, so I thought I'd ask - Is it possible to create a script where wounded enemy soldiers will drop their weapon(s) and become captives of the player's unit? I was thinking about using this for when enemy soldiers get their legs shot out so that instead of fighting to the bitter end, they'd give up and hope for some medical attention from the people trying to kill them. Anyone know how to get started on or, better yet, make this entire script? Share this post Link to post Share on other sites
OmniMax 0 Posted August 14, 2003 I haven't come across anything like this in my searches here or at OFPEC, so I thought I'd ask - Is it possible to create a script where wounded enemy soldiers will drop their weapon(s) and become captives of the player's unit? I was thinking about using this for when enemy soldiers get their legs shot out so that instead of fighting to the bitter end, they'd give up and hope for some medical attention from the people trying to kill them. Anyone know how to get started on or, better yet, make this entire script? Hmmm... I'm not sure of any eventhandler or command that detects if somebody's legs are hit, but it would be easy enough. 1. first, detect if the AI's legs have been hit 2. if the legs have been hit, there is a random chance they will surrender (50%) 3. if they surrender, setdammage them up to enough health so they can walk, make them drop their weapon, set them as captive, and play the "captured" animation. If you could play the capurted animation while they are kneeled, I think that would be better. Well, atleast thats how I'd do it, but I'm not sure if there is a way to detect if someone's legs have been hit. If BIS released more commands for it's scripting engine, implemented more things, &c, they would be gods (they already are, what am I talking about?). edit: you could also make the script more advanced, such has friendlies coming to rescue their captured friends, and you getting points for capturing them instead of utterly destroying them. And maybe the commander of the enemy squad raising a white flag somehow? Share this post Link to post Share on other sites
sicilian 0 Posted August 14, 2003 The "Dammaged" Eventhandler results the damaged part of the body! Share this post Link to post Share on other sites
Trapper 0 Posted August 14, 2003 In Asmodeus mission Chemical Warfare the enemys of the counterattack have the possibility to surrender. If they they do it they stop fighting, stand up and play the captured animation. But I can't remember if they do it because they are wounded or because the cassaulties of there squad reached a certain number. Share this post Link to post Share on other sites
walker 0 Posted August 14, 2003 Hi Hellfish6 As mentioned the surrender of troops needs to be a function of: 1 wounds 2 Wound positions 3 number of allies in an area say 200m 4 number of enemy in an area say 200m 5 composition (tanks v rifle armed soldiers) of allied forces in an area say 500m 6 composition (tanks v rifle armed soldiers) of enemy forces in an area say 500m 7 experience of the unit High = low probability no matter what EDIT 8 As mentioned by Tactician how much ammo you have END EDIT I would suggest that you need to balance the weights of those to get the right effect. Decide which is the most important and then work down from it with the others being proportions of it. When your near completion let me know it would be useful for large missions like the CE missions. Kind Regards Walker Share this post Link to post Share on other sites
Tactician 0 Posted August 14, 2003 Relevant functions: unit handsHit (returns true/false, dead returns true?) unit canStand (returns true/false, dead returns false) someAmmo unit (returns true/false, false if unit has no ammo, good reason to give up) fleeing unit (returns true/false, true if unit is disengaging) skill unit (returns 0-1) rating unit (returns integer) Rating is generally the "score" you see at the end of the mission, it applies to all soldiers. Goes up when you kill the enemy and down when you kill a friendly/civilian. Based on rank I think. Decent measure of experience. Event handlers: "hit" [victim,shooter,damageAmount] "dammaged" [victim,partOfBody,damageAmount] Parts of body for dammaged EH: "hlava" - head "ruce" - arms and body "nohy" - legs Share this post Link to post Share on other sites
Major Gripe 0 Posted August 14, 2003 Looks like you have just been volunteered to make the script Hellfish, I look forward to it!! 200th POST, YAY!! Â Â Â Â Â Â Â Â Â Â Â Share this post Link to post Share on other sites
hellfish6 7 Posted August 14, 2003 Ah crap. I'm trying... but don't expect miracles from heathens. Share this post Link to post Share on other sites
hellfish6 7 Posted August 15, 2003 Update: I'm immensely proud of myself. I feel like Dr. Frankenstein in elementary school - I pieced together bits of some other scripts and added my part here and there to come up with a very basic set of scripts. Basically, what I can do now is shoot an enemy soldier who has <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">[this] exec "capture.sqs"; in his init. Once that unit sustains X amount of damage (default 60%) he will surrender and the player can then move up and secure the prisoner, who will then join the player's group. Some issues: 1. Currently the prisoners have "RemoveAllWeapons" as their command to disarm. Is there a function to make them drop their weapons instead? 2. Also, I haven't quite figured out how to determine if the prisoner is prone or not. I'm using the "lyingtoPutdownlying" and "FXStandSurDown" animations for when the unit gets hit and surrenders. That looks fine when the unit is shot while prone, but if you hit and wound somebody while they're standing up, it looks kind of odd. How do I run a check so that it looks right when the unit is shot standing up, animates dropping his weapon and then standing back up to put his hands behind his back? Email me or PM me with your email addy if you wanna take a look at the scripts and the sample mission I have. Edit: OK, I tried to make the skill level work, but when I used this: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">?skill _hostage >=0.75 : exit it prevented the script from working entirely. Share this post Link to post Share on other sites
Tactician 0 Posted August 15, 2003 Note that the ingame editor's skill slider ranges from 0.2 to 1, not from 0 to 1. Starting ratings follow: Private = 0 Corporal = 500 Sergeant = 1500 Lieutenant = 2500 Captain = 3500 Major = 5000 Colonel = 7500 Rating increase for killing an enemy: Most soldiers = 200 Sniper, Blackop, Spetz = 500 Officer = 1000 For further reference: Most cars/trucks/light vehicles = 200 T72 = 1000 Rating penalty for teamkilling: Most soldiers = -1400 Sniper, Blackop, Spetz, Officer = -3500 Share this post Link to post Share on other sites
walker 0 Posted August 15, 2003 Hi all From that it looks like the slider is either a diferent input eg a modifier or a percentage of Colonel Aplying that to Helfishes problem try settings of 501 rather than 0.75 then test with a private and a corporal disarm both to test. If this is the case you need to take that given value as an input and then take rank as another input. You then divide its rank value by what is given. If the number is below 1 by a significant factor your surrender script runs. On another note I think running multiple instances of your script off units init field is not a good idea in a large battle it will result in a big CPU Hit and significant stuttering in game. Better to use as Tactician sugested Quote[/b] ]Event handlers:"hit" [victim,shooter,damageAmount] "dammaged" [victim,partOfBody,damageAmount] I suggest if hit above n damageAmount apply your script to victim. Kind Regards Walker Share this post Link to post Share on other sites
pang 0 Posted August 15, 2003 //edit: script first crashed ofp. got it fixed now my script should do this: it´s activated via a trigger that checks the dammagelevel of the suspect (>0.3) *suspect has 5seconds time to try defending himself *the suspect drops his weapon *he surrenders Quote[/b] ]_suspect = _this select 0~5 _suspect setCaptive true _suspect action ["DROP WEAPON", unit, 0, 0, (primaryweapon _suspect)] ~3 _suspect switchmove "fxstandsurdown" goto "arrest" #arrest @leader deltas distance (_suspect) <2 _suspect switchmove "stand" _suspect setunitpos "up" [_suspect] join deltas goto "end" #lifecheck @!alive (_suspect) _suspect switchmove "fxstandsurdead" goto "end" #end exit if you are an experienced scripted -unlike me  - you´ll see that the script should check 2 conditions. it does check if the leader is close to the suspect to arrest him. but it doesn´t check if the suspect is dead... could someone please give me a clue how to check both conditions? Share this post Link to post Share on other sites
pang 0 Posted August 16, 2003 *bump* can´t anybody help? otherwise i wont be able to finish my "SOAR/ DELTA: Search and Capture" coop mission and you won´t be able to play it aswell Share this post Link to post Share on other sites
RED 0 Posted August 20, 2003 Do you mean something like this? <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> _suspect = _this select 0 ~5 _suspect setCaptive true _suspect action ["DROP WEAPON", unit, 0, 0, (primaryweapon _suspect)] ~3 _suspect switchmove "fxstandsurdown" goto "arrest" #arrest @leader deltas distance (_suspect) <2 goto "lifecheck" #next _suspect switchmove "stand" _suspect setunitpos "up" [_suspect] join deltas goto "end" #lifecheck ?!alive (_suspect):_suspect switchmove "fxstandsurdead";goto "end" goto "next" #end exit Out of interest, what did you do to the script to make it crash OFP? RED Share this post Link to post Share on other sites
hellfish6 7 Posted September 19, 2003 Right now I have a trigger for when all East forces are not present, Objective 1 is accomplished. The only problem is that when I have captured East soldiers, they are still considered to be on the "East" side. Anyone know of a scripting tidbit I could use to change them to "West" or "Resistance" once they are secured? Share this post Link to post Share on other sites
RED 0 Posted September 19, 2003 How about you group them to a west or Res side? <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">[unitname] join nameofwestgroup The group can be an empty group. RED Share this post Link to post Share on other sites
hellfish6 7 Posted September 20, 2003 I did that already. When a POW is secured, he automatically is disarmed and joins the player's group. He's still considered an "East" unit, though. Share this post Link to post Share on other sites
RED 0 Posted September 20, 2003 Why not create some dummy units which are east units with side WEST, then setpos these units into the place of the captured soldiers. RED Share this post Link to post Share on other sites
hellfish6 7 Posted September 21, 2003 Because that goes way beyond my scripting abilities. Share this post Link to post Share on other sites
Tibby595 0 Posted September 29, 2003 get an "spy" addon from ofpec or www.opflashpoint.org and make him shoot baddies Share this post Link to post Share on other sites