Spawning main heroes
OK, here is the list of combat functions (original game only, in patches a few were added)
Hooks (caled at different battle stages):
bool DoPrepare() - when players place troops on the battlefield
bool DoStart() - right after placement phase before anyone moves
bool UnitMove(sUnitName) - right before any AI move
bool AttackerUnitMove(sUnitName)
bool AttackerHeroMove(sUnitName)
bool AttackerCreatureMove(sUnitName)
bool AttackerWarMachineMove(sUnitName)
bool AttackerBuildingMove(sUnitName)
bool DefenderUnitMove(sUnitName)
bool DefenderHeroMove(sUnitName)
bool DefenderCreatureMove(sUnitName)
bool DefenderWarMachineMove(sUnitName)
bool DefenderBuildingMove(sUnitName)
- the same but with unit type
void UnitDeath(sUnitName) - at a stack death
void AttackerUnitDeath(unitName)
void AttackerHeroDeath(sUnitName)
void AttackerCreatureDeath(sUnitName)
void AttackerWarMachineDeath(sUnitName)
void AttackerBuildingDeath(sUnitName)
void DefenderUnitDeath(sUnitName)
void DefenderHeroDeath(sUnitName)
void DefenderCreatureDeath(sUnitName)
void DefenderWarMachineDeath(sUnitName)
void DefenderBuildingDeath(sUnitName)
Control functions:
void EnableDynamicBattleMode( bEnable )
void EnableAutoFinish( bEnable ) - if diabled the battle won't end when all the troops of one side are slain.
void EnableCinematicCamera( bEnable )
void SetControlMode( nSideID, nModeID )
- sets combat mode, cannot use for AI players
ModeID:
MODE_NORMAL = 0
MODE_MANUAL = 1
MODE_AUTO = 2
SideId:
ATTACKER = 0
DEFENDER = 1
void Finish( nSideID ) - nSideID wins!
void Break()
- cancels combat, no losses are suffered by either side
void showHighlighting( bShow = true )
Unit Control:
void SummonCreature( nSideID, nCreatureID, nCount, nX = -1, nY = -1 )
--this adds troops till end of combat
void AddCreature( nSideID, nCreatureID, nCount, nX = -1, nY = -1 )
-- this func adds troops permantntly
-- make sure to add sleep(1) after calling any of these two
void removeUnit( sUnitName )
void UnitCastAimedSpell( sUnitName, nSpellID, sTarget)
void UnitCastGlobalSpell( sUnitName, nSpellID )
void UnitCastAreaSpell( sUnitName, nSpellID, nX, nY )
--Make sure to add sleep(n) after any of these three, where n - is length of comat casting. e.g. 8 for fireball. 20 or so for Implosion.
void SetUnitManaPoints( sUnitName, nPoints )
number GetUnitMaxManaPoints( sUnitName )
number GetUnitManaPoints( sUnitName )
void commandDefend( sUnitName ) --forces defend command
void commandDoSpell( sUnitName, nSpellID, nX, nY )
void commandShot( sUnitName, sVictimName, bDontShowScene = false )
void commandMove( sUnitName, nX, nY, bCheckPath = false )
void commandMoveAttack(sAttacker, sVictim, nX = -1, nY = -1, bCheckPath = false)
void commandDoSpecial(sUnitName, nAbilityID, nX = -1, nY = -1, bCheckPath = false)
void displace( sUnitName, nX, nY ) - instant teleport
void playAnimation( sUnitName, sAnimType, nActionTypeID = ONESHOT )
IDLE = 1
ONESHOT_STILL = 2
ONESHOT = 3
NON_ESSENTIAL = 5
void combatPlayEmotion( nSideID, n1 )
void RemoveAllUnits()
void setATB( sUnitName, n1 )
Other:
tsUnits GetUnits(nSideID, nType)
Types:
HERO = 0
CREATURE = 1
WAR_MACHINE = 2
BUILDING = 3
sHeroName GetHero(nSideID)
tsUnits GetCreatures(nSideID)
tsUnits GetWarMachines(nSideID)
tsUnits GetBuildings(nSideID)
sHeroName GetAttackerHero()
sHeroName GetDefenderHero()
tsUnits GetAttackerCreatures()
tsUnits GetDefenderCreatures()
tsUnits GetAttackerWarMachines()
tsUnits GetDefenderWarMachines()
tsUnits GetAttackerBuildings()
tsUnits GetDefenderBuildings()
nCreatureID GetCreatureType( sCreatureName )
nX, nY pos( sUnitName ) --gets unit position
bool combatStarted() --returns false ifcobat not yet started
sHeroName GetHeroName( sUnitName )
number GetCreatureNumber( sUnitName )
nX, nY GetUnitPosition( sUnitName )
bool exist( sUnitName ) --is unit alive?
nHostType GetHost( nSideID ) --who controls the side
HUMAN = 0
COMPUTER = 1
bool IsHuman( nSideID )
bool IsComputer( nSideID )
nSideID GetUnitSide( sUnitName )
ATTACKER = 0
DEFENDER = 1
bool IsAttacker( sUnitName )
bool IsDefender( sUnitName )
number GetUnitType( sUnitName )
HERO = 0
CREATURE = 1
WAR_MACHINE = 2
BUILDING = 3
bool IsHero( sUnitName )
bool IsCreature( sUnitName )
bool IsWarMachine( sUnitName )
bool IsBuilding( sUnitName )
number GetWarMachineType( sUnitName )
WAR_MACHINE_BALLISTA = 1
WAR_MACHINE_CATAPULT = 2
WAR_MACHINE_FIRST_AID_TENT = 3
WAR_MACHINE_AMMO_CART = 4
sUnitName GetWarMachine( nSideID, nWarMachineTypeID )
sUnitName GetAttackerWarMachine(nWarMachineTypeID)
sUnitName GetDefenderWarMachine(nWarMachineTypeID)
number GetBuildingType( sUnitName )
BUILDING_WALL = 1
BUILDING_GATE = 2
BUILDING_LEFT_TOWER = 3
BUILDING_BIG_TOWER = 4
BUILDING_MOAT = 5
BUILDING_RIGHT_TOWER = 6
BUILDING_MAGIC_WALL = 7
sUnitName GetBuilding(nSideID, nBuildingID)
sUnitName GetAttackerBuilding(nBuildingID)
sUnitName GetDefenderBuilding(nBuildingID)
sUnitName combatReadyPerson() --return current unit (whose turn it is)
Hooks (caled at different battle stages):
bool DoPrepare() - when players place troops on the battlefield
bool DoStart() - right after placement phase before anyone moves
bool UnitMove(sUnitName) - right before any AI move
bool AttackerUnitMove(sUnitName)
bool AttackerHeroMove(sUnitName)
bool AttackerCreatureMove(sUnitName)
bool AttackerWarMachineMove(sUnitName)
bool AttackerBuildingMove(sUnitName)
bool DefenderUnitMove(sUnitName)
bool DefenderHeroMove(sUnitName)
bool DefenderCreatureMove(sUnitName)
bool DefenderWarMachineMove(sUnitName)
bool DefenderBuildingMove(sUnitName)
- the same but with unit type
void UnitDeath(sUnitName) - at a stack death
void AttackerUnitDeath(unitName)
void AttackerHeroDeath(sUnitName)
void AttackerCreatureDeath(sUnitName)
void AttackerWarMachineDeath(sUnitName)
void AttackerBuildingDeath(sUnitName)
void DefenderUnitDeath(sUnitName)
void DefenderHeroDeath(sUnitName)
void DefenderCreatureDeath(sUnitName)
void DefenderWarMachineDeath(sUnitName)
void DefenderBuildingDeath(sUnitName)
Control functions:
void EnableDynamicBattleMode( bEnable )
void EnableAutoFinish( bEnable ) - if diabled the battle won't end when all the troops of one side are slain.
void EnableCinematicCamera( bEnable )
void SetControlMode( nSideID, nModeID )
- sets combat mode, cannot use for AI players
ModeID:
MODE_NORMAL = 0
MODE_MANUAL = 1
MODE_AUTO = 2
SideId:
ATTACKER = 0
DEFENDER = 1
void Finish( nSideID ) - nSideID wins!
void Break()
- cancels combat, no losses are suffered by either side
void showHighlighting( bShow = true )
Unit Control:
void SummonCreature( nSideID, nCreatureID, nCount, nX = -1, nY = -1 )
--this adds troops till end of combat
void AddCreature( nSideID, nCreatureID, nCount, nX = -1, nY = -1 )
-- this func adds troops permantntly
-- make sure to add sleep(1) after calling any of these two
void removeUnit( sUnitName )
void UnitCastAimedSpell( sUnitName, nSpellID, sTarget)
void UnitCastGlobalSpell( sUnitName, nSpellID )
void UnitCastAreaSpell( sUnitName, nSpellID, nX, nY )
--Make sure to add sleep(n) after any of these three, where n - is length of comat casting. e.g. 8 for fireball. 20 or so for Implosion.
void SetUnitManaPoints( sUnitName, nPoints )
number GetUnitMaxManaPoints( sUnitName )
number GetUnitManaPoints( sUnitName )
void commandDefend( sUnitName ) --forces defend command
void commandDoSpell( sUnitName, nSpellID, nX, nY )
void commandShot( sUnitName, sVictimName, bDontShowScene = false )
void commandMove( sUnitName, nX, nY, bCheckPath = false )
void commandMoveAttack(sAttacker, sVictim, nX = -1, nY = -1, bCheckPath = false)
void commandDoSpecial(sUnitName, nAbilityID, nX = -1, nY = -1, bCheckPath = false)
void displace( sUnitName, nX, nY ) - instant teleport
void playAnimation( sUnitName, sAnimType, nActionTypeID = ONESHOT )
IDLE = 1
ONESHOT_STILL = 2
ONESHOT = 3
NON_ESSENTIAL = 5
void combatPlayEmotion( nSideID, n1 )
void RemoveAllUnits()
void setATB( sUnitName, n1 )
Other:
tsUnits GetUnits(nSideID, nType)
Types:
HERO = 0
CREATURE = 1
WAR_MACHINE = 2
BUILDING = 3
sHeroName GetHero(nSideID)
tsUnits GetCreatures(nSideID)
tsUnits GetWarMachines(nSideID)
tsUnits GetBuildings(nSideID)
sHeroName GetAttackerHero()
sHeroName GetDefenderHero()
tsUnits GetAttackerCreatures()
tsUnits GetDefenderCreatures()
tsUnits GetAttackerWarMachines()
tsUnits GetDefenderWarMachines()
tsUnits GetAttackerBuildings()
tsUnits GetDefenderBuildings()
nCreatureID GetCreatureType( sCreatureName )
nX, nY pos( sUnitName ) --gets unit position
bool combatStarted() --returns false ifcobat not yet started
sHeroName GetHeroName( sUnitName )
number GetCreatureNumber( sUnitName )
nX, nY GetUnitPosition( sUnitName )
bool exist( sUnitName ) --is unit alive?
nHostType GetHost( nSideID ) --who controls the side
HUMAN = 0
COMPUTER = 1
bool IsHuman( nSideID )
bool IsComputer( nSideID )
nSideID GetUnitSide( sUnitName )
ATTACKER = 0
DEFENDER = 1
bool IsAttacker( sUnitName )
bool IsDefender( sUnitName )
number GetUnitType( sUnitName )
HERO = 0
CREATURE = 1
WAR_MACHINE = 2
BUILDING = 3
bool IsHero( sUnitName )
bool IsCreature( sUnitName )
bool IsWarMachine( sUnitName )
bool IsBuilding( sUnitName )
number GetWarMachineType( sUnitName )
WAR_MACHINE_BALLISTA = 1
WAR_MACHINE_CATAPULT = 2
WAR_MACHINE_FIRST_AID_TENT = 3
WAR_MACHINE_AMMO_CART = 4
sUnitName GetWarMachine( nSideID, nWarMachineTypeID )
sUnitName GetAttackerWarMachine(nWarMachineTypeID)
sUnitName GetDefenderWarMachine(nWarMachineTypeID)
number GetBuildingType( sUnitName )
BUILDING_WALL = 1
BUILDING_GATE = 2
BUILDING_LEFT_TOWER = 3
BUILDING_BIG_TOWER = 4
BUILDING_MOAT = 5
BUILDING_RIGHT_TOWER = 6
BUILDING_MAGIC_WALL = 7
sUnitName GetBuilding(nSideID, nBuildingID)
sUnitName GetAttackerBuilding(nBuildingID)
sUnitName GetDefenderBuilding(nBuildingID)
sUnitName combatReadyPerson() --return current unit (whose turn it is)
Who is online
Users browsing this forum: No registered users and 1 guest