Radio call when player fires a weapon. - ED Forums
 


Notices

Reply
 
Thread Tools Display Modes
Old 03-12-2020, 09:26 AM   #1
Gierasimov
Senior Member
 
Gierasimov's Avatar
 
Join Date: Dec 2010
Location: Undisclosed NATO country
Posts: 1,451
Question Radio call when player fires a weapon.

Is it possible, to create a multi missile in zone trigger in ME?
Is there a script for the action like this.

Player is in zone.
Player shots AIM120C or AIM9X
Call is made over radio for either Fox3 or Fox2.

With ME I can achieve this for the first weapon shot of each type, but not for subsequent release of the same weapon.
Gierasimov is offline   Reply With Quote
Old 03-12-2020, 02:58 PM   #2
A101Wayz
Member
 
Join Date: Feb 2019
Posts: 149
Default

How would you go about doing this in the ME? If it's a matter of a ONCE trigger, change it to a SWITCHED CONDITION...
__________________
Wayz Out


Intel Core i9 9900K | ASUS ROG Strix Z390E Gaming MB | G.Skill Ripjaws V 32gb DDR4-3200 | GeForce RTX 2080 Ti | Samsung 970 EVO Plus NVMe
HTC Vive Pro VR | Logitech G x56 HOTAS | Logitech G PRO Pedals
A101Wayz is offline   Reply With Quote
Old 03-13-2020, 03:51 PM   #3
Gierasimov
Senior Member
 
Gierasimov's Avatar
 
Join Date: Dec 2010
Location: Undisclosed NATO country
Posts: 1,451
Question Not quite

I am using switched condition trigger, but this is what it does -

The first time the missile enters the zone, the trigger action will be activated, because the previous check of the trigger conditions was evaluated as false (missile was not in zone).

The trigger will not activate any longer as long as the missile is inside the zone, because the previous check of the trigger conditions will be evaluated as true (missile remains inside zone).

However, if the missile exits the zone and then re-enters it again, the conditions will have once again switched from false to true and the trigger action will be activated.

So, my pilot will call Fox Three on the first AMRAAM, but not if I fire any follow-ups, hence the question.

A solution would be if I was able to use MISSILE IN MOVING ZONE condition, just like I can do with a UNIT. But MISSILE IN ZONE is the only one available.
Gierasimov is offline   Reply With Quote
Old 03-14-2020, 12:36 PM   #4
feefifofum
3rd Party Developer
 
feefifofum's Avatar
 
Join Date: Jan 2015
Location: USA
Posts: 3,248
Default

Your best option in this case is an event handler that searches for guidance type based in the SHOT event. I'll see if I have an example floating around somewhere.
feefifofum is offline   Reply With Quote
Old 03-14-2020, 12:43 PM   #5
Reflected
3rd Party Campaign Creator
 
Reflected's Avatar
 
Join Date: Feb 2016
Location: Uluwatu
Posts: 3,083
Default

I’m interested in this too! Let me give it a try.
Reflected is offline   Reply With Quote
Old 03-14-2020, 01:44 PM   #6
kaba
Junior Member
 
Join Date: Sep 2018
Posts: 93
Default

I put this together some months ago from code I found posted on the forum. This will activate a different flag for Fox 1, 2 and 3 fired by a unit called _Player.


See if this helps





Code:
FoxplusHandler = {}
function FoxplusHandler:onEvent(event)
        if event.id == world.event.S_EVENT_SHOT and event.initiator == Unit.getByName('_Player') then
            local _wpn = event.weapon:getDesc()
            local _wpnType = _wpn.guidance
            if _wpnType == 4 then
                    trigger.action.setUserFlag('1001', true)
            end
            if _wpnType == 2 then
                    trigger.action.setUserFlag('1002', true)
            end
            if _wpnType == 3 then
                    trigger.action.setUserFlag('1003', true)
            end
    end
end
world.addEventHandler(FoxplusHandler)
kaba is offline   Reply With Quote
Old 03-15-2020, 12:35 AM   #7
Reflected
3rd Party Campaign Creator
 
Reflected's Avatar
 
Join Date: Feb 2016
Location: Uluwatu
Posts: 3,083
Default

Can it be done without scripts? The "On Shot" event is active whenever anyone fires, or just the player? That's the tricky part: how do I ensure it only activates when the player fires?
Reflected is offline   Reply With Quote
Old 03-15-2020, 12:51 AM   #8
Sedlo
Member
 
Sedlo's Avatar
 
Join Date: Aug 2017
Posts: 608
Default

On shot is when anyone fires, AI/Player, etc... You've got to use a script, but luckily the one above works very well.
Sedlo is offline   Reply With Quote
Old 03-15-2020, 01:41 AM   #9
feefifofum
3rd Party Developer
 
feefifofum's Avatar
 
Join Date: Jan 2015
Location: USA
Posts: 3,248
Default

Indeed no way to do this without an event handler. Kaba's is exactly the right thing though, all you need to do is detect and reset the flags using the regular old ME.
feefifofum is offline   Reply With Quote
Old 03-15-2020, 03:43 AM   #10
Reflected
3rd Party Campaign Creator
 
Reflected's Avatar
 
Join Date: Feb 2016
Location: Uluwatu
Posts: 3,083
Default

Brilliant, works like a charm, thanks Kaba!
Reflected is offline   Reply With Quote
Reply

Tags
fox, missile, trigger

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

All times are GMT. The time now is 12:02 AM. vBulletin Skin by ForumMonkeys. Powered by vBulletin®.
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.