OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: Nemesis6 on 19 Jun 2004, 20:14:41
-
Here's the thing, it's a drop command script that's intended to be added by a hit EventHandler. So when a unit is hit with a 30MM cannon for example, the unit ejects small debris parts. The problem is, when I add it to the player and another unit and shoot the other unit, it is only myself who eject debris... I am curtain that it is the positional stuff that screws up. It works when I make more scripts with the unit's names... anyway, here's the example mission. Just add the eventhandler to the player, too.
-
bumpz0r
-
When you add your hit event I think it should be:
this addEventHandler ["hit",{_this exec "debris.sqs"}]
The "_This" between the {} is an array supplied by the event itself.
_this select 0 : who's hit (can be either a man or a vehicle) ;
_this select 1 : who did (h)it ;
_this select 2 : scalar damage value.
Take a look here for more on events:
http://www.ofpec.com/editors/resource_view.php?id=543 (http://www.ofpec.com/editors/resource_view.php?id=543)
The same applies to your script:
? "Ch47D" counttype [this] == 1 || "Mi17" counttype [this] == 1|| "MI24" counttype [this] == 1|| "Kamov" counttype [this] == 1|| "SU25" counttype [this] == 1|| "Cobra" counttype [this] == 1|| "A10" counttype [this] == 1|| "A10LGB" counttype [this] == 1|| "AH64" counttype [this] == 1|| "UH60" counttype [this] == 1|| "UH60MG" counttype [this] == 1: _weight = 1.2
You cant use This from within a script, I think the value your after would be (_this select 1) e.g
? "Ch47D" counttype [(_this select 1)] == 1....e.t.c
Sorry I cant test more, but to be honest if I where you I would start from scratch again and do it one step at a time. Try and get the vehicle thats firing first, before worrying about the drop command. For example you could use:
Debris.sqs
_Target=_This Select 0
_Firing=_This Select 1
_Vehicle=Vehicle _Firing
If ((TypeOf _Vehicle) In ["Ch47D","Mi17","MI24","Kamov"]) Then {Hint Format ["You are being fired at by a %1",TypeOf Vehicle]}