Goro 21 Posted April 20, 2017 Hello, everyone! Basically, what I want to do is to damage vehicle's chasis (hull) and engine after x roadkills (let's say the count will be 15). I want to prevent player from using it as a ramming device. If this is going to help you out somehow, the vehicle name would be SUV, and the enemy is OPFOR side. Thank you all in advance for replies! Share this post Link to post Share on other sites
Grumpy Old Man 3544 Posted April 20, 2017 What did you try already? Cheers Share this post Link to post Share on other sites
Goro 21 Posted April 20, 2017 4 hours ago, Grumpy Old Man said: What did you try already? Cheers I have not tried anything yet. I've been thinking about script that counts how many OPFOR units player roadkills while inside the car, then eventually execute the script Share this post Link to post Share on other sites
sarogahtyp 1108 Posted April 20, 2017 My personal opinion is that if someone asks for help then he should have written some not working code. In this case i m happy to help to get that code working and to optimize it.But if u have nothing then there is a forum to order the script u want. Maybe someone throws the link to it.If u want that i think about ur desired code then show me your own attempt first. It doesn't matter if this is only one line of code which is not working. You should get help here to get it working. .But this is only my own personal opinion...sent from mobile using Tapatalk Share this post Link to post Share on other sites
Goro 21 Posted April 20, 2017 8 minutes ago, sarogahtyp said: My personal opinion is that if someone asks for help then he should have written some not working code. In this case i m happy to help to get that code working and to optimize it. But if u have nothing then there is a forum to order the script u want. Maybe someone throws the link to it. If u want that i think about ur desired code then show me your own attempt first. It doesn't matter if this is only one line of code which is not working. You should get help here to get it working. . But this is only my own personal opinion... sent from mobile using Tapatalk I am not asking for the entire script, I'd just need a script counting how many OPFOR soldiers the player has killed or a script detects whenever the kill was a road kill. I even have no clue where to start Share this post Link to post Share on other sites
pierremgi 4817 Posted April 20, 2017 Yep, my opinion is slightly different. As some people can push their working/complete scripts here, and it's a good idea, there is no reason to avoid some topics even if no clue to start. I like the challenges. And I just skip the topics without answer or interest for me. This topic is clear and seems to me interesting. I attempted to use EH "epeContactStart", which could be smart, but that doesn't work on non physX object (like man). That works with contact on vehicles like cars. So, here is not a perfect script, but a track to what you intend to do: {_x addEventHandler ["killed", { _victim = _this select 0; _killer = _this select 1; if (!isnull objectParent _killer && _victim distanceSqr _killer < 25) then { _dam = vehicle _killer getHitPointDamage "hitHull"; vehicle _killer setHitPointDamage ["hitHull",_dam + 0.3] }; }] } forEach allUnits; Spawned units are not taken into account here. 1 Share this post Link to post Share on other sites
Grumpy Old Man 3544 Posted April 21, 2017 You could get a better tracking of killed units if you're using the missionEventHandler "EntityKilled", filter for the killer to be a vehicle and the killed to be a vehicle. No need to add killed eventhandlers on every object. The setHitPointDamage command as mentioned by @pierremgi should cover everything the thread starter wants. Cheers Share this post Link to post Share on other sites
Goro 21 Posted April 21, 2017 14 hours ago, pierremgi said: Yep, my opinion is slightly different. As some people can push their working/complete scripts here, and it's a good idea, there is no reason to avoid some topics even if no clue to start. I like the challenges. And I just skip the topics without answer or interest for me. This topic is clear and seems to me interesting. I attempted to use EH "epeContactStart", which could be smart, but that doesn't work on non physX object (like man). That works with contact on vehicles like cars. So, here is not a perfect script, but a track to what you intend to do: {_x addEventHandler ["killed", { _victim = _this select 0; _killer = _this select 1; if (!isnull objectParent _killer && _victim distanceSqr _killer < 25) then { _dam = vehicle _killer getHitPointDamage "hitHull"; vehicle _killer setHitPointDamage ["hitHull",_dam + 0.3] }; }] } forEach allUnits; Spawned units are not taken into account here. 6 hours ago, Grumpy Old Man said: You could get a better tracking of killed units if you're using the missionEventHandler "EntityKilled", filter for the killer to be a vehicle and the killed to be a vehicle. No need to add killed eventhandlers on every object. The setHitPointDamage command as mentioned by @pierremgi should cover everything the thread starter wants. Cheers Thank you! This is all I need, I'll get to editing it now. You guys are da bomb! Share this post Link to post Share on other sites
Goro 21 Posted April 22, 2017 Okay, I ran into problems... lol. I'll need your help now if (isServer) then { addmissioneventhandler ["EntityKilled",{ params ["_killed", "_killer"]; if (side _killed == east) then { "fuckup.sqf" remoteExec ["ExecVM", (owner _killer)]; }; }]; }; This is my activation script. My fuckup script is simple, as I wanted to check if it's working. suv setdamage 1; I placed the vehicle on the map, but as soon as I kill OPFOR soldier, nothing happens. No error pop-ups at the same time. Any ideas what could be wrong? I tried removing (owner _killer), but the same issue keeps happening... 1 Share this post Link to post Share on other sites
Grumpy Old Man 3544 Posted April 22, 2017 Killed units and vehicles will always be of the civilian side. Units stay within their group for a bit after death, so you need to check for the side of the units group: if (isServer) then { addmissioneventhandler ["EntityKilled",{ params ["_killed", "_killer"]; if (side group _killed == east) then { "fuckup.sqf" remoteExec ["ExecVM", (owner _killer)]; }; }]; }; Cheers Share this post Link to post Share on other sites
Goro 21 Posted April 22, 2017 Your solution works like a charm! Thank you so much! Share this post Link to post Share on other sites