Spawning main heroes

Maps and the art of mapmaking.
Franzy
War Dancer
War Dancer
Posts: 362
Joined: 07 Sep 2007
Location: Moscow, Russia
Contact:

Unread postby Franzy » 23 Aug 2010, 19:45

What skill you want to implement?

tofiffe
Peasant
Peasant
Posts: 93
Joined: 21 Mar 2010

Unread postby tofiffe » 24 Aug 2010, 07:02

a skill that would be kind of like a combination of ability of Lethos, which poisons enemy creatures at combat start and cripling wound. lasting for the whole combat, since the opponent has a huge advantage.

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

Unread postby Franzy » 24 Aug 2010, 19:34

Yeah, that can be done. You need to write a special combat script for your hero. Take a look at my map Mercenaries, the main hero there can get an ability to cast various spells in the beginning of the battle (like the armor of the damned in Homm3). Look for key words SetHeroCombatScript and SetGameVar. The combat scripts are in separate files called holy and unholy.

tofiffe
Peasant
Peasant
Posts: 93
Joined: 21 Mar 2010

Unread postby tofiffe » 25 Aug 2010, 10:32

those are spells, so i assume you must use cast poison with a lot spell pwr, but as you may remember, my hero is not specified, so writing a combat script for him is out of question, and to use the same code for 8 opponent heroes could solve that, so what do you recomend?

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

Unread postby Franzy » 25 Aug 2010, 17:38

I recommend using SetHeroCombatScript to set the script for a required hero :)

tofiffe
Peasant
Peasant
Posts: 93
Joined: 21 Mar 2010

Unread postby tofiffe » 26 Aug 2010, 07:11

what about the combat script name? GetAttackerHero(); may point to opposing hero too...
and i guess the GetPlayerHeroes(PLAYER_1); only works on non-combat scripts...

and i tried to add it, it just says as error: "Maps\Multiplayer\...\cscript1.lua" doesn't exist...i uset GetMapDataPath().."cscript1.lua"

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

Unread postby Franzy » 27 Aug 2010, 17:34

try adding another '\' in the beginning so it would become \Maps\Multiplayer\.....

tofiffe
Peasant
Peasant
Posts: 93
Joined: 21 Mar 2010

Unread postby tofiffe » 28 Aug 2010, 08:31

ok what happens now, i get the same error msg, but the "\" are removed...

and i tried adding it into data folder and removing the path before it, but now it says it doesn't exist...

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

Unread postby Franzy » 28 Aug 2010, 12:44

Try switching \ to /

tofiffe
Peasant
Peasant
Posts: 93
Joined: 21 Mar 2010

Unread postby tofiffe » 29 Aug 2010, 07:20

foolish me, i checked your script and realised, i need to create a .xdb file...but i just modified your SetHeroCombarScript, it still doesn't work...is there any way that the combat script would be inside the main script itself?

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

Unread postby Franzy » 29 Aug 2010, 09:19

No.

tofiffe
Peasant
Peasant
Posts: 93
Joined: 21 Mar 2010

Unread postby tofiffe » 29 Aug 2010, 10:51

ok i made a function that was supposed to learn heroes every spell they are able, but seems it doesn't work as i mean it to:
function spell()
for i=1,295 do
TeachHeroSpell(a[0], i);
end;
end;
but it doesn't. the first spell that hero can't learn because of requirement makes the script fail. how could i fix that?

wait...it seems there is no spell with id 16...to exclude a single number i should do what?
ok nevermind solved that too...what is wrong with combat script here?
function Start(h)
g=GetAttackerHero()
if IsHuman(g) then
x=GetUnitManaPoints(g) + 6;
SetUnitManaPoints(g,x);
UnitCastGlobalSpell(g,SPELL_MASS_PLAGUE);
else
h=GetDefenderHero()
x=GetUnitManaPoints(h) + 6;
SetUnitManaPoints(h,x);
UnitCastGlobalSpell(h,SPELL_MASS_PLAGUE);
end;
end;
wrong type of argument 1 when calling function GetHost...

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

Unread postby Franzy » 29 Aug 2010, 12:51

Combat scripts work a little differently. They are hooks that trigger every time a cetain event happens. The hook start() doesn't have any arguments.

tofiffe
Peasant
Peasant
Posts: 93
Joined: 21 Mar 2010

Unread postby tofiffe » 30 Aug 2010, 12:08

same error, wrong type of argument 1 when calling function GetHost...

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

Unread postby Franzy » 30 Aug 2010, 18:36

Probably IsHuman functon doesn't work in combat scripts. They have different sets of functions.

tofiffe
Peasant
Peasant
Posts: 93
Joined: 21 Mar 2010

Unread postby tofiffe » 31 Aug 2010, 06:30

so what do you suggest? the player might aswell be attack as attack, what could lookup the human hero in it?

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

Unread postby Franzy » 31 Aug 2010, 19:35

Open console in a battle and try functions out to se whether they work.

tofiffe
Peasant
Peasant
Posts: 93
Joined: 21 Mar 2010

Unread postby tofiffe » 01 Sep 2010, 14:27

@print(GetAttackerHero());
returns: attacker-hero
after trying to mess with it, the error is the same...

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

Unread postby Franzy » 01 Sep 2010, 19:04

That's ok. combat names have nothing to do with adventure mode names. There is a special function to get real hero name, by the way.

tofiffe
Peasant
Peasant
Posts: 93
Joined: 21 Mar 2010

Unread postby tofiffe » 02 Sep 2010, 16:19

and can it be used in a combat script?


Return to “Mapmaking Guild”

Who is online

Users browsing this forum: No registered users and 5 guests