Home   Help Search Login Register  

Author Topic: BAS SATCOM eventhandler?  (Read 661 times)

0 Members and 1 Guest are viewing this topic.

Cannon

  • Guest
BAS SATCOM eventhandler?
« on: 26 Jul 2004, 02:08:54 »
Hello there everyone,

This ll be my first post, and it comes with a good dilema. I am trying to do a script that will work when someone uses the BAS_Satcom radio, if he/they use it a radiocall will be made for extraction. Unfortunatelly the eventhandler does not recognize the radio as a "weapon". This is what I got now.

Note: It works fine with any weapon (m16, pistol and even granades (throw)), but when I "fire" with the satcom, the eventhandler doesnt recognize any fields.

l1 AddEventHandler ["fired",{_this exec "onfiring.sqs"}]
;l1 is the name of my testing guy as of right now

Code: [Select]
;onfiring.sqs

_dude = _this select 0
_wep = _this select 1
_muzzle = _this select 2
_mode = _this select 3

hint format ["%1's is firing with %2 and %3, on %4 mode", _dude, _wep, _muzzle, _mode]

#start
? _wep == "BAS_Satcom" : goto "radioheli"
? _wep != "BAS_Satcom" : goto "goaway"

#radioheli
_dude sidechat "Delta to Bravo Black. We need EVAC. Out."
~2
[] exec "takeoff.sqs"
exit

#goaway
exit

Offline Planck

  • Honoured
  • Former Staff
  • ****
  • I'm never wrong ....I'm just not always right !
Re:BAS SATCOM eventhandler?
« Reply #1 on: 26 Jul 2004, 20:14:40 »
What error message do you get, if any?

I would try changing the name from '|1' to something else.


Planck
I know a little about a lot, and a lot about a little.

Cannon

  • Guest
Re:BAS SATCOM eventhandler?
« Reply #2 on: 27 Jul 2004, 01:21:17 »
Hi, I dont get any error message. as I said, it works perfectly when I fire using a M16, a BAS M4 silenced, any pistol, or I throw any grenade, flare... but the BAS_Satcom must be an object that does not have any fire event attached to it....

So what I would love to do is bring the chopper down for extraction when someones uses the Satcom radio.

Changing from 'l1' to some other name does not work either. If you got the BAS addon, get a Delta Radio operator, copy this script and try it.  :-\
« Last Edit: 27 Jul 2004, 01:25:21 by Cannon »

HuNtA

  • Guest
Re:BAS SATCOM eventhandler?
« Reply #3 on: 27 Jul 2004, 13:11:14 »
mayb make a script that checks every 10 seconds (to reduce lag) wether U have the  BAS Satcom, then when U have it, uses AddAction to launch the extraction

Code: [Select]
_man = _this select 0
#check
~10
?_man hasWeapon "BAS_SATCOM":goto "action"
goto "check"

#action
radioaction = _man addAction ["Extraction","extract.sqs"]

#check2
~10
?_man hasWeapon "BAS_SATCOM":goto "check2"

#noweapon
_man removeAction radioaction
goto "check"

that hasnt been tested, so I dont know wether it will work
« Last Edit: 27 Jul 2004, 13:12:51 by HuNtA »

DBR_ONIX

  • Guest
Re:BAS SATCOM eventhandler?
« Reply #4 on: 27 Jul 2004, 14:02:36 »
I think Huntas way should work.. Put a smaller loop in though.. 2 seconds shouldn't make any lag..
The BAS SATCOM doesn't make any projectile, so the first script wounldn't work (It checks for what bullet is fired)
What about if you use the about script.. And when the player calls for evac, use either the player fire "BAS_satcom" (ish ::)), or the playsound command (Look in the readme for the name, or it might show up in the editor..?)
- Ben

Cannon

  • Guest
Re:BAS SATCOM eventhandler?
« Reply #5 on: 27 Jul 2004, 17:46:01 »
Thank you both for ideas. Heres a long post so bare with me :) Im writing as I think hehe

DBR_ONIX: Exactly that is what I though first, since it doesnt really "fires", I mean no proyectile comming out as you said, fire eventhandler wont work.

use either the player fire "BAS_satcom" (ish ), or the playsound command...
I dont understand what you mean  :-[
I used Huntas way before since the eventhandler didnt work. What I did was to check every delta member for radio, (secondaryweapon _man or primaryweapon _man) and I checked also if they were alive or not, (he could be dead with the radio on his inventory). So if a delta dies and he has the radio a hint msg will display saying "_man is dead and he had the radio", also and an optional marker on map ("Radio is around here") will appear where he died.

I did not addaction, (I think its annoying to have it in the players menu everytime, because player may hit it by mistake and trigger the extracion before time), so what I did was enable and disable Alpha and Bravo radio calls from map whenever Delta team had or not the radio on their possesion using the previous script I mentioned.

But this script has a drawback that I will explain in a second.

On the readme.txt the radio object name is not shown, I assume is BAS_Satcom since thats what secondaryweapon command returns. I cant, however use getpos BAS_Satcom, it returns a scalar error. This means that, if a player drops the radio on ground, or gets a rpg and therefore drops it too, I cant get the position of the radio later on. I though about making another script in which if primary or secondaryweapon were not BAS_Satcom, get the position of the player in that very exact moment, because thats where he lost the radio. I hope you follow me.

See how will a single fire eventhandler simplify all this? :)