Page 1 of 1

How to move dynamically powerup stations

Posted: Tue Nov 17, 2020 4:39 am
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.

Re: How to move dynamically powerup stations

Posted: Tue Nov 17, 2020 12:19 pm
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

Re: How to move dynamically powerup stations

Posted: Tue Nov 17, 2020 9:54 pm
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.

Re: How to move dynamically powerup stations

Posted: Thu Nov 19, 2020 2:42 pm
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.

Re: How to move dynamically powerup stations

Posted: Thu Nov 19, 2020 5:33 pm
by Teancum
Hmm, just realized this might be great for a deployable cover system

Re: How to move dynamically powerup stations

Posted: Thu Nov 19, 2020 8:09 pm
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.