OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: @cero on 27 Jan 2003, 10:45:20
-
Hi all.
I noticed that when sniping If I miss the first shot no a single unit care about it and thei just stand still or doing what the waypoint say instead of run or look for me.I would like to know if is there a way to activate a trigger from the very second a wapon gets fired. What I do is to change everyones behaviour like if it was in real life. I tryed lots of different things, but none of them seem to be reliable, they change from one game to the other, so if anyone knows how to activate a triger by a shot, please let me know, please, please please... ;D
@cero.
-
player addEventHandler ["FIRED", "myValue=true"]
that's one possibility, but you should use an EventHandler for this!
-
Event handler, isn't that a kind of script? ;D I know, I should know by now.
I'll get some info about it, at list you can tell me how to create the even handler ;D cheekyyyyy, lol
@cero
-
Did you read the ComRef?
object addEventHandler handler
Operand types:
object: Object
handler: Array
Type of returned value:
Number
Compatibility:
Version 1.85 required.
Description:
Format of handler is [type,command]. Check scripting topic Event handlers for more information. Index of currently added handler is returned.
Example:
player addEventHandler ["killed",{_this exec "playerKilled.sqs"}]
I'm certain you didn't search, either, so I'll be friendly and post the answer to your next question, "What event handlers are there?"
Event handlers
Description:
Event handlers can be defined in unit config or by function addEventHandler. Multiple handlers can be attached at one time. Event handler types are defined below. Each handler receives arguments in _this, argument types and meaning are defined below.
"Killed" object:killer
"Hit" object:causedBy,scalar:howMuch
"Engine" bool:engineState
"GetIn" string:position (1),object:unit
"GetOut" string:position (1),object:unit
"Fired" string:weapon,string:muzzle,string:mode,string:ammo
"IncomingMissile" string:ammo,object:whoFired
"Dammaged" string:selectionName,scalar:howMuch
"Gear" bool:gearState
"Fuel" bool:fuelState
"Init" No arguments
(1) position can be "driver", "gunner", "commander", "cargo"
MP notes: "Killed" and "Hit" event handlers are executed where given unit is local. All other event handlers are executed on all computers. Events added by addEventHandler may be different on each computer.
-
Did you read the ComRef?
Well, do you? I mean, like from top to botton, no, I didn't, and I certanly don't look at something and say, oh, this have to do with Event Handlers, when I don't even know what a Event Handler was :o :o :P ;D Sorry if I P you off :-\ :'( ::)
I'm certain you didn't search, either, so I'll be friendly and post the answer to your next question, "What event handlers are there?"
Actually, I did, so I put Event Handler in the search thingy, and I get 3 results, and only one have to do with it :o ;D I may spell it whrong and all, my english is going backwards, you know? LOL ;D
In conclusion, thanks alot for you help and for being friendly, in this sad world the last thing you would espect from people is being friendly.
TY.
@cero