IssueMove completed event [SOLVED]

This is for troubleshooting of problems with the FAF client and Forged Alliance game.

Moderator: PhilipJFry

IssueMove completed event

Postby EntropyWins » 29 Oct 2016, 01:06

I've found some code that uses `IssueMove` to move a transport. This is followed by a `WaitSeconds(50)` and then code that is supposed to execute when the transport completed its move command. This is very brittle and does not work well, since different transports have different speeds and move to different locations. Is there a more sane way to invoke some code once `IssueMove` has been completed?
EntropyWins
Avatar-of-War
 
Posts: 113
Joined: 02 Oct 2016, 20:26
Has liked: 18 times
Been liked: 4 times
FAF User Name: EntropyWins

Re: IssueMove completed event  [SOLVED]

Postby speed2 » 29 Oct 2016, 01:17

Code: Select all
while transport:IsUnitState('Moving')) do
    WaitSeconds(.5)
end

Is this enough?
User avatar
speed2
Contributor
 
Posts: 3189
Joined: 05 Jan 2013, 15:11
Has liked: 636 times
Been liked: 1119 times
FAF User Name: speed2

Re: IssueMove completed event

Postby Exotic_Retard » 29 Oct 2016, 01:48

if its in the unit script you can do:
Code: Select all
    OnMotionHorzEventChange = function(self, new, old)
        if new == 'Stopped' then
            --damn, look at this amazing code im running here
        end
    end,
User avatar
Exotic_Retard
Contributor
 
Posts: 1470
Joined: 21 Mar 2013, 22:51
Has liked: 557 times
Been liked: 626 times
FAF User Name: Exotic_Retard

Re: IssueMove completed event

Postby EntropyWins » 30 Oct 2016, 15:32

speed2 wrote:
Code: Select all
while transport:IsUnitState('Moving')) do
    WaitSeconds(.5)
end

Is this enough?


That works. Not exactly pretty, but it works.

Exotic_Retard wrote:if its in the unit script you can do:
Code: Select all
    OnMotionHorzEventChange = function(self, new, old)
        if new == 'Stopped' then
            --damn, look at this amazing code im running here
        end
    end,


I'm not sure what a unit script is (though can guess) and suppose this is not, since it's the code of a map.
EntropyWins
Avatar-of-War
 
Posts: 113
Joined: 02 Oct 2016, 20:26
Has liked: 18 times
Been liked: 4 times
FAF User Name: EntropyWins

Re: IssueMove completed event

Postby speed2 » 30 Oct 2016, 15:45

If you tell me what exactly you want to do and show me your code I can help you more
User avatar
speed2
Contributor
 
Posts: 3189
Joined: 05 Jan 2013, 15:11
Has liked: 636 times
Been liked: 1119 times
FAF User Name: speed2

Re: IssueMove completed event

Postby EntropyWins » 01 Nov 2016, 22:46

As mentioned, I got this to work already.

Still, if you want to see the code, here you go:

* https://github.com/JeroenDeDauw/FinalRu ... ua#L70-L80
* https://github.com/JeroenDeDauw/FinalRu ... r.lua#L109
EntropyWins
Avatar-of-War
 
Posts: 113
Joined: 02 Oct 2016, 20:26
Has liked: 18 times
Been liked: 4 times
FAF User Name: EntropyWins


Return to Tech Support

Who is online

Users browsing this forum: No registered users and 1 guest