Invisible Objects - ED Forums
 


Notices

Reply
 
Thread Tools Display Modes
Old 02-21-2019, 08:07 PM   #1
ICEVIPER
Junior Member
 
Join Date: Nov 2017
Location: Washington, UK
Posts: 12
Default Invisible Objects

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
Attached Thumbnails
Click image for larger version

Name:	Capture1.JPG
Views:	39
Size:	26.8 KB
ID:	204892   Click image for larger version

Name:	Capture2.JPG
Views:	33
Size:	24.6 KB
ID:	204893  
Attached Files
File Type: miz Test_Shot_Flag_On_Flag_Off_AC7.miz (21.0 KB, 6 views)
ICEVIPER is offline   Reply With Quote
Old 02-21-2019, 08:40 PM   #2
feefifofum
3rd Party Developer
 
feefifofum's Avatar
 
Join Date: Jan 2015
Location: USA
Posts: 2,884
Default

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.

Code:
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)

Last edited by feefifofum; 02-21-2019 at 08:44 PM.
feefifofum is offline   Reply With Quote
Old 02-21-2019, 09:05 PM   #3
ICEVIPER
Junior Member
 
Join Date: Nov 2017
Location: Washington, UK
Posts: 12
Default

Quote:
Originally Posted by feefifofum View Post
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.

Code:
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
ICEVIPER is offline   Reply With Quote
Old 02-21-2019, 10:10 PM   #4
feefifofum
3rd Party Developer
 
feefifofum's Avatar
 
Join Date: Jan 2015
Location: USA
Posts: 2,884
Default

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.
feefifofum is offline   Reply With Quote
Old 02-21-2019, 11:13 PM   #5
ICEVIPER
Junior Member
 
Join Date: Nov 2017
Location: Washington, UK
Posts: 12
Default

Quote:
Originally Posted by feefifofum View Post
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
ICEVIPER is offline   Reply With Quote
Old 02-25-2019, 11:54 AM   #6
ICEVIPER
Junior Member
 
Join Date: Nov 2017
Location: Washington, UK
Posts: 12
Default

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
ICEVIPER is offline   Reply With Quote
Reply

Tags
invisible units, mission editor question

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 01:41 PM. vBulletin Skin by ForumMonkeys. Powered by vBulletin®.
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.