wld427 1705 Posted December 20, 2007 Does anybody know how to make something invincible: IE i want to place a shilka in the editor but i want to make it so the AI cannot destroy it. can the set damage function be used for this if so how or is there an undestroyable function. Share this post Link to post Share on other sites
nullsystems 0 Posted December 20, 2007 Im afraid that they cannot be completely invincible. You can however set a loop from a script or use a trigger to constantly set the damage as 0. This wont work if its hit with an AT or similar attack tho. If you really really needed this and your mission cannot live without it you could look into making a small addon which makes the shilka invincible by changing its armor in a config file. I would be glad to help you out if need be. Share this post Link to post Share on other sites
wld427 1705 Posted December 20, 2007 if you could that would be great. All i want is the BIS shilka with like a armor setting of a million. but i do not want to change the default BIS shilka. Share this post Link to post Share on other sites
moricky 211 Posted December 20, 2007 Im afraid that they cannot be completely invincible. I'm afraid this is not true ... <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">shilka addeventhandler ["dammaged",{(_this select 0) setdamage 0}]; shilka addeventhandler ["hit",{(_this select 0) setdamage 0}]; EDIT: Sorry for those brackets. Share this post Link to post Share on other sites
wld427 1705 Posted December 20, 2007 how exactly do i impliment this..... just put these lines on the INIT line? or do we need to script it Share this post Link to post Share on other sites
loyalguard 15 Posted December 20, 2007 how exactly do i impliment this..... just put these lines on the INIT line? or do we need to script it You should be able to just put it in the unit's init line using "this": <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">this addeventhandler ["dammaged",{(_this select 0) setdamage 0)}]; this addeventhandler ["hit",{(_this select 0) setdamage 0)}]; Share this post Link to post Share on other sites
wld427 1705 Posted December 20, 2007 so should it be like this? class Item91 { side="EAST"; class Vehicles { items=1; class Item0 { position[]={11909.950195,23.654215,11439.728516}; azimut=220.000000; id=748; side="EAST"; vehicle="zsu"; leader=1; skill=1.000000; init="this addeventhandler ["dammaged",{(_this select 0) setdamage 0)}]"; "this addeventhandler ["hit",{(_this select 0) setdamage 0)}]"; }; }; Share this post Link to post Share on other sites
loyalguard 15 Posted December 20, 2007 The code itself looks fine but did you type that directly into the mission.sqm or in the init field of the unit in the editor? The reason I ask is that I think that strings within strings (since the the init code is within all within a string (init = "")) like "dammaged" and "hit" need to be within double quotes (""dammaged"", ""hit"", etc.). When you type it in the editor it does this for you but if you type it yourself you need to do it manually. As such, I always recommend doing it in the editor. If you did type it in the editor, please ignore the above, it just didn't look right to me. Share this post Link to post Share on other sites
zaphod 0 Posted December 20, 2007 another way could be (i dont really know the mission goals): move the shilkas to a tiny island ... i mean, park'em there (inside a prohibited area) ... so the shilka is alive, but isn't really there and you can place it where you want during mission... or just "createvehicle" it as needed... maybe this doesn't fit your needs, but it can be a simple, but effective solution to "hide" existing vehicles... Regards, Zap Share this post Link to post Share on other sites
wld427 1705 Posted December 20, 2007 thanks guys i will place it int he editor instead of typing it Share this post Link to post Share on other sites
wld427 1705 Posted December 20, 2007 how exactly do i impliment this..... just put these lines on the INIT line? or do we need to script it You should be able to just put it in the unit's init line using "this": <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">this addeventhandler ["dammaged",{(_this select 0) setdamage 0)}]; this addeventhandler ["hit",{(_this select 0) setdamage 0)}]; it says its missin a semi colon but there it is at the end. take a look at my code lin this is all on one line on the init position[]={19313.173828,11.843280,14006.660156}; azimut=265.000000; special="NONE"; id=585; side="EAST"; vehicle="zsu"; leader=1; skill=1.000000; fuel=0.000000; init="this addeventhandler [""dammaged"",{(_this select 0) setdamage 0)}]; this addeventhandler [""hit"",{(_this select 0) setdamage 0)}]"; Share this post Link to post Share on other sites
baddo 0 Posted December 20, 2007 The number of parenthesis is wrong, already in Gaia's example... take the last ) away from both eventhandlers. Share this post Link to post Share on other sites
wld427 1705 Posted December 20, 2007 well now it works like a champion except for one part. The crew inside the vehicle is still "killable" how do i protect them as well? Share this post Link to post Share on other sites
baddo 0 Posted December 20, 2007 You will have to figure out a way to add the eventhandlers for each crew member as well. In fact, let's see if you can do it on your own... Â Edit: oh well I will give you something... I'm not 100 % sure if this works, but it is in the direction at least... add it to the vehicle's initialization field: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">this addeventhandler ["dammaged",{(_this select 0) setdamage 0}]; this addeventhandler ["hit",{(_this select 0) setdamage 0}];{_x addEventHandler["dammaged",{(_this select 0) setdamage 0}];_x addEventHandler["hit",{(_this select 0) setdamage 0}];} forEach (crew this); Note: this piece of script requires that the crew of the vehicle is in the vehicle right at the start of the mission. If they are not, but are outside, then you can just add to the initialization field of each individual unit the same as you gave to the vehicle: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">this addeventhandler ["dammaged",{(_this select 0) setdamage 0}]; this addeventhandler ["hit",{(_this select 0) setdamage 0}]; Share this post Link to post Share on other sites
wld427 1705 Posted December 20, 2007 thanks baddo thats how i had the mission set up with the crew in the vehicel to start. Share this post Link to post Share on other sites
baddo 0 Posted December 20, 2007 Notice that I just edited the code; I copy&pasted at first the same parenthesis error into my code. But is now fixed. Share this post Link to post Share on other sites
wld427 1705 Posted December 20, 2007 thanks Baddo your code line works perfectly Share this post Link to post Share on other sites
Specter 0 Posted December 21, 2007 as long as it's only for the ai you can use "this setcaptive true"... the shilka can still die but ai won't attack it Share this post Link to post Share on other sites
wld427 1705 Posted December 30, 2007 is there any way i can make them have unlimited ammo? or somehow constantly refil thier ammo? Share this post Link to post Share on other sites
Specter 0 Posted December 31, 2007 you need a way to figure out the amount of ammo the vehicle has and then make a "vehicle setvehicleammo 1" if needed... or you run a trigger on loop that uses that command to refill the ammo (as always: this is not tested) Share this post Link to post Share on other sites
wld427 1705 Posted January 2, 2008 so lets say the ammo box has 2000 rounds in it. then would it be.... vehicle "setvehicleammo" 2000; Share this post Link to post Share on other sites
Specter 0 Posted January 3, 2008 no as far as i understand it, the 1 indicates 100% ammo, while 0.5 would be 50% Share this post Link to post Share on other sites
wld427 1705 Posted January 4, 2008 i want to fit this properly in the init line "vehicle setvehicleammo 1" this addeventhandler ["dammaged",{(_this select 0) setdamage 0}]; this addeventhandler ["hit",{(_this select 0) setdamage 0}];{_x addEventHandler["dammaged",{(_this select 0) setdamage 0}];_x addEventHandler["hit",{(_this select 0) setdamage 0}];} forEach (crew this);"vehicle setvehicleammo 1" is this correct? Share this post Link to post Share on other sites
Specter 0 Posted January 6, 2008 replace "vehicle setvehicleammo 1" with "this setvehicleammo 1"... but i believe it still has a flaw: with the line being in the init it's just called on once, when the mission starts, so it doesn't refill the ammo... i couldn't find a command to check the actual ammo-amount during play which would make it possible to restock when the ammo is almost empty. maybe someone else knows how to get this working... i'm out of ideas ps: it might work, but it calls on the command a lot of times (don't know the actual syntax, just to give you an idea): this eventhandler ["fire",{(_this select 0) setvehicleammo 1}]; pps: you might want to check out the evolution farp rearm-script... it might help as well Share this post Link to post Share on other sites
wld427 1705 Posted January 6, 2008 thanks for your help spectre i took a look into the evo scripting but it requires the player to be in the vehicle for it to refil teh ammo.... Share this post Link to post Share on other sites