Jump to content
Sign in to follow this  
BoweryBaker

reasonable radio man script idea

Recommended Posts

I'm trying to think of a way that if one of these radioes from these mods is fired off, since they are a weapon, that could somehow get an audio file to play.  

Scenario:  Your team will be assigned a radio but we'll only be able to contact you as soon as you turn it on.  We'll be waiting.  Once your radio is activated we'll know its safe to transmit to you, so keep it off unless you're sure our transmission won't be picked up.  Then when you turn it on, be somewhere safe from the enemy and put the transmission on for the whole team to hear.  

Is this possible?  

maybe [radioweaponname, radioman, audio file]exec "transmission.sqm"

So what you get is, you're the radioman, you fire the radio weapon after choosing it, an audio file plays. How simple! biggrin_o.gif Yes in this case thats a good thing.

Talk to me scripters, is this possible? If so, please tell me, then release to ofpec.

Share this post


Link to post
Share on other sites

Should be easy to realise. Also some (maybe all, don't know for sure) of the radios already got a soundeffect when fired.

And "theavonlady" is right, use the fired-event.

Share this post


Link to post
Share on other sites

This should work:

first name your radio man "radioman"

then get the editor name of his radio.

Then in the init field of the radioman type in:

radioman AddEventHandler ["fired",{_this exec "onfiring.sqs"}]  

in the on activation field of the trigger put in: radioman say "nameofaudiofile"

I just need the trigger to know that the script has been executed.  Like condition:  "onfiring.sqs"

or something like that.  

I just don't know where to put the returned value of if the weapon is fired. The research continues...

Share this post


Link to post
Share on other sites

A quote from Igor Drukov's EH guide:

Quote[/b] ]Here are the returned values of the most famous EH, "fired", which can be added to either vehicles or men :

_this select 0 : who fired ;

_this select 1 : with what weapon ;

_this select 2 : with what muzzle (your M16, or M203 ?)

_this select 3 : mode ? (either single, or burst, or auto)

_this select 4 : the type of ammo used.

Technically, what does it mean ? That if you type :

joe AddEventHandler ["fired",{_this exec "onfiring.sqs"}]

you can start your "onfiring" script with :

_man=_this select 0

_ammo=_this select 4,

the script will have recognized these values.

You may find the complete tute here.  I hope that this gets you going in the right direction as you idea sounds great (pun intended)!

                                                    Wadmann

EDIT: Oh, I see want you are looking for. You could then try:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_man = this select 0

_weap = this select 1

?_weap = correctradioname goto #message

#message

_man say "yourmessage"

;or even

[_man] exec "radiomessage.sqs"

I am not a scripter and this was put together at work so check all syntax but you should get the idea. You would also need something to point to #end if weapon was not the radio. Hopefully a real scripter will come along and help you out proper. Maybe try this in scripting and editing or even over at OFPEC.

Share this post


Link to post
Share on other sites

I tried this as my onfiring.sqs file:

radioman = this select 0

SJB_TOS_Satcom = this select 1

?SJB_TOS_Satcom = SJB_TOS_Satcom goto #message

#message

radioman say "evac"

Nothing worked. So I figured I'd change the init from:

radioman AddEventHandler ["fired",{_this exec "onfiring.sqs"

"}]

to:

radioman AddEventHandler ["empty",{_this exec "onfiring.sqs"}]

still nothing happened. I still got that generic static noise. i'm thinking of going into the binarized tos seals deal, looking at the scripting to the weapon and seeing what makes the static noise, thats the answer right there.

Share this post


Link to post
Share on other sites

Try this:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

_radioman = _this select 0

_radio= _this select 1

?_radio == "SJB_TOS_Satcom": goto "message"

exit

#message

_radioman say "evac"

RED

Share this post


Link to post
Share on other sites

Thanks for clearing that up Red.  I think the problem is in the event handler.  is dryfire an event handler?  the satcom doesn't necessarily fire.  Its a dryfire that makes the static noise happen and it doesn't have ammo.  So is there a dryfire event handler? I'm looking at the name of the ammo for the satcom and it says displayNameMagazine="SatCom Battery";

shortNameMagazine="Battery";

I don't want this thing to fire off a missile though....thats why I'm hoping I can get a sound to play from dryfire alone. Where can I get an eventhandlers list?

Share this post


Link to post
Share on other sites

Yes you are correct, if a weapon doesn't have ammo it won't fire. Unfortunately there is no such eventhandler that will help you get around this.

RED

Share this post


Link to post
Share on other sites

The only eventhandlers are:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

"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

Taken from the command ref.

RED

Share this post


Link to post
Share on other sites

class SJB_TOS_Satcom: LAWLauncher

{

scopeWeapon=2;

scopeMagazine=2;

nameSound="weapon"

model="\SJB_TOSM4\SJB_Satcom.p3d";

modelOptics="";

picture="\SJB_TOSM4\inventory\w_satcom.paa"

sound[]={"\BAS_Weap\satcom\mic_out1.wav",20,1};

reloadSound[]={"\SJB_TOSM4\sound\mic_out1.wav",20,1};

drySound[]={"\SJB_TOSM4\sound\loop.wav",20,1};

weaponType=WeaponSlotSecondary;

magazineType=WeaponNoSlot;

ammo="SJB_TOS_Satcom";

displayName="SatCom AN/PSC-5D";

displayNameMagazine="SatCom Battery";

shortNameMagazine="Battery";

reloadTime=1.0;

canLock=1;

valueWeapon=20;

optics=0;

forceOptics=0;

count=100;

primary=0;

uiPicture="\SJB_TOSM4\satcom\icon_rto.paa";

canDrop=1;

};

that is from the cpp of the satcom. as you can see it has no magazines entry, therefore it cannot be fired, therefore i cannot trigger a sound file to play for if this weapon is fired. It would seem.

Share this post


Link to post
Share on other sites

There was this one time I tried it, and I didn't get a sound at all, no static no nothing. I think i got close that time.

Share this post


Link to post
Share on other sites

There are two ways I can think of to get this working, but both require that you make a new radio addon (or atleast change the config slightly)

1. Just change the dry sound to something else, but that will only allow one sound so will probably not be what you are looking for.

2. Make it use a magazine, detect that it has been fired, then add a magazine each time it does.

RED

Share this post


Link to post
Share on other sites

Shouldn't this be in the ME&S board? rock.gif

Anyway, you could get the same end result just the same by using either an action, or a radio trigger. That way, there is no need to make a new addon. Is there any particular reason why this stuff has to be initiated from the left mouse button?

Share this post


Link to post
Share on other sites
Yes.  To make you remember your job if you're the radioman amidst confusion.

rock.gif

I'm not following you. How would using an action instead of "firing" the radio be different?

Share this post


Link to post
Share on other sites

No-one likes a huge action menu, makes performing urgent actions take more time than you have in most cases (e.g. "Wear Beret", "Wear Helmet", "Trigger Radio", "Swat fly", "Break wind", "Reload M4A1 Magazine" etc - not only looks unsightly, but hinders gameplay). BoweryBaker, I know we spoke on MSN about this yesterday, and just to remind you, making a new addon would definately be the easiest way, add a magazine (and the ammo type - if I'm not mistake its the ammo/bullet fired that is detected by the "fired" eventhandler, not the magazine), and then go from there. Also, you're free to modify the config.cpp of my SATCOM in your new addon (please don't alter the existing config as that'll cause conflicts), the model how-ever you'll need to gain the permission of the BAS Team (Deadmeat, Tigershark etc).

Share this post


Link to post
Share on other sites

I know this isn't going to make any difference, but you usually got to pick up the phone before the talking commences. That's why I wanted it that way. Mods feel free to close the thread. This is impossible.

Share this post


Link to post
Share on other sites

Its not impossible if you simply make your own radio addon (feel free to use my config coding as a base, but you'll have to ask Deadmeat's/BAS' permission for the model), and give it a magazine (and ammo, then you can use the "fired" event-handler. As the addon will only be about 800kb max. it can easily be distributed with your mission/campaign.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×