TOE - combat scripts

Maps and the art of mapmaking.
mweil86
Leprechaun
Leprechaun
Posts: 13
Joined: 11 Sep 2007

TOE - combat scripts

Unread postby mweil86 » 10 Jun 2008, 10:58

How do you use combat scripts for a combat between 2 heroes? I want to have a script to summon creatures into the battle. I have done this for a neutral stack by putting the SUMMON command in the script for the creature. However, I don't see where to put this script for a hero/hero combat. Any advice?

Franzy
War Dancer
War Dancer
Posts: 362
Joined: 07 Sep 2007
Location: Moscow, Russia
Contact:

Unread postby Franzy » 10 Jun 2008, 11:15

Use function SetHeroCombatScript, its description IS in manual.

Franzy
War Dancer
War Dancer
Posts: 362
Joined: 07 Sep 2007
Location: Moscow, Russia
Contact:

Unread postby Franzy » 11 Jun 2008, 14:24

Also, if human player's hero is custom (not chosen in game setup screen), you can attach the script to him the same way you attach a script to a monster.

User avatar
Warmonger
Pixie
Pixie
Posts: 125
Joined: 15 Dec 2007
Contact:

Unread postby Warmonger » 02 Nov 2008, 17:58

I have opposite problem, actually I don't know how to script neutral stack to spawn additional creatures gradualy.

When facing hero I can use DefenderHeroMove function, but have no idea how to apply it to pack of Treants.

Is there any source where combat scripts are described, or just listed?
VCMI : the future of Heroes 3!
People just don't care.

User avatar
Asheera
Round Table Knight
Round Table Knight
Posts: 4506
Joined: 06 Jul 2008
Location: The Shadows
Contact:

Unread postby Asheera » 02 Nov 2008, 18:03

Warmonger wrote:Is there any source where combat scripts are described, or just listed?
You mean the functions? They are in the Script Functions Manual ("HOMM5_A2_Script_Functions.pdf" in "Editor Documentation" folder)
No matter how powerful one becomes, there is always someone stronger. That's why I'm in a constant pursuit of power, so I can be prepared when an enemy tries to take advantage of me.

User avatar
Warmonger
Pixie
Pixie
Posts: 125
Joined: 15 Dec 2007
Contact:

Unread postby Warmonger » 02 Nov 2008, 18:16

There is NO description of things like CastSpell or DefenderHeroMove which appears in H5 final battle and gives pretty nice possibilities.

These functions need to refer to some objects and trigger at right moment, as such their use is close to zero.
For example GetDefenderCreatures () returns nil array => :wall.
VCMI : the future of Heroes 3!
People just don't care.

User avatar
Asheera
Round Table Knight
Round Table Knight
Posts: 4506
Joined: 06 Jul 2008
Location: The Shadows
Contact:

Unread postby Asheera » 02 Nov 2008, 18:26

You can create 'events' with the sleep command.

Like

Code: Select all

local loop = 1

while loop == 1 do
  sleep(4)

  if the_ending_condition then
    loop = 0
  end

  -- events follow here (if blabla, else blabla, etc)

end
No matter how powerful one becomes, there is always someone stronger. That's why I'm in a constant pursuit of power, so I can be prepared when an enemy tries to take advantage of me.

User avatar
Warmonger
Pixie
Pixie
Posts: 125
Joined: 15 Dec 2007
Contact:

Unread postby Warmonger » 02 Nov 2008, 18:33

The problem is that there is actually no condition I could base on, no turn counter or whatever.

I tried to use AttackerHeroMove as a clock, but for human-controlled hero it gives 100+ iterations before I get control.
Never seen a billion of Warlords before ;)

It worked when I put

Code: Select all

return not nil;
in the function, however this way hero skips his turn with no act at all.
VCMI : the future of Heroes 3!
People just don't care.

User avatar
Asheera
Round Table Knight
Round Table Knight
Posts: 4506
Joined: 06 Jul 2008
Location: The Shadows
Contact:

Unread postby Asheera » 02 Nov 2008, 18:36

I don't know how to make a 'turn counter', but you can use functions like "GetCreatureNumber", etc.
No matter how powerful one becomes, there is always someone stronger. That's why I'm in a constant pursuit of power, so I can be prepared when an enemy tries to take advantage of me.


Return to “Mapmaking Guild”

Who is online

Users browsing this forum: No registered users and 0 guests