Jump to content

Invisible Objects


Iceviper

Recommended Posts

Ok, I think I'm being a bit thick but I've tried all sorts of ways to do this without success.

 

What we are trying to to do is to have client aircraft (set to immortal) that have been attacked by AI aircraft to go invisible for a short period of time and then for them to become visible. The purpose is so that if flying long missions the player will be allowed to continue flying and engage in tasks but receive a message that they are dead or have been hit. That way they can continue to fly without having to sit around waiting for buddies to finish the mission. A Red Flag type scenario. Honestly, I've tried all sorts of things.

 

My latest and what I thought might be the easiest was to use triggered actions on switched conditions. I'll attach the miz file for the latest attempt and a couple of screenshots.

 

What is happening is that any which way I do it in ME,

 

A. The Ai attacks. Hits the client then breaks off and a message shows that the player has been hit (great that's what I want to happen repeatedly)

 

B. After 30 seconds I switch invisibility off and the AI attacks again but instead of breaking off the second time it continues to pummel the player

 

Can anyone tell me if this can be done either scripted or preferably within the ME

 

Thanks in advance :thumbup:

Test_Shot_Flag_On_Flag_Off_AC7.miz

Capture1.thumb.JPG.ef551e9f563804d7b2e9ae297fdf23b8.JPG

Capture2.thumb.JPG.5d21a4e109c4d1206b1783734a0f8c05.JPG

Link to comment
Share on other sites

UNIT HIT will only activate once, the first time the unit is hit, not every time.

 

You'll need an event handler to detect the HIT event on the player and toggle the flag every time, then a separate trigger that causes the action. This will require writing some code which is where a lot of people get off the ride. ;)

 

Should be something along these lines.

 

HitHandler = {}
function Handler:onEvent(event)
if event.id == world.event.S_EVENT_HIT and event.target == Unit.getByName('PLAYERFLIGHT') then
trigger.action.setUserFlag('7777', true) 
end
end
world.addEventHandler(HitHandler)


Edited by feefifofum
Link to comment
Share on other sites

UNIT HIT will only activate once, the first time the unit is hit, not every time.

 

You'll need an event handler to detect the HIT event on the player and toggle the flag every time, then a separate trigger that causes the action. This will require writing some code which is where a lot of people get off the ride. ;)

 

Should be something along these lines.

 

HitHandler = {}
function Handler:onEvent(event)
if event.id == world.event.S_EVENT_HIT and event.target == Unit.getByName('PLAYERFLIGHT') then
trigger.action.setUserFlag('7777', true) 
end
end
world.addEventHandler(HitHandler)

 

Thanks for the speedy response and taking the time to reply. I might also get off the ride at that point lol. I've had some limited success loading moose/mist but by no means am a coder. It makes perfect sense just not quite sure how to implement that. Will chew it over. Much appreciated

Link to comment
Share on other sites

Just add that code to a DO SCRIPT trigger and see if it works. That was adapted from a gun handler I pulled out of another thread.

 

Instead of your UNIT HIT condition, use FLAG IS TRUE (7777) and then add an action to turn flag 7777 back off in your second trigger. That will allow the handler to turn flag 7777 back on again when the player is hit a second time and repeat the process.

Link to comment
Share on other sites

Just add that code to a DO SCRIPT trigger and see if it works. That was adapted from a gun handler I pulled out of another thread.

 

Instead of your UNIT HIT condition, use FLAG IS TRUE (7777) and then add an action to turn flag 7777 back off in your second trigger. That will allow the handler to turn flag 7777 back on again when the player is hit a second time and repeat the process.

 

Cheers. Tried that but it threw up an error when hit. I'll have another go tomorrow. Appreciate the help

Link to comment
Share on other sites

Apologies for late response but the above doesn't work. When changing to flag true then the attacking aircraft just continues to pummel the defender from the off. If leaving as unit hit and using the script I get an error that I can close out and then carry on. Still trying to find a method

Link to comment
Share on other sites

  • Recently Browsing   0 members

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