How I connect shields like "Among the ruins" campaign?
Posted: Mon Apr 09, 2018 12:26 pm
In this mission you have to destroy a shield generator to destroy a force shield. I already placed but still not working. Any solutions?
Get more from your games!
http://www.gametoast.com/
It's probably something along the lines of:DaviidHL wrote:In this mission you have to destroy a shield generator to destroy a force shield. I already placed but still not working. Any solutions?
Code: Select all
OnObjectKillName(KillObject("force_shield_object_name"), "shield_generator_object_name");Code: Select all
local function ForceShieldDest()
KillObject("force_shield_object_name");
end
OnObjectKillName(ForceShieldDest, "shield_generator_object_name");Code: Select all
ff_bridge_destroy = OnObjectKill(
function(object, killer)
if GetEntityName(object) == "myg1_prop_shield_generator" then
KillObject("myg1_prop_energy_collector_shield1") -- if you want to link more shields to it, just add another KillObject line after this one
end
end
)Code: Select all
ff_bridge_create = OnObjectRepair(
function(object, repairer)
if GetEntityName(object) == "myg1_prop_shield_generator" then
RespawnObject("myg1_prop_energy_collector_shield1") -- if you want to link more shields to it, just add another Respawn Object line after this one
end
end
)More on anonymous functions for those interested: http://lua-users.org/wiki/ShortAnonymousFunctionsCalrissian97 wrote:Marth's code is prettier tho, I'd go with that if it works