How to move dynamically powerup stations

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
Plaigon
Recruit Womprat Killer
Posts: 13
Joined: Fri Dec 14, 2018 6:22 pm
Projects :: No Mod project currently.
Games I'm Playing :: SWBF2
xbox live or psn: No gamertag set

How to move dynamically powerup stations

Post by Plaigon »

Hi guys,
Watchin' this few days ago, made by Noobsaurus.
www.youtube.com/watch?v=NDfQZfWx0oo

But I can't be able to reproduce this with some piece of lua. I dont know how to get the character unit id for powerup station, supposing it has a meaning for them. So because of that, I cant use SetEntityMatrix as I would with my player. CreateEntity does not work either for spawning new ammo/medical droid. How does he manage to do that, any idea?
Thanks in advance.
kiprobin
First Lance Corporal
First Lance Corporal
Posts: 120
Joined: Wed Dec 11, 2019 3:52 pm
Projects :: Trench War
Games I'm Playing :: Swbf2
xbox live or psn: No gamertag set

Re: How to move dynamically powerup stations

Post by kiprobin »

I think the Hera Syndulla that Teancum converted had a weapon odf that would deploy chopper in a similar way that the storm trooper in the vid deploys the medical droid. You could set it up as a weapon odf and then have the medical droid as the so called ordinance. The snipers auto turret may work the same way, I think. Worth a shot at least
User avatar
Teancum
Jedi Admin
Jedi Admin
Posts: 11080
Joined: Wed Sep 07, 2005 11:42 pm
Projects :: No Mod project currently.
Games I'm Playing :: Destiny
xbox live or psn: No gamertag set
Location: Indiana

Re: How to move dynamically powerup stations

Post by Teancum »

Huh, I guess that would work. I was asked about this the other day and didn't think about deployables. But there's still the issue of destroying the old one to give the appearance of it teleporting. Not entirely sure what the end goal here is.
User avatar
Benoz
Corporal
Corporal
Posts: 142
Joined: Tue May 28, 2013 12:34 pm
Projects :: Clone Wars Era Mod Version 2
Games I'm Playing :: OldFront - EAFront
xbox live or psn: No gamertag set
Location: Germany

Re: How to move dynamically powerup stations

Post by Benoz »

Teancum wrote:
Tue Nov 17, 2020 9:54 pm
But there's still the issue of destroying the old one to give the appearance of it teleporting.
That would easily be fixed. When you give your healthdroid the ClassLabel = "dispenser" and add the value TriggerAll = "1" it destroys the droid before creating a new one. Just like with the auto turret.
User avatar
Teancum
Jedi Admin
Jedi Admin
Posts: 11080
Joined: Wed Sep 07, 2005 11:42 pm
Projects :: No Mod project currently.
Games I'm Playing :: Destiny
xbox live or psn: No gamertag set
Location: Indiana

Re: How to move dynamically powerup stations

Post by Teancum »

Hmm, just realized this might be great for a deployable cover system
MileHighGuy
Jedi
Jedi
Posts: 1194
Joined: Fri Dec 19, 2008 7:58 pm

Re: How to move dynamically powerup stations

Post by MileHighGuy »

No need to destroy the object. Try something like this in your LUA in ScriptInit. Obviously put the right ODF names in there.

Code: Select all

--damager is you
--object is the thing being damaged
moveObject = OnObjectDamage(
         function(object, damager)
         
             if damager == nil then
                return 
             end
             
            
             local unit = GetCharacterUnit(damager)
             
             if GetObjectLastHitWeaponClass(object) == "MY_WEAPON_ODF"
             and GetEntityClassName(object) == "HEALTH_DROID_ODF" 
             and unit ~= nil then
             
                 --move the object 3 units in front of you
                local newMatrix = CreateMatrix(0,0,0,0,0,0,3, GetEntityMatrix(GetCharacterUnit(damager))
                SetEntityMatrix(object , newMatrix)
                
             end
             
         end
            )
I am not sure if it works with a 0 damage weapon. Hopefully the code works, I haven't tested it. If it doesnt work there is a typo, the idea is totally doable.
Post Reply