-
Eventhandler "hit" doesnt work on some objects??
Hey
I have created an loudspeaker object from the small objects menu. The problem is, that a addeventhandler hit, doesnt work on it. Here is my code:
this addEventHandler ["hit", {[] execVM "speakerhit.sqf"}];
in the speakerhit.sqf I just have a hint "hey";
Ive tried putting this eventhandler on a soldier and it works. I have tried a barrel and a road cone and both work, but not on objects, where they not have an icon in the editor, but just a question mark.
Can it be true that it doesnt work with those question mark objects?
Can I somehow simulate this? Maybe make a road cone invisible (but still hit-able), so that when the invisible road cone gets hit it hideObject's the loudspeaker?
I have tried hideObject on the road cone, but it can't be hit by bullets.
Any suggestions?
/Jacob
-
Second Lieutenant
"Hit" doesn't activate because the object doesn't get enough damage. Some objects just don't get damage from projectiles.
Last edited by Celery; Jun 4 2011 at 14:36.
-
Ahh okay, but I still can't get it working. I have tried this code:
this addEventHandler ["HandleDamage",{[] execVM "speakerhit.sqf"}]
But it still wont run the script..
---------- Post added at 15:18 ---------- Previous post was at 14:46 ----------
Okay, ive found out that the loudspeaker can't take any damage. I tried with the same loudspeaker, just from the EU misc folder and that can take damage.
Now I just need to increase the damage that a bullet does to the speaker. I have found this, but it reports and error back that I can't see a solution for. This is the code:
this addEventHandler ["HandleDamage",{if (_this select 3=="") then {damage (_this select 0)+(_this select 2)*10}}]
The error should be here (_this select 3(ERROR)=="")
Can you help me out here Celery?
-
If you want the speaker to be damaged by just one shot, simply have the HandleDamage EH destroy the object once it triggers maybe?
-
And how would I do that? I have tried to run a script that setdamage 1 to the speaker, but that doesnt seem to work.
---------- Post added at 15:31 ---------- Previous post was at 15:25 ----------
Okay got it working. This code did the trick:
this addEventHandler ["Handledamage",{_this select 0 setdammage 1}];
-
Great! Happy speaker shooting. heh
-
hehe thank you and thanks for the help!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules