Dota 2 Workshop Tools/Scripting/API/CDOTA BaseNPC.CastAbilityImmediately: Difference between revisions
< Dota 2 Workshop Tools | Scripting | API
		
		
		
		Jump to navigation
		Jump to search
		RoyAwesome (talk | contribs)  (Dota_Lebot push: Updated Page)  | 
				RoyAwesome (talk | contribs)   (Dota_Lebot push: Updated Page)  | 
				||
| Line 6: | Line 6: | ||
''' void CastAbilityImmediately(handle ''  | ''' void CastAbilityImmediately(handle ''ability'', int ''playerIndex'') '''  | ||
''Cast an ability immediately.''  | ''Cast an ability immediately.''  | ||
| Line 12: | Line 12: | ||
;Example  | |||
<source lang="lua">  | |||
local axe = Entities:FindByClassname(nil, "npc_dota_hero_axe")  | |||
if axe then  | |||
   local berserkersCall = axe:FindAbilityByName("axe_berserkers_call")  | |||
   if berserkersCall:IsFullyCastable() then  | |||
      axe:CastAbilityImmediately(berserkersCall, axe:GetPlayerOwnerID())  | |||
   end  | |||
end  | |||
</source>  | |||
== Parameters ==  | == Parameters ==  | ||
{| class="standard-table" style="width: 50%;"  | {| class="standard-table" style="width: 50%;"  | ||
| Line 19: | Line 30: | ||
|-  | |-  | ||
| handle  | | handle  | ||
|   | | ability  | ||
| No Description Set  | | No Description Set  | ||
|-  | |-  | ||
| int  | | int  | ||
|   | | playerIndex  | ||
| No Description Set  | | No Description Set  | ||
|}  | |}  | ||
Revision as of 04:33, 19 August 2014
Function Description
void CastAbilityImmediately(handle ability, int playerIndex)
Cast an ability immediately.
- Example
 
local axe = Entities:FindByClassname(nil, "npc_dota_hero_axe")
if axe then
   local berserkersCall = axe:FindAbilityByName("axe_berserkers_call")
   if berserkersCall:IsFullyCastable() then
      axe:CastAbilityImmediately(berserkersCall, axe:GetPlayerOwnerID())
   end
end
Parameters
| Type | Name | Description | 
|---|---|---|
| handle | ability | No Description Set | 
| int | playerIndex | No Description Set |