Results 1 to 1 of 1

Thread: Some problem about armlet

  1. #1
    Basic Member
    Join Date
    Dec 2016
    Posts
    123

    Some problem about armlet

    Edit:I use modifier check instead of IsActivated( ) and problem solved, it seems that IsActivated( ) always return a true value for armlet.

    Code:
    	if (CheckItemByName ( "item_armlet" ) and (not npcBot:IsUsingAbility())) then
    		if ((not GetItemByName("item_armlet"):IsActivated( )) and npcBot:GetHealthRegen( ) >= 37.25 and npcBot:GetHealth()/npcBot:GetMaxHealth() >= 0.75) then
    			print('turn on armlet');
    			npcBot:Action_UseAbility(GetItemByName("item_armlet"));
    		end
    		
    		if (GetItemByName("item_armlet"):IsActivated( ) and (npcBot:GetHealthRegen( ) < 37.25 or npcBot:GetHealth()/npcBot:GetMaxHealth() < 0.75)) then
    			print('turn off armlet');
    			npcBot:Action_UseAbility(GetItemByName("item_armlet"));
    		end
    	end
    So my bot keep toggle armlet on and off when his health regen is lower than 37.25, but I'm not sure what went wrong. Should I do a Action_ClearActions at the end of the function?

    I also got one with timer, but no effect, the code is used on alchemist bot.

    Code:
    local armlettimer = 0;
    function armlet()
    	local npcBot = GetBot();
    	if (CheckItemByName ( "item_armlet" ) and (not npcBot:IsUsingAbility())) then
    		if (armlettimer == 0 and (not GetItemByName("item_armlet"):IsActivated( )) and npcBot:GetHealthRegen( ) >= 40 and (npcBot:GetHealth()/npcBot:GetMaxHealth()) >= 0.75) then
    			print('turn on armlet');
    			npcBot:Action_UseAbility(GetItemByName("item_armlet"));
    			armlettimer = DotaTime();
    		end
    		
    		if ((DotaTime()-armlettimer > 0.7) and (GetItemByName("item_armlet"):IsActivated( )) and (npcBot:GetHealthRegen( ) < 40 or (npcBot:GetHealth()/npcBot:GetMaxHealth()) < 0.75)) then
    			print('turn off armlet');
    			npcBot:Action_UseAbility(GetItemByName("item_armlet"));
    			armlettimer = 0;
    		end
    	end
    end
    Last edited by lunarbreez; 02-08-2017 at 10:36 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •