Jump to content

Problem with a MOOSE script


Recommended Posts


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) 


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

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!"



Link to comment
Share on other sites

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

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...