catt42 Posted May 20, 2017 Share Posted May 20, 2017 Hi, I'm working on a MOOSE script. So far the script set flag 1 on when the plane called RED01 is hit by anyone: BLUE01 = UNIT:FindByName( "BLUE01" ) BLUE02 = UNIT:FindByName( "BLUE02" ) RED01 = UNIT:FindByName( "RED01" ) BLUE01:HandleEvent( EVENTS.Hit ) BLUE01:HandleEvent( EVENTS.Hit ) RED01:HandleEvent( EVENTS.Hit ) function RED01:OnEventHit( EventData ) trigger.action.setUserFlag('1', 1) end How can I re-write the script so that it sets flag 1 on if RED01 is hit by BLUE01 and flag 2 on if it's hit by BLUE02? Thank You. Link to comment Share on other sites More sharing options...
Pikey Posted May 22, 2017 Share Posted May 22, 2017 Ah I seem to have started answering in another post. So i looked more closely and the problem with the HIT event is that there is no target as well in the EventData, only the Initiator, which is the guy getting hit.... you need to xref a Event.SHOT which has an Initiator, a target and a weapon, with a HIT. So this is going to have to be subscribing to two events that don't actually relate to each other. And they will not happen at precisely the same time either. So I'm stumped, you certainly can't do it with just a HIT event, but you might want to use a SHOT event and look for both the initiator and the target matching and chaing the requirement (haha) to "He's shooting at me!" ___________________________________________________________________________ SIMPLE SCENERY SAVING * SIMPLE GROUP SAVING * SIMPLE STATIC SAVING * Link to comment Share on other sites More sharing options...
FlightControl Posted May 27, 2017 Share Posted May 27, 2017 Is your problem fixed? [TABLE][sIGPIC][/sIGPIC]| Join MOOSE community on: DISCORD :thumbup: Website of the MOOSE LUA Framework. MOOSE framework Downloads. Check out Example Missions to try out and learn. MOOSE YouTube Channel for live demonstrations and tutorials. [/TABLE] Link to comment Share on other sites More sharing options...
catt42 Posted May 28, 2017 Author Share Posted May 28, 2017 Is your problem fixed? Not really. As you said, combining HIT and SHOT events could work, but since I'm working on a 4v4 mission and I'm completely new to LUA and MOOSE, it would be a mess...:confused: I'll probably revert to tracking player's kills only, for scoring purposes. Anyway, thanks for asking. Link to comment Share on other sites More sharing options...
Recommended Posts