OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: Mox2002 on 17 Jun 2003, 19:33:36
-
I'm trying to built a script which lets a m113(for example) function as a minelayer.
Now, here is the script :
=============================================
; 1. name of bomber unit (e.g. blackop)
1 setradiomsg "null"
2 setradiomsg "Abort"
_bomber = _this select 0
_target = _this select 1
_hpad = _this select 2
_mal = _this select 3
_wmal =_mal
#again
_bomber AllowDammage FALSE
_bomber setdammage 0
RemoveAllWeapons _bomber
_bomber addmagazine "MINE"
~1
_x=(getpos _target select 0) -( sin getdir(_target)*7)
_y=(getpos _target select 1) -( cos getdir(_target)*7)
; put bomber high in the air (invisible)
_bomber setpos [_x, _y, 2000]
_bomber fire ["put","MINE"]
~.1
; move bomber away again
_bomber setpos getpos _hpad
? stopp==1:goto "exit2"
_mal=_mal-1
? _mal==0 : goto "exit"
hint format["There are\n%1 Mines\laid",_mal]
goto "again"
#exit
1 setradiomsg "Autom. Minesystem"
2 setradiomsg "null"
hint format["A total of\n%1 Mines\was laid",_wmal]
stopp=0
exit
#exit2
1 setradiomsg "Autom. minelayer"
2 setradiomsg "null"
hint "Not all mines were laid"
stopp=0
exit
===============================================
The problem now is that this script is activated by radio and here I run into a small problem for which I cant find the correct syntax.
Question: How do I make it work that only a player which is inside the m113 gets access to the radio-options which activate the script?
Currently its possible to activate it outside as well wich is kinda stupid.
Also I would like the script to check if the m113 has moved since the last mine
was laid since it would otherwise stack mines on top of eachother when the m113 is not moving.
I could realy use some help on this one, I guess it would make a nice MP script once its tweaked a little.
Plz take a look at the attachment for the testmission, triggers etc.
Thanks in advance.
-
try using the addaction command instead of radio then...
create a trigger, which repeats and add the condition:
player in m113name
and then ad on activation:
layer = player addaction ["Lay Mine", "minelayer.sqs"]
and on deactivation
player removeaction layer
that will give the player the option to lay a mine (depends how ur script works) only when he is inside the vehicle
hope that helps.
-
Thanks but it doesnt work, maybe you can take a look at the testmission I included to see where the problem lies.
I think the main problem with the script is that its far to complicated, someting tells me there should be an easier sollution to letting a vehicle pop out mines on command but I cant think of one.
-
:D I'd suggest something like mezzy's sayings.
Off course, ya could specify the conditions a bit (so that it is the "gunner" and not the driver or passengers who drops the eggs).
Say, the m113 is named "M" ::)
condition:
MG == player && (MD in MG) && (Damage M <= 0.6) && !(MD == player)
or alike... :P :) the last part is to prevent the "manual fire" driver option from cheating, so that the vehicle DOES need at least two crew members.
uuuum, well... about the scroll, the activation, the laying....
:) I'd suggest an "addaction" like mezzy's, only the script itself could be much more simplified. Like if the "M" vehicle dropped a mine for each 5 seconds (or minutes or whatever) - yer choise!
And when the player hits the "deactivate" action button, the auto laying stops.
Or you could make the addaction a SINGLE-DROP-ACTION (SDA) :D 8) ;D
That way, the action is fired, a mine is camCreated right behind the vehicle, and the action gets instantly removed (and pops up again right away). Then you hit the action button again, and yer vehicle drops yet another mine etc. :-*
That would just take a very short scroll :)
-
Thanks for helping out!, the only problem I have is the actionmenu, all works fine but not inside the m113...I get the menu when I leave the vehicle but not inside...?