Focus Agent script

Post Reply
cooco
VIP
Posts: 218
Joined: Fri Feb 17, 2017 2:01 am
Has thanked: 58 times
Been thanked: 85 times

Focus Agent script

Post by cooco » Thu Mar 23, 2017 2:48 pm

Code: Select all

function CheckFocusAgent()

	if self._iFocusAgentDelay == nil or self._iFocusAgentDelay < Time() then
		-- Check if we have a positive match and set cooldown.
			if PlayerInput:Inventory( "Fine Focus Agent") then
				self._iFocusAgentDelay = Time() + 900000;
				return false;
			elseif PlayerInput:Inventory( "Focus Agent") then
				self._iFocusAgentDelay = Time() + 900000;
				return false;
			elseif PlayerInput:Inventory( "Greater Focus Agent") then
				self._iFocusAgentDelay = Time() + 900000;
				return false;
			elseif PlayerInput:Inventory( "Lesser Focus Agent") then
				self._iFocusAgentDelay = Time() + 900000;
				return false;
			elseif PlayerInput:Inventory( "Major Focus Agent") then
				self._iFocusAgentDelay = Time() + 900000;
				return false;
			elseif PlayerInput:Inventory( "Minor Focus Agent") then
				self._iFocusAgentDelay = Time() + 900000;
				return false;
			end
		
	end
	
	return true;
end
An Helper function. I hope be usefull :)

ewerson2
Posts: 8
Joined: Tue Apr 11, 2017 12:40 pm
Has thanked: 4 times
Been thanked: 3 times

Re: Focus Agent script

Post by ewerson2 » Fri Jul 21, 2017 9:08 pm

This code is OK

Code: Select all

function Pause()
  
if Player:GetState():GetState( 10051 ) == nil then
        if Helper:CheckAvailableInventory( "Fine Focus Agent" ) then
            PlayerInput:Inventory( "Fine Focus Agent" );
            return false;
        elseif Helper:CheckAvailableInventory( "Major Focus Agent" ) then
            PlayerInput:Inventory( "Major Focus Agent" );
            return false;
        elseif Helper:CheckAvailableInventory( "Greater Focus Agent" ) then
            PlayerInput:Inventory( "Greater Focus Agent" );
            return false;
        elseif Helper:CheckAvailableInventory( "Focus Agent" ) then
            PlayerInput:Inventory( "Focus Agent" );
            return false;			
        elseif Helper:CheckAvailableInventory( "Lesser Focus Agent" ) then
            PlayerInput:Inventory( "Lesser Focus Agent" );
            return false;
        elseif Helper:CheckAvailableInventory( "Minor Focus Agent" ) then
            PlayerInput:Inventory( "Minor Focus Agent" );
            return false;			
       end
end

if Player:GetState():GetState( 10044 ) == nil then
        if Helper:CheckAvailableInventory( "Fine Rally Serum" ) then
            PlayerInput:Inventory( "Fine Rally Serum" );
            return false;
        elseif Helper:CheckAvailableInventory( "Major Rally Serum" ) then
            PlayerInput:Inventory( "Major Rally Serum" );
            return false;
        elseif Helper:CheckAvailableInventory( "Greater Rally Serum" ) then
            PlayerInput:Inventory( "Greater Rally Serum" );
            return false;
         elseif Helper:CheckAvailableInventory( "Rally Serum" ) then
            PlayerInput:Inventory( "Rally Serum" );
            return false;
		elseif Helper:CheckAvailableInventory( "Lesser Rally Serum" ) then
            PlayerInput:Inventory( "Lesser Rally Serum" );
            return false;
        elseif Helper:CheckAvailableInventory( "Minor Rally Serum" ) then
            PlayerInput:Inventory( "Minor Rally Serum" );
            return false;			
       end
end
    
	-- Nothing was executed, continue with other functions.
	return true;

end

agonic
VIP
Posts: 159
Joined: Tue Jan 10, 2017 6:39 pm
Has thanked: 34 times
Been thanked: 112 times

Re: Focus Agent script

Post by agonic » Mon Jul 24, 2017 4:49 pm

This easy way ? :)

Code: Select all

function AttackFood()
 
stateID = {10740,10051,10064,10224,10225,9976,9989};
foodName = {"Minor Focus Agent","Lesser Focus Agent","Focus Agent","Greater Focus Agent","Major Focus Agent","Fine Focus Agent","Fried fresh Plumbo with Cheese"};
flag = 0;
 
    for _,v in ipairs(stateID) do
        if Player:GetState():GetState( v ) ~= nil then
            flag = flag + 1;
        end
    end
 
    if flag == 0 then
        for a,b in ipairs(foodName) do
            if Helper:CheckAvailableInventory( b ) then
                PlayerInput:Inventory( b );
                break;
            end
        end
    end
return true;
 
 
end

Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests