Your browser does not support HTML5 canvas. Fork me on GitHub

Available Packages:

Unit

Source

function GetUnitGoldCost(int unitid) returns int

Source

function GetUnitWoodCost(int unitid) returns int

Source

function UnitAlive(unit id) returns boolean

Source

function static unit.abortOrder() returns boolean

Source

Cancels the current order

function static unit.addAbility(int abil) returns boolean

Source

function static unit.addAbility(int abilId, int level)

Source

function static unit.addAgi(int value)

Source

function static unit.addAnimationProperties(string properties, boolean add)

Source

function static unit.addAnimationProperties(string properties)

Source

function static unit.addHP(real val)

Source

function static unit.addInt(int value)

Source

function static unit.addItemById(int itemId) returns item

Source

function static unit.addItemHandle(item whichItem) returns boolean

Source

function static unit.addItemToSlot(int id, int slot) returns boolean

Source

function static unit.addItemToStock(int itmId, int currentStock, int stockMax)

Source

function static unit.addLevels(int toAdd, boolean showEyeCandy)

Source

function static unit.addMana(real val)

Source

function static unit.addPermanentAbility(int abilId)

Source

function static unit.addPermanentAbility(int abilId, int level)

Source

function static unit.addSkillPoints(int value) returns boolean

Source

function static unit.addState(unitstate state, real value)

Source

function static unit.addStr(int value)

Source

function static unit.addType(unittype utype) returns boolean

Source

function static unit.addUnitToStock(int unitId, int currentStock, int stockMax)

Source

function static unit.addXp(int toAdd, boolean showEyeCandy)

Source

function static unit.cancelTimedLife()

Source

function createUnit(int unitId) returns unit

Source

function createUnit(player p, int unitId) returns unit

Source

function createUnit(int unitId, vec2 pos) returns unit

Source

function createUnit(player p, int unitId, vec2 pos) returns unit

Source

function createUnit(player p, int unitId, vec2 pos, angle facing) returns unit

Source

function createUnit(player p, int unitId, vec3 pos, angle facing) returns unit

Source

function createUnitZ(player p, int unitId, vec3 pos, angle facing) returns unit

Source

function static unit.damageTarget(widget target, real amount, boolean attack, boolean ranged, attacktype attackType, damagetype damageType, weapontype weaponType)

Source

function static unit.damageTarget(widget target, real amount, boolean attack, boolean ranged, attacktype attackType)

Source

function static unit.damageTarget(widget target, real amount)

Source

function static unit.damageTarget(widget target, real amount, attacktype attacktyp)

Source

function static unit.decAbilityLevel(int abilityId)

Source

function static unit.disableAbility(int abilId, boolean flag, boolean hideUI)

Source

function static unit.disableAttack(boolean flag, boolean hideUI)

Source

function static unit.disableWorkQueue(boolean flag, boolean hideUI)

Source

function static unit.dropItemPoint(item itm, vec2 pos) returns boolean

Source

function static unit.dropItemSlot(item itm, int slot) returns boolean

Source

function static unit.dropItemTarget(item itm, widget target) returns boolean

Source

function static unit.endAbilityCooldown(int abilCode)

Source

function static unit.explode()

Source

Kills a unit by blowing it up

function static unit.getAbility(int abilId) returns ability

Source

function static unit.getAbilityByIndex(int index) returns ability

Source

function static unit.getAbilityCooldown(int abilId, int levelIndex) returns real

Source

Level is indexed. Level 1 = 0, Level 2 = 1, e.t.c.

function static unit.getAbilityCooldownRemaining(int abilId) returns real

Source

function static unit.getAbilityLevel(int id) returns int

Source

function static unit.getAbilityManaCost(int abilId, int level) returns int

Source

function static unit.getAgi(boolean includeBonuses) returns int

Source

function static unit.getArmor() returns real

Source

function static unit.getAttackCooldown(int weaponIndex) returns real

Source

function static unit.getBaseDamage(int weaponIndex) returns int

Source

function static unit.getCollisionSize() returns real

Source

function static unit.getCurrentOrder() returns int

Source

Returns the current order of the unit

function static unit.getDefaultAcquireRange() returns real

Source

function static unit.getDefaultFlyHeight() returns real

Source

function static unit.getDefaultMovespeed() returns real

Source

function static unit.getDefaultPropWindow() returns angle

Source

Returns the default prop window of the unit as angle.

function static unit.getDefaultTurnSpeed() returns real

Source

function static unit.getDiceNumber(int weaponIndex) returns int

Source

function static unit.getDiceSides(int weaponIndex) returns int

Source

function static unit.getFacingAngle() returns angle

Source

Returns the facing of the unit as an angle. Use this to avoid confusion between radians and degrees

function static unit.getField(unitbooleanfield field) returns boolean

Source

function static unit.getField(unitintegerfield field) returns int

Source

function static unit.getField(unitrealfield field) returns real

Source

function static unit.getField(unitstringfield field) returns string

Source

function static unit.getFieldWeapon(unitweaponbooleanfield field, int weaponIndex) returns boolean

Source

function static unit.getFieldWeapon(unitweaponintegerfield field, int weaponIndex) returns int

Source

function static unit.getFieldWeapon(unitweaponrealfield field, int weaponIndex) returns real

Source

function static unit.getFieldWeapon(unitweaponstringfield field, int weaponIndex) returns string

Source

function static unit.getFlyHeight() returns real

Source

function static unit.getFoodUsed() returns int

Source

function static unit.getGoldCost() returns int

Source

function static unit.getHP() returns real

Source

function static unit.getHPRatio() returns real

Source

function handle.getHandleId() returns int

Source

function static unit.getIcon() returns string

Source

function static unit.getInt(boolean includeBonuses) returns int

Source

function static unit.getIntMaxHP() returns int

Source

function static unit.getIntMaxMana() returns int

Source

function static unit.getItemById(int itemId) returns item

Source

Returns the first item of the specific type from the unit's inventory, or null if none is present

function static unit.getItemSlot(item whichItem) returns int

Source

Retrieves slot number for speficied item or -1 if not found.

function static unit.getLevel() returns int

Source

function static unit.getLocalZ() returns real

Source

function static unit.getMana() returns real

Source

function static unit.getMaxHP() returns real

Source

function static unit.getMaxMana() returns real

Source

function static unit.getMissingHP() returns real

Source

Get units current missing health.

function static unit.getMissingMana() returns real

Source

Get units current missing mana.

function static unit.getMoveSpeed() returns real

Source

function static unit.getName() returns string

Source

function static unit.getOwner() returns player

Source

function static unit.getPointValue() returns int

Source

function static unit.getPos() returns vec2

Source

function static unit.getPos3Fly() returns vec3

Source

function static unit.getPos3Real() returns vec3

Source

function static unit.getPos3Zero() returns vec3

Source

function static unit.getPos3with(real z) returns vec3

Source

function static unit.getPropWindow() returns angle

Source

Returns the prop window of the unit as angle.

function static unit.getProperName() returns string

Source

function static unit.getRallyDestructable() returns destructable

Source

function static unit.getRallyPoint() returns vec2

Source

function static unit.getRallyTarget() returns rallyResult

Source

Returns the rally point of this unit as a rallyResult

function static unit.getRallyUnit() returns unit

Source

function static unit.getSkillPoints() returns int

Source

function static unit.getState(unitstate state) returns real

Source

function static unit.getStr(boolean includeBonuses) returns int

Source

function static unit.getTurnSpeed() returns real

Source

function static unit.getTypeId() returns int

Source

function static unit.getUnitAcquireRange() returns real

Source

function getUnitIcon(int unitId) returns string

Source

function static unit.getUserData() returns int

Source

function static unit.getWoodCost() returns int

Source

function static unit.getX() returns real

Source

function static unit.getXp() returns int

Source

function static unit.getY() returns real

Source

function static unit.hasAbility(int id) returns boolean

Source

function static unit.hasItem(item whichItem) returns boolean

Source

function static unit.hasItemById(int itemId) returns boolean

Source

function static unit.hide()

Source

function static unit.hideAbility(int abilId, boolean flag)

Source

function static unit.incAbilityLevel(int abilityId)

Source

function static unit.interruptAttack()

Source

function static unit.inventory() returns InventoryIterator

Source

Creates an inventory iterator that allows you to access each existing item in the unit's inventory via for-loop. An example 'for i in u.inventory()'.

function static unit.inventorySize() returns int

Source

function static unit.isAlive() returns boolean

Source

Checks if the unit is alive using the UnitAlive native

function static unit.isAllyOf(player whichPlayer) returns boolean

Source

Checks whether a unit is an ally of the given player

function static unit.isAllyOf(unit u) returns boolean

Source

Checks whether two units are allies

function static unit.isBuildInProgress() returns boolean

Source

function static unit.isEnemyOf(player whichPlayer) returns boolean

Source

Checks whether a unit is an enemy of the given player

function static unit.isEnemyOf(unit u) returns boolean

Source

Checks whether two units are enemies

function static unit.isHidden() returns boolean

Source

function static unit.isIllusion() returns boolean

Source

function static unit.isInRange(vec2 pos, real distance) returns boolean

Source

Checks whether a unit is within range of a point. Takes into account the units collision size

function static unit.isInventoryFull() returns boolean

Source

Checks if unit inventory is full.

function static unit.isInvulnerable() returns boolean

Source

function static unit.isPaused() returns boolean

Source

function static unit.isSelectable() returns boolean

Source

function static unit.isSuspendedXp() returns boolean

Source

function static unit.isType(unittype utype) returns boolean

Source

function static unit.isUpgradeInProgress() returns boolean

Source

function static unit.issueImmediateOrder(string order) returns boolean

Source

function static unit.issueImmediateOrderById(int id) returns boolean

Source

function static unit.issuePointOrder(string order, vec2 target) returns boolean

Source

function static unit.issuePointOrderById(int id, vec2 target) returns boolean

Source

function static unit.issueRallyPoint(vec2 pos)

Source

function static unit.issueTargetOrder(string order, widget targetWidget) returns boolean

Source

function static unit.issueTargetOrderById(int id, widget target) returns boolean

Source

function static unit.itemCount() returns int

Source

Returns the number of items equipped.

function static unit.itemCount(int itemTypeId) returns int

Source

Returns the number of slots containing the given item type

function static unit.itemInSlot(int inventoryIndex) returns item

Source

function static unit.kill()

Source

function static unit.lookAt(string bone, unit target, vec3 offset)

Source

function static unit.lookAt(string bone, unit target)

Source

function static unit.makeAbilityPermanent(int abil, boolean flag) returns boolean

Source

function static unit.pause()

Source

function static unit.pauseEx()

Source

function static unit.queueAnimation(string animation)

Source

function rallyResult(RallyType rtype, unit u, destructable d, vec2 pos) returns rallyResult

Source

function static unit.recycleGuardPosition()

Source

function static unit.remove()

Source

function static unit.removeAbility(int abil) returns boolean

Source

function static unit.removeAnimationProperties(string properties)

Source

function static unit.removeGuardPosition()

Source

function static unit.removeItem(item itm)

Source

function static unit.removeItemById(int itemId) returns boolean

Source

Removes the first item of type itemId carried by the unit returns true if an item was found and removed

function static unit.removeItemFromSlot(int slot) returns item

Source

function static unit.removeItemFromStock(int itmId)

Source

function static unit.removeLevels(int toRemove) returns boolean

Source

function static unit.removeType(unittype utype) returns boolean

Source

function static unit.removeUnitFromStock(int unitId)

Source

function static unit.resetAbilityCooldown(int abilId)

Source

function static unit.resetCooldown()

Source

Reset all cooldowns of the unit

function static unit.resetLookAt()

Source

function static unit.revive(vec2 pos, boolean doEyecandy)

Source

function static unit.selectSkill(int abilcode)

Source

function static unit.setAbilityCooldown(int abilId, int levelIndex, real cooldown)

Source

Level is indexed. Level 1 = 0, Level 2 = 1, e.t.c.

function static unit.setAbilityLevel(int abilId, int lvl)

Source

function static unit.setAbilityManaCost(int abilId, int level, int manaCost)

Source

function static unit.setAgi(int value)

Source

function static unit.setAnimation(string name)

Source

function static unit.setAnimation(int index)

Source

function static unit.setArmor(real armorAmount)

Source

function static unit.setAttackCooldown(real cooldown, int weaponIndex)

Source

function static unit.setAttackCooldownPercChange(real attackCooldownPercChange, int weaponIndex) returns real

Source

Change unit attack cooldown by given percentage. Negative values are possible as well. Returns the new attack cooldown time of the unit.

function static unit.setBaseDamage(int baseDamage, int weaponIndex)

Source

function static unit.setColor(playercolor c)

Source

function static unit.setDiceNumber(int diceNumber, int weaponIndex)

Source

function static unit.setDiceSides(int diceSides, int weaponIndex)

Source

function static unit.setExploded(boolean exploded)

Source

Sets whether a unit explodes on death

function static unit.setFacing(angle a)

Source

function static unit.setField(unitbooleanfield field, boolean value) returns boolean

Source

function static unit.setField(unitintegerfield field, int value) returns boolean

Source

function static unit.setField(unitrealfield field, real value) returns boolean

Source

function static unit.setField(unitstringfield field, string value) returns boolean

Source

function static unit.setFieldWeapon(unitweaponbooleanfield field, int weaponIndex, boolean value) returns boolean

Source

function static unit.setFieldWeapon(unitweaponintegerfield field, int weaponIndex, int value) returns boolean

Source

function static unit.setFieldWeapon(unitweaponrealfield field, int weaponIndex, real value) returns boolean

Source

function static unit.setFieldWeapon(unitweaponstringfield field, int weaponIndex, string value) returns boolean

Source

function static unit.setFlyHeight(real height, real rate)

Source

function static unit.setHP(real hp)

Source

function static unit.setInt(int value)

Source

function static unit.setInvulnerable(boolean flag)

Source

function static unit.setLevel(int level, boolean showEyeCandy)

Source

function static unit.setMana(real val)

Source

function static unit.setMaxHP(int hp)

Source

function static unit.setMaxHP(int hp, boolean keepRatio)

Source

Changes a unit's maximum hp, adjusting the current hp to keep the same ratio.

function static unit.setMaxMana(int mana)

Source

function static unit.setMaxMana(int mana, boolean keepRatio)

Source

Changes a unit's maximum mana, adjusting the current mana to keep the same ratio. If the current unit's maximum mana is zero, the ratio will be considered zero.

function static unit.setMoveSpeed(real speed)

Source

function static unit.setMoveSpeedPercChange(real movespeedPercChange) returns real

Source

Change unit movement speed by given percentage. Negative values are possible as well. Returns the new speed of the unit. ex.: using 0.25 on unit with speed 400 will make the new speed 500.

function static unit.setName(string name)

Source

function static unit.setOwner(player p, boolean changeColor)

Source

function static unit.setPathing(boolean value)

Source

function static unit.setPos(vec2 pos)

Source

Sets the unit's position using the SetUnitPosition native. This native comes with some side effects like additional position verification and stopping the target unit.

function static unit.setPos(real x, real y)

Source

function static unit.setPosFly(vec3 pos)

Source

function static unit.setPosReal(vec3 pos)

Source

function static unit.setPropWindow(angle value)

Source

A prop window of 0 prevents the unit from moving, but it can still turn around.

function static unit.setProperName(string name)

Source

function static unit.setScale(real scale)

Source

function static unit.setSkillPoints(int value) returns boolean

Source

function static unit.setState(unitstate state, real value)

Source

function static unit.setStr(int value)

Source

function static unit.setTimeScale(real scale)

Source

function static unit.setTimedLife(real time)

Source

function static unit.setTurnSpeed(real speed)

Source

function static unit.setType(unittype utype, boolean flag) returns boolean

Source

function static unit.setUseFood(boolean flag)

Source

function static unit.setUserData(int data)

Source

function static unit.setVertexColor(int r, int g, int b, int a)

Source

function static unit.setX(real x)

Source

function static unit.setXY(vec2 pos)

Source

Sets the coordinmates of the unit to the given position. Uses the SetUnitX/Y natives

function static unit.setXY(vec3 pos)

Source

Sets the coordinmates of the unit to the given position. Uses the SetUnitX/Y natives

function static unit.setXYZ(vec3 pos)

Source

Sets the coordinmates of the unit to the given position. Z is being set as flyheight. Uses the SetUnitX/Y natives

function static unit.setXYZReal(vec3 pos)

Source

function static unit.setXp(int newXpVal, boolean showEyeCandy)

Source

function static unit.setY(real y)

Source

function static unit.shareVision(player whichPlayer)

Source

Share vision of that unit with a player

function static unit.shareVision(player whichPlayer, boolean share)

Source

Set sharing of vision with a player

function static unit.show()

Source

function static unit.showTeamGlow(boolean show)

Source

function static unit.startAbilityCooldown(int abilCode)

Source

function static unit.startAbilityCooldown(int abilCode, real cooldown)

Source

function static unit.subHP(real val)

Source

function static unit.subMana(real val)

Source

function static unit.subState(unitstate state, real value)

Source

function static unit.suspendXp(boolean suspend)

Source

function static unit.toggleType(unittype utype) returns boolean

Source

function static unit.unpause()

Source

function static unit.unpauseEx()

Source

function static unit.useItem(item itm) returns boolean

Source

function static unit.useItemPoint(item itm, vec2 pos) returns boolean

Source

function static unit.useItemTarget(item itm, widget target) returns boolean

Source

function vec2.withRealZ(unit u) returns vec3

Source