Re: LUA: Using JoyButtonReleased for burst mode
This seems like a very silly way of doing it, using only the joybutton means it'll only work for controllers, whereas if you use the actor's lua controller (the lua interface rather not the physical controller) you can probably make it work with any control scheme.
Either way, you'd need to get the actor holding the gun and get his player or controller. So something like the following would probably help:
Code:
function Create(self)
self.Parent = nil;
self.ParentPlayer = nil;
function Update(self)
--If it's not being held by an actor, set its parent and parent player to nil
if self.ID == self.RootID then
self.Parent = nil;
self.ParentPlayer = nil;
--If it is being held, give it a parent and find the parent's player
else
if self.Parent == nil or self.ParentPlayer == nil then
self.Parent = MovableMan:GetMOFromID(self.ID);
self.ParentPlayer = self.Parent:GetController().Player;
end
--Your stuff follows, except the 0 in joybuttonreleased is changed to self.ParentPlayer
--Also, you should consider using self.Parent:GetController():IsState(Controller.RELEASE_PRIMARY) instead of uinputman stuff
end
By the way, this should probably have been in the lua scripting subforum.