garnett21a 0 Posted April 30, 2006 I am working on the situation of direct reinforcement into a heavy fire area, and I want to make sure the player's vehicle alive. Anyway using the " this allow dammage false" makes no efforts at all. Is there order to achieve that? Share this post Link to post Share on other sites
korax 4 Posted April 30, 2006 The 'allowdammage' command has never worked, if you want to make the players vehicle invincible then use this<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">this addeventhandler ["Hit",{(_this select 0) setdammage 0}];this addeventhandler ["Killed",{(_this select 0) setdammage 0}] And then you can disable it whenever by doing<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">this removealleventhandlers "Hit";this removealleventhandlers "Killed" Share this post Link to post Share on other sites
garnett21a 0 Posted April 30, 2006 Thanks man, that's helpful. Share this post Link to post Share on other sites
mandoble 1 Posted April 30, 2006 Well, the fact is that you cannot make a unit really unbeatable. With the Hit Event handler ("Hit") the unit will be much harder to kill. With the second Event ("Killed") the unit will "revive" once killed but the problem is the follows: Once killed, if you revive the unit, it will switch automatically to "CIV" side, and will stop to follow commands (doMove, doWatch, doFire, ...). Share this post Link to post Share on other sites
ColonelSandersLite 0 Posted April 30, 2006 I've never had an AI unit die using this. They still respond to commands. Players die when hit in the head sometimes. Since the AI aims for center of mass, stand up and take it in the chest . <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">myUnit addeventhandler ["hit", {_this select 0 setdammage 0}]; myUnit addeventhandler ["dammaged", {_this select 0 setdammage 0}] Share this post Link to post Share on other sites
sanctuary 19 Posted April 30, 2006 An alternative way to get a player not die is to prevent the AI to shoot him . Even if it is for a short period, like for an ingame cutscene : <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">playername setcaptive true and to have him back into his usual role of "target for AI", just <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">playername setcaptive false Very usefull when debugging a mission Share this post Link to post Share on other sites
ColonelSandersLite 0 Posted April 30, 2006 An alternative way to get a player not die is to prevent the AI to shoot him .Even if it is for a short period, like for an ingame cutscene : <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">playername setcaptive true and to have him back into his usual role of "target for AI", just <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">playername setcaptive false Very usefull when debugging a mission Or do both. That way you don't have to worry about a stray round/grenade so much... Share this post Link to post Share on other sites
moricky 211 Posted April 30, 2006 What about this: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">player addeventhandler [{dammaged},{(_this select 0) setdamage (damage (_this select 0)-(_this select 2))}]; player addeventhandler [{hit},{(_this select 0) setdamage (damage (_this select 0)-(_this select 2))}]; Maybe it's working also with (_this select 0) Setdamage 0 instead of taking away damage, but i had some problems wthi it. This is working absolutely for player even for AI. Share this post Link to post Share on other sites
ColonelSandersLite 0 Posted May 1, 2006 I'm thinking that using that, a head shot still has a high chance of instantly killing the player. At least in sp. In mp testing, it may not be as big of an issue since the game handles respawning there. I'll test it to make sure soon. Share this post Link to post Share on other sites
Specter 0 Posted May 1, 2006 you can add invincible units by editing the mission.sqm: west: SoldierWSaboteurCheat east: SoldierESaboteurCheat, OfficerECheat res: SoldierGCheat, OfficerGCheat vehicle: UAZCheat the important thing is: don't edit these units in the mission-editor. it will change bck to the default unit. Share this post Link to post Share on other sites
crashdome 3 Posted May 1, 2006 In my experience, there is no guarantee in keeping a unit alive. All you can do is stuff mentioned above and hope for the best - although setCaptive command is the most successful Share this post Link to post Share on other sites
Blanco 0 Posted May 2, 2006 Here's another way to do it... you can't really make a unit vehicle invincible, but you can make his attacker harmless. You can simulate blanks by deleting the bullets when they leave the barrel of a gun... The enemy will still fire upon your vehicle, but they won't hit a thing. You will still see the muzzle flash tho.. I've wrote a script a few years ago to switch from lifeammo to blanks (and back) whenever you want via a dynamic bolean. I've used it in an cutscene showing a heavy firefight where the actor must stay alive at all cost and it worked perfect. It uses 2 params : 1) the name of the group 2) A (unique) index number assigned to that group. example : [attackgrp, 1] exec "blanks.sqs" The index number is needed to create a dynamic bolean. The bolean is blanks_on, to make it dynamic I add the unique index number to the bolean. So when i put blanks_on1 = true in a trigger or script, the group assigned to that number will fire blanks, in this example attackgrp. To switch back to lifeammo simply set the same bolean to false, blanks_on1 = false You can add as many groups as you want, but every group needs his unique index number. The script : <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> Blanks.sqs by Blanco 05/08/2004 _grp = _this select 0 _index = _this select 1 _c = count units _grp #START @Call format ["Blanks_on%1",_index] ?"alive _x" count units _grp <= 0 : exit _i = 0 #Loop1 _unit = units _grp select _i ?alive _unit : _unit addeventhandler["fired", {deletevehicle (nearestobject[_this select 0, _this select 4])}] _i = _i + 1 ?_i < _c : goto "loop1" @Call format ["!Blanks_on%1",_index] ?"alive _x" count units _grp <= 0 : exit _c = count units _grp _i = 0 #Loop2 _unit = units _grp select _i ?alive _unit : _unit removealleventhandlers "fired" _i = _i + 1 ?_i < _c : goto "loop2" goto "START" Share this post Link to post Share on other sites
Specter 0 Posted May 2, 2006 In my experience, there is no guarantee in keeping a unit alive. wrong, see my post above just reread the first post and i've got another idea: there is a way to change to armor of a vehicle via script. i'm gonna see if i can find it somewhere and post it here Share this post Link to post Share on other sites
ColonelSandersLite 0 Posted May 2, 2006 No, I've seen cheat soilders die as well, although it is rare. Don't know about infantry units hhaving armor though. Share this post Link to post Share on other sites