How I connect shields like "Among the ruins" campaign?

In this forum you will find and post information regarding the modding of Star Wars Battlefront 2. DO NOT POST MOD IDEAS/REQUESTS.

Moderator: Moderators

Post Reply
DaviidHL
Private Third Class
Posts: 52
Joined: Thu Apr 05, 2018 11:48 am
Projects :: Kashyyyk Droid Invasion
Games I'm Playing :: SWBF2
xbox live or psn: DaviidHL_

How I connect shields like "Among the ruins" campaign?

Post by DaviidHL »

In this mission you have to destroy a shield generator to destroy a force shield. I already placed but still not working. Any solutions?
User avatar
GAB
1st Lieutenant
1st Lieutenant
Posts: 431
Joined: Sun Jul 03, 2011 8:56 pm
Location: Somewhere around the world
Contact:

Re: How I connect shields like "Among the ruins" campaign?

Post by GAB »

I don't remeber exactly how they did it, but have a look at the campaign script for the Mygetto mission.
Marth8880
Resistance Leader
Posts: 5042
Joined: Tue Feb 09, 2010 8:43 pm
Projects :: DI2 + Psychosis
Games I'm Playing :: Silent Hill 2
xbox live or psn: Marth8880
Location: Edinburgh, UK
Contact:

Re: How I connect shields like "Among the ruins" campaign?

Post by Marth8880 »

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?
It's probably something along the lines of:

Code: Select all

OnObjectKillName(KillObject("force_shield_object_name"), "shield_generator_object_name");
or

Code: Select all

local function ForceShieldDest()
    KillObject("force_shield_object_name");
end

OnObjectKillName(ForceShieldDest, "shield_generator_object_name");
Calrissian97
Second Lance Corporal
Second Lance Corporal
Posts: 102
Joined: Sun May 07, 2017 11:31 pm
Projects :: ANF - ISM Skin Changer - BF1 Ports
Games I'm Playing :: All teh BFs
Location: Kentucky, USA

Re: How I connect shields like "Among the ruins" campaign?

Post by Calrissian97 »

I've done something similar with a plasma bridge that can be disabled by destroying it's generator. Like so:

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 
       )
And then to respawn it when the generator is repaired, you can use this code:

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
       )
EDIT:
Marth's code is prettier tho, I'd go with that if it works :P
Marth8880
Resistance Leader
Posts: 5042
Joined: Tue Feb 09, 2010 8:43 pm
Projects :: DI2 + Psychosis
Games I'm Playing :: Silent Hill 2
xbox live or psn: Marth8880
Location: Edinburgh, UK
Contact:

Re: How I connect shields like "Among the ruins" campaign?

Post by Marth8880 »

Calrissian97 wrote:Marth's code is prettier tho, I'd go with that if it works :P
More on anonymous functions for those interested: http://lua-users.org/wiki/ShortAnonymousFunctions
Post Reply