View unanswered posts | View active topics It is currently Sat Jun 15, 2024 5:47 pm



Reply to topic  [ 13 posts ] 
 Deactivating a Dropship's Engines, with Lua! :D 
Author Message
User avatar

Joined: Mon Oct 25, 2010 5:51 am
Posts: 1198
Location: Sydney
Reply with quote
Post Deactivating a Dropship's Engines, with Lua! :D
So, for the Wehrmacht, I'd rather center my brain deployment defences in campaign around a dropship rather than an Anti-air Drone. What I hope to achieve:

Image


I'll polish it up till it's shining, fix the effects, and hopefully, with the help of some handy Lua peoples, have it able to form a stationary bunker at the touch of a button. My question is this, using Lua, is it possible to deactivate a craft's emissions? They are, after all, just AEmitters, but with throttle variables. Does thing:EnableEmission() work on them?

This is the monster I put together with chunks from various scripts:
Two functions called through the Pie Menu, as so:



And then I have this little thing in the Update function:


So, what I assume it does, is try and find the engine each time the user tries to activate or deactivate the engines (EDIT: In addition to the Create function), and then attempts to activate / deactivate through that thing:EnableEmission().

The console, however, spams;
Code:
ERROR: call of overloaded function '(nil) is ambiguous
none of the overloads have a best conversion:(Entity*)
(const Entity*)

ERROR: call of overloaded function '(nil) is ambiguous
none of the overloads have a best conversion:(Entity*)
(const Entity*)

ERROR: call of overloaded function '(nil) is ambiguous
none of the overloads have a best conversion:(Entity*)
(const Entity*)


Does anyone know if this will work, or preferably, could anyone offer any other, more stable (or working) code?


Sun Sep 30, 2012 12:17 pm
Profile
Data Realms Elite
Data Realms Elite
User avatar

Joined: Tue May 25, 2010 8:27 pm
Posts: 4521
Location: Constant motion
Reply with quote
Post Re: Deactivating a Dropship's Engines, with Lua! :D
Can you upload a quick standalone of this dropship so I can mess around with it?


Sun Sep 30, 2012 12:38 pm
Profile
User avatar

Joined: Mon Oct 25, 2010 5:51 am
Posts: 1198
Location: Sydney
Reply with quote
Post Re: Deactivating a Dropship's Engines, with Lua! :D
Of course, sorry about the delay.


Attachments:
Ship.rte.zip [1.2 MiB]
Downloaded 269 times
Sun Sep 30, 2012 1:28 pm
Profile
User avatar

Joined: Wed Nov 22, 2006 3:19 pm
Posts: 2073
Reply with quote
Post Re: Deactivating a Dropship's Engines, with Lua! :D
You can check the EMP RL in MDC, it disables dropship engines on hit.
It should still work, I dunno, I haven't checked since B26.

P.S. Engines fire up automatically once whatever runs the script disappears/dies/gets removed from the scene (In my case it was a particle I think).


Sun Sep 30, 2012 9:17 pm
Profile
Data Realms Elite
Data Realms Elite
User avatar

Joined: Fri Jan 07, 2011 8:01 am
Posts: 6211
Location: In your office, earning your salary.
Reply with quote
Post Re: Deactivating a Dropship's Engines, with Lua! :D
As far as I know and I have tested, you can't access variables from the function Update(self) of the ship through the pie menu scripts.

I remember trying to do it, but it didn't work.


But I'm pretty sure you can do it only with the scripts of the pie menu, using the function AEmitter:IsEmitting() to do the corresponding checks when necessary.


Sun Sep 30, 2012 11:28 pm
Profile

Joined: Fri Dec 30, 2011 3:33 am
Posts: 276
Reply with quote
Post Re: Deactivating a Dropship's Engines, with Lua! :D
You can make it do it via the dropship's AI, or write a custom movement script that disables all attempts to fly it upwards once it's reached a minimum distance Y. I don't think you can do it via Pie Menu, however, because it has to interact with Update() cycles.


Mon Oct 01, 2012 1:30 am
Profile
Data Realms Elite
Data Realms Elite
User avatar

Joined: Fri Jan 07, 2011 8:01 am
Posts: 6211
Location: In your office, earning your salary.
Reply with quote
Post Re: Deactivating a Dropship's Engines, with Lua! :D
And if you made it work with the sharpness?

Make the scripts change the sharpness of the ship and make the ship change between emitting/not emitting when sharpness changes.


Mon Oct 01, 2012 2:17 am
Profile

Joined: Fri Oct 05, 2012 11:35 pm
Posts: 20
Reply with quote
Post Re: Deactivating a Dropship's Engines, with Lua! :D
Forgive my noob ness, but how would I go about seeing what files are needed to make this ship work for testing?

I get failure to load Ship.rte/Devices/Sprites/BulletPuffA

I'm not against making my own effects for testing buuut I'd like to know what else will be needed of me to get it working, do I just check all the references in the ship's DropShip.ini? Is that where they are?


Thu Oct 11, 2012 6:47 pm
Profile
User avatar

Joined: Mon Oct 25, 2010 5:51 am
Posts: 1198
Location: Sydney
Reply with quote
Post Re: Deactivating a Dropship's Engines, with Lua! :D
Whoops, I wasn't getting that. Sorry about that, Roast :S

If you want the released version, without the bunker mode, my Wehrmacht mod should have it. That'd include all the necessary effects, too.


Thu Oct 11, 2012 10:23 pm
Profile

Joined: Fri Oct 05, 2012 11:35 pm
Posts: 20
Reply with quote
Post Re: Deactivating a Dropship's Engines, with Lua! :D
Very cool! Did you use ACrab to make your ship?

And can you give ACrab a jet pack?


Fri Oct 12, 2012 12:43 am
Profile
User avatar

Joined: Mon Oct 25, 2010 5:51 am
Posts: 1198
Location: Sydney
Reply with quote
Post Re: Deactivating a Dropship's Engines, with Lua! :D
You can give an ACrab a jetpack, yes. The ship itself is just an ACDropship with a script 'attaching' two ACrabs to it.


Fri Oct 12, 2012 5:41 am
Profile

Joined: Fri Sep 10, 2010 1:48 am
Posts: 666
Location: Halifax, Canada
Reply with quote
Post Re: Deactivating a Dropship's Engines, with Lua! :D
Why not just delete it once it hits the ground and replace it with an immobile actor version of the ship. If you plan to have it take off again you could always put in a pie button on the actor that does the reverse (i.e. deletes the actor and replaces it with the ship). The only problem would I guess be that you can't carry across wounds and that things like broken hatches or legs or engines might be difficult to carry across too.


Sat Oct 13, 2012 4:15 pm
Profile
User avatar

Joined: Mon Oct 25, 2010 5:51 am
Posts: 1198
Location: Sydney
Reply with quote
Post Re: Deactivating a Dropship's Engines, with Lua! :D
Actually, I hadn't considered having it a brain. Doing it Bad Boy's way is a tad easier, too. If I were to make the body of the ship act as the brain, and have it drawn over an invisible dropship - carrying the engine, and able to be deleted.. That might work..

I fear draw orders will mess with me here, though. Might require further work-arounds.


Sat Oct 13, 2012 9:03 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 13 posts ] 

Who is online

Users browsing this forum: No registered users


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by STSoftware for PTF.
[ Time : 0.016s | 13 Queries | GZIP : Off ]