OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting Multiplayer => Topic started by: Speeder on 11 Apr 2005, 18:28:05
-
I was kinda hoping that someone would make a script for me.
It need to do the following:
Only pilots can enter as driver/gunner in chopper
only crew can enter as driver/gunner in amored vehicles.
If a nother unit than the one defined tries to enter as driver/gunner, they should be disembarked, but the message that they are not certified to oberate the kind of vehicle.
I think the units I'm using are the ones starting with SUCH- that is SuchSoldier Suchcrew - or something like that..
Thanks for the help
PS: script must be MP compatible
-
add a getin eventhandler per vehicle, basically this runs a script, it questions either the unit variable name or class of unit and if it isnt a desired unit type, ejects them
-
Could you please write it a bit more like a walkthrough...tut or something like that - I never used an eventhandler before, I know nothing about them
-
I can't get it to work.. Tried everything exept the right thing :)
I write this in the init of MyHeli1
MyHeli1 AddEventHandler ["getin", {[] exec "allowGetIn.sqs"}]
This is my allowGetIn.sqs
_vehicle = _this select 0
_pos = _this select 1
_who = _this select 2
#tjek0
? _pos != cargo : Goto "tjekname" ELSE exit
#tjekname
?(_who) != (name pilot1) OR (_who) != (name pilot2) : Goto "Ejectplayer" ELSE exit
#Ejectplayer
(_who) action ["EJECT",_vehicle]
exit
What am I doing wrong?
-
The syntax
? : else
is not correct. You can use
if then else
but check the syntax. Although if then does much the same thing as ? :, the two are not interchangeable.
I am not familiar with eventhandlers and scripting in MP so this may be a redundant comment, but make sure that your script will eject the loon on all computers, not just locally.
-
Try:
MyHeli1 AddEventHandler ["getin", {_this exec "allowGetIn.sqs"}
That might work better......maybe ;D
Planck
-
If I want to add the eventhandler to all units on one side, could I then use this?
?side _x == east foreach Thislist : "_x addeventhandler [""killed"",{civdied = civdied + 1}]"
or what is the syntax?