Spawning main heroes
that the script checks what faction does the player have, then every day it ads a number of creatures, depending on hero faction and day number.
and on day 1 it moves player 3 hero to a location and when he dies, next hero is moved to the location.
the script has 524 lines, it'd be hard to write all of it in here, i can send it on your PM if you want.
and on day 1 it moves player 3 hero to a location and when he dies, next hero is moved to the location.
the script has 524 lines, it'd be hard to write all of it in here, i can send it on your PM if you want.
ok i seem to have found the problem:
Warning! StartThread first parameter must be a function.
i renamed the function already, still the same. Now what the hell is wrong here? The first and only parameter _IS_ a function...but it won't start...i tried removing the quotes, but nothing happened. same warning, the script gets executed, the creatures are added, but only what should be started for first time by this startThread does not execute.
but it doesn't start the function, explanation:startThread("assault");
Warning! StartThread first parameter must be a function.
i renamed the function already, still the same. Now what the hell is wrong here? The first and only parameter _IS_ a function...but it won't start...i tried removing the quotes, but nothing happened. same warning, the script gets executed, the creatures are added, but only what should be started for first time by this startThread does not execute.
function assault()
if IsHeroAlive("Bersy") then
SetObjectPosition( "Bersy",60, 54, 0 );
MoveHero( "Bersy", 12, 23, 0 );
elseif IsHeroAlive("Ottar") then
for i=1,7 do
LevelUpHero(c);
end;
SetObjectPosition( "Ottar",60, 54, 0, 0 );
MoveHero( "Ottar", 12, 23, 0 );
elseif IsHeroAlive("Una") then
for i=2,7 do
LevelUpHero(c);
end;
SetObjectPosition( "Una",60, 54, 0, 0 );
MoveHero( "Una", 12, 23, 0 );
elseif IsHeroAlive("Ingvar") then
for i=3,7 do
LevelUpHero(c);
end;
SetObjectPosition( "Ingvar",60, 54, 0, 0);
MoveHero( "Ingvar", 12, 23, 0 );
elseif IsHeroAlive("Skeggy") then
for i=4,7 do
LevelUpHero(c);
end;
SetObjectPosition( "Skeggy",60, 54, 0, 0 );
MoveHero( "Skeggy", 12, 23, 0 );
elseif IsHeroAlive("Brand") then
for i=5,7 do
LevelUpHero(c);
end;
SetObjectPosition( "Brand",60, 54, 0, 0 );
MoveHero( "Brand", 12, 23, 0 );
elseif IsHeroAlive("Vegeyr") then
for i=6,7 do
LevelUpHero(c);
end;
SetObjectPosition( "Vegeyr",60, 54, 0, 0 );
MoveHero( "Vegeyr", 12, 23, 0 );
elseif IsHeroAlive("Egil") then
LevelUpHero(c[7]);
SetObjectPosition( "Egil",60, 54, 0, 0 );
MoveHero( "Egil", 12, 23, 0 );
else
WinTeam(TEAM_2 );
end;
end;
and why do i now get an error: wrong type argument 1 when calling funciton ChangeHeroStat? I don't even use that in my whole script...i only added a few lines, the script still has an error if i remove them...
Function LevelUpHero() is just a wrapper for changeherostat function, and what you give it is not a heroname obviously.
Also ANYTIME you intend to do something to anobject you just moved or created (in your case) you HAVE TO place sleep(1) between these two. Like this:
SetObjectPosition( "Brand",60, 54, 0, 0 );
sleep(1);
MoveHero( "Brand", 12, 23, 0 );
Also ANYTIME you intend to do something to anobject you just moved or created (in your case) you HAVE TO place sleep(1) between these two. Like this:
SetObjectPosition( "Brand",60, 54, 0, 0 );
sleep(1);
MoveHero( "Brand", 12, 23, 0 );
thanks, i'll try this...
what does the sleep number actualy do?
EDIT: i found the problem...if there is no player two, the GiveHeroExp(b[0], 20200); can't work and the script is not executed...i'll add If IsHeroAlive(b[0]); to prevent this...but the b[0] is wrong argument, why? i use the b=GetPlayerHeroes(PLAYER_3); before it...
what does the sleep number actualy do?
EDIT: i found the problem...if there is no player two, the GiveHeroExp(b[0], 20200); can't work and the script is not executed...i'll add If IsHeroAlive(b[0]); to prevent this...but the b[0] is wrong argument, why? i use the b=GetPlayerHeroes(PLAYER_3); before it...
Who is online
Users browsing this forum: No registered users and 1 guest