xawery 0 Posted July 8, 2008 Hi all, I'm trying to achieve the following in my mission, and I was hoping you experienced types could help me make it come true I'm making a trapped-behind-enemy-lines type of mission. The player is a downed pilot desperately trying to reach an extraction zone. The island is crawling with soldiers and civilian life (thanks to the awesome DAC!. What I want to do is give the player the opportunity to hide in the back of civilian vehicles. In other words, I don't want the enemy to engage the player if he's inside a vehicle (for simplicity's sake), unless he comes in close proximity of an enemy soldier. I imagine this will involve manipulating the knowsabout value. My first approach was as follows: create a trigger that sets the player (s1) captive if he's in a car and his knowsabout value relative to enemy e1 is below a high number, say 3.5 (off the top of my head). That way, unless the player passed right under the enemy's nose, he would not be engaged. Naturally, this didn't work otherwise I wouldn't be writing this post Even if it did, I wouldn't be able to use it on all the enemies on the map. Well then, oh knowledgeable types! Any suggestions? Share this post Link to post Share on other sites
squeeze 22 Posted July 9, 2008 you might want to approach this from a different angle...... <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">this addEventHandler ["getin", {(_this select 2) setCaptive true;(_this select 0) setCaptive true}]; this addEventHandler ["getout", {(_this select 2) setCaptive false}] put this in the init line of a vehicle to test, I'd see this as a foundation to a larger script. http://community.bistudio.com/wiki/addEventHandler Share this post Link to post Share on other sites
xawery 0 Posted July 12, 2008 Hey Squ33z3, thanks for the tip! I hadn't even considered event handlers. Would it be possible to apply an event handler to an entire class of vehicles, e.g. cars? The problem is that all the vehicles in the mission are spawned using DAC, so I don't really have the opportunity to add an event handler per vehicle... Regards, X. Share this post Link to post Share on other sites
squeeze 22 Posted July 13, 2008 use iskindof http://community.bistudio.com/wiki/isKindOf With DAC, I havn't looked at DAC for ArmA but a good starting point would be to do a text search for "createvehicle". Share this post Link to post Share on other sites
xawery 0 Posted July 14, 2008 Ah yes, I was considering isKindOf already. If I understand this correctly, I should be able to attach this eventhandler to all vehicles of the "car" class by adding something like this to the init.sqf: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">if (vehicle player isKindOf "Car") then {(vehicle player) addEventHandler ["getin", {(_this select 2) setCaptive true;(_this select 0) setCaptive true}]; (vehicle player) addEventHandler ["getout", {(_this select 2) setCaptive false}]} Now, I'm pretty damn sure that's not proper syntax  You've already helped me a great deal sq33z3; my gratitude would reach new heights if only you'd tell me how to add this to the init properly  Share this post Link to post Share on other sites
squeeze 22 Posted July 14, 2008 open DAC\Scripts\DAC_Group_Vehicle.sqf under the comments... //----------------------------- //#endcreate //----------------------------- add <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> if ((_vehc isKindOf "Car")and((side driver _vehc) == civilian))then { _vehc addEventHandler ["getin", {(_this select 2) setCaptive true;_vehc setCaptive true}]; _vehc addEventHandler ["getout", {(_this select 2) setCaptive false}]; }; I put the ((side driver _vehc) == civilian)) in so only civ vehicles can be used to hide in. Also I ran a test and noticed that you can just shoot the driver and steal a car to fool the enemy so it would still need more added to it. it might be better to start a script with the EventHandlers so to get better results. Share this post Link to post Share on other sites
xawery 0 Posted July 14, 2008 Thanks a lot sq33z3, I'm beginning to understand how this would work I also noticed the problem with the player killing the driver. Wouldn't it be possible to solve this by adding (player != driver _veh) to the initial conditions? Share this post Link to post Share on other sites