Data Realms Fan Forums
http://45.55.195.193/

Deactivating a Dropship's Engines, with Lua! :D
http://45.55.195.193/viewtopic.php?f=1&t=31780
Page 1 of 1

Author:  Kettenkrad [ Sun Sep 30, 2012 12:17 pm ]
Post subject:  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?

Author:  Roast Veg [ Sun Sep 30, 2012 12:38 pm ]
Post subject:  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?

Author:  Kettenkrad [ Sun Sep 30, 2012 1:28 pm ]
Post subject:  Re: Deactivating a Dropship's Engines, with Lua! :D

Of course, sorry about the delay.

Attachments:
Ship.rte.zip [1.2 MiB]
Downloaded 294 times

Author:  MaximDude [ Sun Sep 30, 2012 9:17 pm ]
Post subject:  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).

Author:  Asklar [ Sun Sep 30, 2012 11:28 pm ]
Post subject:  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.

Author:  xenoargh [ Mon Oct 01, 2012 1:30 am ]
Post subject:  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.

Author:  Asklar [ Mon Oct 01, 2012 2:17 am ]
Post subject:  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.

Author:  BremusJacklancer [ Thu Oct 11, 2012 6:47 pm ]
Post subject:  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?

Author:  Kettenkrad [ Thu Oct 11, 2012 10:23 pm ]
Post subject:  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.

Author:  BremusJacklancer [ Fri Oct 12, 2012 12:43 am ]
Post subject:  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?

Author:  Kettenkrad [ Fri Oct 12, 2012 5:41 am ]
Post subject:  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.

Author:  Bad Boy [ Sat Oct 13, 2012 4:15 pm ]
Post subject:  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.

Author:  Kettenkrad [ Sat Oct 13, 2012 9:03 pm ]
Post subject:  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.

Page 1 of 1 All times are UTC [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/