Forged Alliance Forever Forged Alliance Forever Forums 2017-06-18T22:26:17+02:00 /feed.php?f=41&t=14756 2017-06-18T22:26:17+02:00 2017-06-18T22:26:17+02:00 /viewtopic.php?t=14756&p=150927#p150927 <![CDATA[Re: Measuring velocity on impact]]> Statistics: Posted by Luxor144 — 18 Jun 2017, 22:26


]]>
2017-06-17T08:05:04+02:00 2017-06-17T08:05:04+02:00 /viewtopic.php?t=14756&p=150851#p150851 <![CDATA[Re: Measuring velocity on impact]]>
Code:
local oldUAA2102 = UAA2102
UAA2102 = Class(oldUAA2102) {
    speed_at_death = nil,

    OnKilled = function(self, instigator, type, overkillRatio)
        Forkthread(function(
            self.speed_at_death = self:GetVelocity()
            while not self.speed_at_death[2] == 0 and self:GetPosition()[2] > GetSurfaceHeight(self:GetPosition()[1],self:GetPosition()[3])do
                WaitSeconds(0.2)
                self.speed_at_death = self:GetVelocity()
            end
        end
        AirUnit.OnKilled(self, instigator, type, overkillRatio)
    end,

TypeClass = UAA2102
}


you can then get this speed from
Code:
YourUnit.speed_at_death


for an example you can look at the nomads mothership code:
https://github.com/Nomads-Project/nomad ... pt.lua#L26
https://github.com/Nomads-Project/nomad ... t.lua#L349
this code is called from the acu

alternatively you can put this code into the AirUnit class. Surely this can be optimized but this should work (didnt test it though)

Statistics: Posted by CookieNoob — 17 Jun 2017, 08:05


]]>
2017-06-17T04:03:29+02:00 2017-06-17T04:03:29+02:00 /viewtopic.php?t=14756&p=150845#p150845 <![CDATA[Re: Measuring velocity on impact]]> in func1
entity.mything = 1
in func2
LOG(entity.mything) // 1

Statistics: Posted by nine2 — 17 Jun 2017, 04:03


]]>
2017-06-17T02:26:24+02:00 2017-06-17T02:26:24+02:00 /viewtopic.php?t=14756&p=150843#p150843 <![CDATA[Measuring velocity on impact]]> Since these functions happen at different times, is there a way to store the measurement from one function somewhere, and then call it back from the other function when needed? Preferably without adding additional arguments to functions. That self.Trash thing looked promising, but not only I don't know how it functions, I'm also not sure if it works with real numbers.

Statistics: Posted by Luxor144 — 17 Jun 2017, 02:26


]]>