Hello everyone,
I've successfully found a way to make it so that you have to pay for each use of both the airstrike and ion cannon support powers, however I can't get it to work for the nukepower trait.
In my mod the communications center builds an invisible actor. this actor has the SupportPower trait and kills itself when the camera actor from the SupportPower trait appears.
Since the NukePower trait doesn't have a camera actor I cannot implement the same logic here. I tried but failed using the ToggleConditionOnOrder trait.
I've familiarised myself with yaml but not with lua script yet. I'm not sure if maybe lua would be the answer..?
Please could someone point me in the right direction. Thanks in advance
making the nuke weapon purchasable
I need some help toggling a condition on when the nuke is fired
Re: making the nuke weapon purchasable
Hi, one option could be using an ion cannon power with a dummy actor that is purchasable as you already implemented and then target the dummy actor's location by using "ActivateNukePower" via Lua: https://docs.openra.net/en/release/lua/#support-powers
It is possible but will need some fiddling around.
It is possible but will need some fiddling around.
Re: making the nuke weapon purchasable
Awesome!!! Yesss!!! Thank you
Re: making the nuke weapon purchasable
Could someone please help me with what's missing in this bit of Lua code.
I called the actor that the nuke would spawn from "CAMERA.nuke". It's supposed to trigger a nuke once it comes into existence. This is what I have so far, but it doesn't work:
Trigger.OnAddedToWorld(CAMERA_nuke, function()
ActivateNukePower()
end)
I called the actor that the nuke would spawn from "CAMERA.nuke". It's supposed to trigger a nuke once it comes into existence. This is what I have so far, but it doesn't work:
Trigger.OnAddedToWorld(CAMERA_nuke, function()
ActivateNukePower()
end)
Re: making the nuke weapon purchasable
OnAddedToWorld takes a reference to an already existing actor. The easiest option would probably to check in the Tick function if Map.ActorsInWorld has any actor with type "CAMERA.nuke". (But can lead to worse performance, you'll have to try it.) Alternatively you'd need to define a cell trigger over the entire map to notice when such a camera actor is spawned (a lot of work). How do you currently spawn the "CAMERA.nuke" actor? Depending on that the best alternative could be detecting when the dummy that spawns the camera dies, i.e. add a Trigger.OnAnyProduction and detect when a dummy is built, then add a Trigger.OnKilled to the dummy and then you can call another Lua function from there.