OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: subroc on 24 Aug 2006, 17:02:43

Title: addaction to radioweapon
Post by: subroc on 24 Aug 2006, 17:02:43
hi

im making a recon mission where the players group is supposed to be deep behind enemy lines reporting enemy movements to HQ. To do this they must have their radio with them at all times (BAS Satcom or similar). and the only one that should be able to send messages should be whichever unit having the radio at his disposal and none else. so if the radioman is killed another loon can pick up the radio and act as radioman.
the the radio messages should be send by addaction commands and the actions should only be seen by the radioman.

what is the easiest way to do this?

i was thinking of using a trigger covering the whole operations area which checks for condition "hasweapon bas satcom" (or whatever syntax) and on activation addaction to thislist

Title: Re: addaction to radioweapon
Post by: Mr.Peanut on 24 Aug 2006, 17:47:43
Someone has already written a comprehensive package to do all this and more.  It was on the old pre-crash OFPEC site, I think under pending resources.  Perhaps the person who originally submitted it, could post it here?

I am not sure whether this package will be recovered in the Editors Depot reconstruction.
Title: Re: addaction to radioweapon
Post by: Terox on 25 Aug 2006, 00:24:09
if i were to do this, i would probably attach a "fired" event handler to every player

this would activate if the fired weapon was a radio and then either
a) send the required data from the script that the fired event handler runs

or

b) if the player does not have an action attached to them, add it

this would be more efficient than a trigger


;; NB>> EXPECT SYNTAX errors, code untested but you should get nthe idea


INIT.SQS

Quote
Tx_NoAction = true
;; NB>> following syntax may be incorrect, unable to test at present)
Player addeventhandler ["fired", (if ((typeof _this select 0 )== "bas satcom" )then{_this exec "myscript.sqs"})]


MyScript would either then simply run the code you require for the radio transmission
or
It could be used to addaction to the unit

MYSCRIPT.SQS
Quote
?!(Tx_NoAction): exit
Player addaction ["Send report","SendReport.sqs"]
Tx_NoAction = false

NB  if the player can respawn, then utilising a killed event handler, you would need to re-add the fired eventhandler after he respawns, to allow contiued monitoring using the fired event


eg
INIT.SQS
Quote
Player addeventhandler ["killed", _this exec "respawn.sqs"]

RESPAWN.SQS
Quote
player removealleventhandlers "Fired"
player removealleventhandlers "Killed"
@ alive player
Player addeventhandler ["fired", (if ((typeof _this select 0 )== "bas satcom" )then{_this exec "myscript.sqs"})]
Player addeventhandler ["killed", _this exec "respawn.sqs"]




Title: Re: addaction to radioweapon
Post by: subroc on 25 Aug 2006, 08:43:16
thx! i will try this. from what iÂ've understand the eventhandlers doesnÂ't work in MP games right?
so if i later on want to convert this to a mp game what would be the best method?
Title: Re: addaction to radioweapon
Post by: Chris Death on 25 Aug 2006, 13:06:30
hmm - as far as i remember the "fired" eventhandler doesn't recognize the radio fire button so it's rather
useless in this situation.

About your trigger covering the whole map:

I don't think you'd need such a monster trigger, since you know who could be able to pick up a radio.
No AI controlled unit without a player in their lead will pick up any radio upon it's own.

I got to go to work now but i have some old mission where i made exactly this and it's been for multiplayer
also - i think i even got the mission at work.
I'll take a look later and post what i found (if i did).  ;)

~S~ CD
Title: Re: addaction to radioweapon
Post by: Terox on 25 Aug 2006, 16:42:57
hmm - as far as i remember the "fired" eventhandler doesn't recognize the radio fire button so it's rather
useless in this situation.
.

thanks chris, didnt know that, i would expect the cause being that most ofp radio's dont have any ammo


Ref mp compatability event handlers and passing strings or arrays over a network.

CoC_Ns is the solution. It's fairly simple to use, but on the surface looks very complicated, the documentation doesnt help a newcomer to it
Title: Re: addaction to radioweapon
Post by: Mr.Peanut on 25 Aug 2006, 17:02:54
The solution is for whoever wrote the RadioBearer suite to repost it here.