Skip to content

Posts from The game freezes when an allied AI loses.

No ratings yet — be the first to rate!
5 years ago
Auto-translated
Hello! I searched the forum, but couldn't find a similar problem:
On two different powerful laptops, when a computer-controlled ally loses (after 7 days of losing all their castles), the game freezes completely. That is, I finish my turn, the AI opponents take their turns, and the game freezes on the last opponent. Sometimes it even reaches the "Saving" state.
Win7, Core i5, AMD Radeon 330. Tribes of the East.
User Avatar
5 years ago
Auto-translated
Is there any script functionality on the maps?
User Avatar
5 years ago
Auto-translated
This definitely isn't the entire script; also, could you take a look at the creature_table.lua script?
In reply to }{0TT@6bI4
5 years ago
Auto-translated
MapScript.lua--Two Brothers version 1.0 by ****** --
--commented strings aren't work ='(  --
path = GetMapDataPath()
diff = GetDifficulty()
enemy={PLAYER_3,PLAYER_4,PLAYER_5,PLAYER_6}
enemy_town={}
enemy_town[PLAYER_3]="p3town"
enemy_town[PLAYER_4]="p4town"
enemy_town[PLAYER_5]="p5town"
enemy_town[PLAYER_6]="p6town"

doFile(path.."creature_table.lua")

---------------------------------------------
--Adventure Spells---------------------------
---------------------------------------------
function call_way(hero,object)
    local current=GetObjectOwner(hero)
    current=GetPlayerFilter (current)
    if know_call[hero]==1 then
        MessageBoxForPlayers(current,path.."adv_magic/known_refuse.txt")
    elseif GetHeroStat(hero,STAT_EXPERIENCE)>34141 then
        currenthero=hero
        if object=="light_way_teacher" then    QuestionBoxForPlayers(current,path.."adv_magic/a_question.txt","give_light_ability",nil)
        elseif object=="dark_way_teacher" then QuestionBoxForPlayers(current,path.."adv_magic/d_question.txt","give_dark_ability",nil)
        end
    else
        MessageBoxForPlayers(current,path.."adv_magic/pitty_refuse.txt")
    end
end

function haste_way(hero,object)
    local current=GetObjectOwner(hero)
    current=GetPlayerFilter (current)
    if know_haste[hero]==1 then
        MessageBoxForPlayers(current,path.."adv_magic/haste_refuse.txt")
    elseif GetHeroStat(hero,STAT_EXPERIENCE)>81977 then
        currenthero=hero
        QuestionBoxForPlayers(current,path.."adv_magic/haste_question.txt","give_haste",nil)
    else
        MessageBoxForPlayers(current,path.."adv_magic/haste_refuse.txt")
    end
end

function give_light_ability()
    PlayVisualEffect("/Effects/_(Effect)/Spells/Bless.xdb#xpointer(/Effect)",currenthero)
    x,y,z=GetObjectPosition(currenthero)
    Play3DSound("/Sounds/_(Sound)/Spells/bless.xdb#xpointer(/Sound)", x,y,z)    
    PlayObjectAnimation("light_way_teacher","happy",ONESHOT)
    ControlHeroCustomAbility(currenthero, CUSTOM_ABILITY_1, CUSTOM_ABILITY_ENABLED);
    know_call[currenthero]=1
    MarkObjectAsVisited("light_way_teacher",currenthero)
    currenthero=""
end

function give_dark_ability()
    PlayVisualEffect("/Effects/_(Effect)/Spells/DisruptingRay.xdb#xpointer(/Effect)",currenthero)
    local x,y,z=GetObjectPosition(currenthero)
    Play3DSound("/Sounds/_(Sound)/Spells/DisruptingRay.xdb#xpointer(/Sound)", x,y,z)    
    PlayObjectAnimation("dark_way_teacher","speech_orator",ONESHOT)
    ControlHeroCustomAbility(currenthero, CUSTOM_ABILITY_2, CUSTOM_ABILITY_ENABLED);
    know_call[currenthero]=1
    MarkObjectAsVisited("dark_way_teacher",currenthero)
    currenthero=""
end

function give_haste()
    PlayVisualEffect("/Effects/_(Effect)/Spells/Haste.xdb#xpointer(/Effect)",currenthero)
    local x,y,z=GetObjectPosition(currenthero)
    Play3DSound("/Sounds/_(Sound)/Spells/Haste.xdb#xpointer(/Sound)", x,y,z)    
    ControlHeroCustomAbility(currenthero, CUSTOM_ABILITY_3, CUSTOM_ABILITY_ENABLED);
    know_haste[currenthero]=1
    MarkObjectAsVisited("dancer",currenthero)
    currenthero=""
end

function call(hero, ability)
    if ability==CUSTOM_ABILITY_1 then
        SetObjectPosition(hero,4,62,0,3)
        temp=GetHeroStat(hero,STAT_MOVE_POINTS)
        ChangeHeroStat(hero,STAT_MOVE_POINTS,-temp)
        temp=GetHeroStat(hero,STAT_MANA_POINTS)
        ChangeHeroStat(hero,STAT_MANA_POINTS,-temp)
        for i=1,4 do
            AddResource(PLAYER_3)
            AddCreatures(3)
            AddExp(3)
        end
    elseif ability==CUSTOM_ABILITY_2 then
        SetObjectPosition(hero,113,48,1,3)
        SetStoppingRegions()
    elseif ability==CUSTOM_ABILITY_3 then
        temp=GetHeroStat(hero,STAT_MANA_POINTS)
        ChangeHeroStat(hero,STAT_MANA_POINTS,-temp)
        ChangeHeroStat(hero,STAT_MOVE_POINTS,10*temp)
    --elseif ability==CUSTOM_ABILITY_4 then
    --    RMP[hero]=GetHeroStat(hero,STAT_MOVE_POINTS)+RMP[hero]
    --    ChangeHeroStat(hero,STAT_MOVE_POINTS,-RMP[hero])
    end
end

know_call={}
know_haste={}
--RMP={}
--function give_wait(hero)
--    ControlHeroCustomAbility(hero, CUSTOM_ABILITY_4, CUSTOM_ABILITY_ENABLED)
--    RMP[hero]=0
--end

--for i=1,2 do
--    Heroes=GetPlayerHeroes(i)
--    for j,hero in Heroes do
--        give_wait(hero)
--    end
--    Trigger(PLAYER_ADD_HERO_TRIGGER, i, "give_wait")
--end

SetObjectEnabled("light_way_teacher",nil)
SetObjectEnabled("dark_way_teacher",nil)
SetObjectEnabled("dancer",nil)
Trigger(OBJECT_TOUCH_TRIGGER,"light_way_teacher","call_way")
Trigger(OBJECT_TOUCH_TRIGGER,"dark_way_teacher","call_way")
Trigger(OBJECT_TOUCH_TRIGGER,"dancer","haste_way")

Trigger(CUSTOM_ABILITY_TRIGGER, "call");
---------------------------------------------
--End Adventure Spells-----------------------
---------------------------------------------
--Custom Temples-----------------------------
---------------------------------------------
function imp_ask(hero,object)
    currenthero=hero
    local current=GetObjectOwner(hero)
    QuestionBoxForPlayers(current,path.."temples/imp_ask.txt","imp_battle",nil)
end;    
    
function imp_battle()
    local count={}
    for i=1,5 do
        count[i]=(random(5)+1)*GetDate(DAY)
    end
    StartCombat(currenthero,nil,5,CREATURE_IMP,count[1],CREATURE_FAMILIAR,count[2],CREATURE_QUASIT,count[3],CREATURE_FAMILIAR,count[4],CREATURE_IMP,count[5],nil,"imp_result","/Scenes/CombatArenas/Lava_Citadel.(AdventureFlybyScene).xdb#xpointer(/AdventureFlybyScene)",nil)
end

function imp_result(hero,isWin)
    if isWin then
        local count=(random(5)+1)*GetDate(DAY)
        count=sqrt(count)
        count=round(count)
        local side=GetObjectOwner(hero)
        count=GetPlayerResource(side,MERCURY)+count
        ShowFlyingSign(path.."temples/imp_fs.txt",hero,side,3)
        SetPlayerResource(side,MERCURY,count,hero)
        MarkObjectAsVisited("imp_temple",hero)
        Trigger(OBJECT_TOUCH_TRIGGER,"imp_temple","imp_refuse")
    end
end

function imp_refuse(hero,object)
    local current=GetObjectOwner(hero)
    MessageBoxForPlayers(current,path.."temples/imp_refuse.txt")
end

SetObjectEnabled("imp_temple",nil)
Trigger(OBJECT_TOUCH_TRIGGER,"imp_temple","imp_ask")

function cemetry_ask(hero,object)
    currenthero=hero
    local current=GetObjectOwner(hero)
    QuestionBoxForPlayers(current,path.."temples/cemetry_ask.txt","cemetry_battle",nil)
end;    
    
function cemetry_battle()
    local count=(random(5)+5)*10
    StartCombat(currenthero,nil,2,CREATURE_SKELETON,count,CREATURE_SKELETON_ARCHER,count,nil,"cemetry_result",nil,nil)
end

function cemetry_result(hero,isWin)
    if isWin then
        local count=(random(10)+1)*100
        local side=GetObjectOwner(hero)
        count=GetPlayerResource(side,GOLD)+count
        ShowFlyingSign(path.."temples/cemetry_fs.txt",hero,side,3)
        SetPlayerResource(side,GOLD,count,hero)
        MarkObjectAsVisited("cemetry_temple",hero)
        Trigger(OBJECT_TOUCH_TRIGGER,"cemetry_temple","cemetry_refuse")
    end
end

function cemetry_refuse(hero,object)
    local current=GetObjectOwner(hero)
    MessageBoxForPlayers(current,path.."temples/cemetry_refuse.txt")
end

SetObjectEnabled("cemetry_temple",nil)
Trigger(OBJECT_TOUCH_TRIGGER,"cemetry_temple","cemetry_ask")

function arc_ask(hero,object)
    currenthero=hero
    local current=GetObjectOwner(hero)
    QuestionBoxForPlayers(current,path.."temples/arc_ask.txt","arc_battle",nil)
end;    
    
function arc_battle()
    local count={}
    for i=1,3 do
        count[i]=(random(3)+2)*GetDate(DAY)
    end
    StartCombat(currenthero,nil,3,CREATURE_MARKSMAN,count[1],CREATURE_ARCHER,count[2],CREATURE_LONGBOWMAN,count[3],nil,"arc_result",nil,nil)
end

function arc_result(hero,isWin)
    if isWin then
        local count=(random(3)+2)*100*GetDate(DAY)
        local side=GetObjectOwner(hero)
        count=GetPlayerResource(side,GOLD)+count
        ShowFlyingSign(path.."temples/arc_fs.txt",hero,side,3)
        SetPlayerResource(side,GOLD,count,hero)
        MarkObjectAsVisited("arc_tower",hero)
        Trigger(OBJECT_TOUCH_TRIGGER,"arc_tower","arc_refuse")
    end
end

function arc_refuse(hero,object)
    local current=GetObjectOwner(hero)
    MessageBoxForPlayers(current,path.."temples/arc_refuse.txt")
end

SetObjectEnabled("arc_tower",nil)
Trigger(OBJECT_TOUCH_TRIGGER,"arc_tower","arc_ask")


function cry_ask(hero,object)
    currenthero=hero
    local current=GetObjectOwner(hero)
    QuestionBoxForPlayers(current,path.."temples/cry_ask.txt","cry_battle",nil)
end;    
    
function cry_battle()
    local count={}
    for i=1,3 do
        count[i]=(random(6)+2)+7*GetDate(WEEK)
    end
    StartCombat(currenthero,nil,3,CREATURE_POLTERGEIST,count[1],CREATURE_POLTERGEIST,count[2],CREATURE_POLTERGEIST,count[3],nil,"cry_result",nil,nil)
end

function cry_result(hero,isWin)
    if isWin then
        local count=(random(9)+2)+4*GetDate(WEEK)
        local side=GetObjectOwner(hero)
        count=GetPlayerResource(side,CRYSTAL)+count
        ShowFlyingSign(path.."temples/cry_fs.txt",hero,side,3)
        SetPlayerResource(side,CRYSTAL,count,hero)
        MarkObjectAsVisited("crystal",hero)
        Trigger(OBJECT_TOUCH_TRIGGER,"crystal","cry_refuse")
    end
end

function cry_refuse(hero,object)
    local current=GetObjectOwner(hero)
    MessageBoxForPlayers(current,path.."temples/cry_refuse.txt")
end

SetObjectEnabled("crystal",nil)
Trigger(OBJECT_TOUCH_TRIGGER,"crystal","cry_ask")
---------------------------------------------
--End Custom Temples-------------------------
---------------------------------------------
--Gift Column--------------------------------
---------------------------------------------
function ask_gift(hero,object)
    currenthero=hero
    temp=GetObjectOwner(hero)
    current=temp
    if temp==PLAYER_1 then
        temp=PLAYER_2
    elseif temp==PLAYER_2 then
        temp=PLAYER_1
    end
    QuestionBoxForPlayers(current,path.."clons/gift_ask.txt","do_gift",nil)
    --twn="p"..temp.."town"
    --twn=enemy_town[temp]
    --print(temp)
    --print(twn)
    --local owner=GetObjectOwner(twn)
    --print(owner)
    --if owner==current then
    --    QuestionBoxForPlayers(current,path.."clons/return_ask.txt","return_town",nil)
    --end
end

--function return_town()
--    SetObjectOwner(twn,temp)
--end

function do_gift()
    PlayVisualEffect("/Effects/_(Effect)/Spells/LightningBolt.xdb#xpointer(/Effect)","gift_col")
    local x,y,z=GetObjectPosition("gift_col")
    Play3DSound("/Sounds/_(Sound)/Spells/LightningBolt.xdb#xpointer(/Sound)", x,y,z)    
    SetObjectOwner(currenthero,temp)
end

SetObjectEnabled("gift_col",nil)
Trigger(OBJECT_TOUCH_TRIGGER,"gift_col","ask_gift")
    
---------------------------------------------
--End Gift Column----------------------------
---------------------------------------------
--Computer's help----------------------------
---------------------------------------------
function AddResource(player)
    if GetPlayerState(player)==PLAYER_ACTIVE then
        local temp=0
        for i=0,1 do
            temp=GetPlayerResource(player,i)
            SetPlayerResource(player,i,temp+diff*20)
        end
        for i=2,5 do
            temp=GetPlayerResource(player,i)
            SetPlayerResource(player,i,temp+diff*10)
        end
            temp=GetPlayerResource(player,6)
            SetPlayerResource(player,6,temp+diff*10000)
    end
end

function AddExp(player)
    if GetPlayerState(player)==PLAYER_ACTIVE then
        local heroes=GetPlayerHeroes(player)
        local count=GetDate(MONTH)*1000
        for i,h in heroes do
            GiveExp(h,count)
        end
    end
end

function AddCreatures(player)
    local owner=GetObjectOwner(enemy_town[player])
    if owner==player then
        for i=1,7 do
            local bl=GetTownBuildingLevel(enemy_town[player],6+i)
            if bl~=0 then
                local race=GetPlayerRace(player)
                local creature=GetCreatureByData(race,i,1)
                local count=GetObjectDwellingCreatures(enemy_town[player],creature)
                SetObjectDwellingCreatures(enemy_town[player],creature,count+diff*(8-i))
            end
        end
    end
end
    
---------------------------------------------
--End Computer's help------------------------
---------------------------------------------
--New Day------------------------------------
---------------------------------------------
function NewDayF()
    for i=1,4 do
        AddExp(enemy[i])
    end
    local temp=GetDate(DAY_OF_WEEK)
    if temp==1 then
        for i=1,4 do
            AddResource(enemy[i])
            AddCreatures(enemy[i])
        end
    end
    temp=GetDate(DAY)
    if temp==2 then
        --do_test()
    end
    for i=1,6 do
        if temp==52-diff*12+5*i then
            object="entrance2"..i
            player=floor((12-i)/2)
            SetObjectEnabled(object,not nil)
            if GetPlayerState(player)==PLAYER_ACTIVE then
                SetAIPlayerAttractor(object,player,1)
                local x,y,f=GetObjectPosition(object)
                OpenCircleFog(x,y,f,5,player)
            end
        end
    end
end

for i=1,6 do
    object="entrance2"..i
    SetObjectEnabled(object,nil)
end

for i=3,6 do
    if GetPlayerState(i)==PLAYER_ACTIVE then
        SetAIPlayerAttractor("p1town",i,2)
        SetAIPlayerAttractor("p2town",i,2)
    end
end

Trigger(NEW_DAY_TRIGGER,"NewDayF")

function Lost_check(player)
    while not nil do
        local state=GetPlayerState(player)
        if state==PLAYER_NOT_IN_GAME or state==PLAYER_LOST then
            local temp=player
            if temp==PLAYER_1 then
                temp=PLAYER_2
            elseif temp==PLAYER_2 then
                temp=PLAYER_1
            end
            Loose(temp)
        else
            sleep(1)
        end
    end
end

startThread(Lost_check,PLAYER_1)
startThread(Lost_check,PLAYER_2)
---------------------------------------------
--End New Day--------------------------------
---------------------------------------------
--Dark Way-----(Black Hole)------------------
---------------------------------------------
n_regions=97
region_free={}
battle_bonuses={HERO_BATTLE_BONUS_LUCK,HERO_BATTLE_BONUS_MORALE,HERO_BATTLE_BONUS_ATTACK,HERO_BATTLE_BONUS_DEFENCE,HERO_BATTLE_BONUS_INITIATIVE,HERO_BATTLE_BONUS_SPEED}
battle_length=length(battle_bonuses)

for i=0,n_regions do
    reg="unnamed "..i
    Trigger(REGION_ENTER_WITHOUT_STOP_TRIGGER,reg,"DarkWayTrouble")
    region_free[reg]=not nil
end

function SetStoppingRegions()
    local num=diff*2+2+random(5)
    print(num)
    for i=1,num do
        repeat
            reg="unnamed "..random(n_regions)
        until region_free[reg]
        region_free[reg]=nil
        print(reg)
        Trigger(REGION_ENTER_AND_STOP_TRIGGER,reg,"DarkWayPig")
        Trigger(REGION_ENTER_WITHOUT_STOP_TRIGGER,reg,nil)
    end
    for i=84,n_regions do
        local rnd=random(100)+1
        if rnd<3 then
            reg="unnamed "..i
            region_free[reg]=nil
            Trigger(REGION_ENTER_AND_STOP_TRIGGER,reg,"GhostTrouble")
            Trigger(REGION_ENTER_WITHOUT_STOP_TRIGGER,reg,nil)
        end
    end
end

function DarkWayTrouble(hero,region)
    local rnd=random(100)+1
    if rnd<15 then
        local r1,r2=random(battle_length)+1,random(5)+1
        GiveHeroBattleBonus(hero,battle_bonuses[r1],-r2)
    end
end

function GhostTrouble(hero,region)
    local rnd=random(100)+1
    reg=region
    if rnd<40 then
        temp=GetHeroStat(hero,STAT_MOVE_POINTS)
        ChangeHeroStat(hero,STAT_MOVE_POINTS,-temp)
        local side=GetObjectOwner(hero)
        ShowFlyingSign(path.."clons/mp_end.txt",hero,side,3)
        DarkWayBattleFinish(hero,nil)
    elseif rnd<70 then
        temp=GetHeroStat(hero,STAT_MANA_POINTS)
        ChangeHeroStat(hero,STAT_MANA_POINTS,-temp)
        local side=GetObjectOwner(hero)
        ShowFlyingSign(path.."clons/mana_end.txt",hero,side,3)
        DarkWayBattleFinish(hero,nil)
    else
        for k=1,7 do
            local r1,r2=random(3)+1,random(5)+11
            creature[k]=GetCreatureByData(4,3,r1)
            count[k]=GetDate(WEEK)*r2
        end
        StartCombat(hero,nil,7,creature[1],count[1],creature[2],count[2],creature[3],count[3],creature[4],count[4],creature[5],count[5],creature[6],count[6],creature[7],count[7],nil,"DarkWayBattleFinish",nil,nil)
    end
end

function DarkWayPig(hero,region)            
    local rnd=(random(100)+1)
    if rnd<95 then
        local creature={}
        local count={}
        for k=1,7 do
            local r1,r2=random(7)+1,random(3)+1
            creature[k]=GetCreatureByData(4,r1,r2)
            count[k]=(15-r1*2)*GetDate(WEEK)*r2
        end    
        reg=region
        StartCombat(hero,nil,7,creature[1],count[1],creature[2],count[2],creature[3],count[3],creature[4],count[4],creature[5],count[5],creature[6],count[6],creature[7],count[7],nil,"DarkWayBattleFinish",nil,nil)
    else
        reg=region
        call(hero,CUSTOM_ABILITY_2)
        DarkWayBattleFinish(hero,nil)
    end
end
 
function DarkWayBattleFinish(hero,isWin)
    region_free[reg]=not nil
    Trigger(REGION_ENTER_AND_STOP_TRIGGER ,reg,nil)
    Trigger(REGION_ENTER_WITHOUT_STOP_TRIGGER,reg,"DarkWayTrouble")
end
---------------------------------------------
--End Dark Way-------------------------------
---------------------------------------------
--Portals------------------------------------
---------------------------------------------
Portal={}
P_name={}
for i=1,5 do
    Portal[i]="portal"..i
    sleep(1)
    P_name[i]=path.."portals/"..Portal[i]..".txt"
    OverrideObjectTooltipNameAndDescription(Portal[i],P_name[i],"/Text/Game/Buildings/Monoliths/TwoWay-Description.txt")
    SetObjectEnabled(Portal[i],nil)
    Trigger(OBJECT_TOUCH_TRIGGER,Portal[i],"teleport_q")
end

function teleport_q(hero,object)
    local side=GetObjectOwner(hero)
    currenthero=hero
    if (IsAIPlayer(side)==0) then
        TalkBoxForPlayers(side, "/Textures/SpellBook______2618/Spells/Spell_Teleport.xdb#xpointer(/Texture)", path.."portals/"..object..".txt", path.."portals/dialog.txt", path.."portals/down_message.txt", "teleport", 1, path.."portals/"..object..".txt", path.."portals/up_message.txt", 0, P_name[1], P_name[2], P_name[3], P_name[4], P_name[5])
    else
        local n=1+random(5)
        teleport(side,n)
    end
end

function teleport(player,choice)
    if choice>0 then
        local x,y,f=GetObjectPosition(Portal[choice])
        SetObjectPosition(currenthero,x,y,f)
    end
end
---------------------------------------------
--End Portals--------------------------------
---------------------------------------------

function do_test()
    enemy_town[PLAYER_1]="p1town"
    enemy_town[PLAYER_2]="p2town"
    local x,y,f=GetObjectPosition("gift_col")
    OpenCircleFog(x,y,f,100,1)
    OpenCircleFog(x,y,f,100,2)
    local x,y,f=GetObjectPosition("portal5")
    OpenCircleFog(x,y,f,100,1)
    OpenCircleFog(x,y,f,100,2)
    
    for i=1,6 do
        print(i.." player testing")
        AddExp(i)
        AddResource(i)
        AddCreatures(i)
    end
    
    for temp=1,60 do
        for i=1,6 do
            if temp==52-diff*12+5*i then
                object="entrance2"..i
                player=floor((12-i)/2)
                SetObjectEnabled(object,not nil)
                if GetPlayerState(player)==PLAYER_ACTIVE then
                    SetAIPlayerAttractor(object,player,1)
                    local x,y,f=GetObjectPosition(object)
                    OpenCircleFog(x,y,f,5,player)
                end
            end
        end
    end
end


Added after 11 minutes
creature_table.lua--GetPlayerRace
--no neutrals
--version 1.0
--by ******
CreatureTable={}
CreatureTable[0]={
                            {CREATURE_PEASANT,CREATURE_MILITIAMAN,CREATURE_LANDLORD},
                            {CREATURE_ARCHER,CREATURE_MARKSMAN,CREATURE_LONGBOWMAN},
                            {CREATURE_FOOTMAN,CREATURE_SWORDSMAN,CREATURE_VINDICATOR},
                            {CREATURE_GRIFFIN,CREATURE_ROYAL_GRIFFIN,CREATURE_BATTLE_GRIFFIN},
                            {CREATURE_PRIEST,CREATURE_CLERIC,CREATURE_ZEALOT},
                            {CREATURE_CAVALIER,CREATURE_PALADIN,CREATURE_CHAMPION},
                            {CREATURE_ANGEL,CREATURE_ARCHANGEL,CREATURE_SERAPH}
}
CreatureTable[1]={
                              {CREATURE_PIXIE,CREATURE_SPRITE,CREATURE_DRYAD},
                              {CREATURE_BLADE_JUGGLER,CREATURE_WAR_DANCER,CREATURE_BLADE_SINGER},
                              {CREATURE_WOOD_ELF,CREATURE_GRAND_ELF,CREATURE_SHARP_SHOOTER},
                              {CREATURE_DRUID,CREATURE_DRUID_ELDER,CREATURE_HIGH_DRUID},
                              {CREATURE_UNICORN,CREATURE_WAR_UNICORN,CREATURE_WHITE_UNICORN},
                              {CREATURE_TREANT,CREATURE_TREANT_GUARDIAN,CREATURE_ANGER_TREANT},
                              {CREATURE_GREEN_DRAGON,CREATURE_GOLD_DRAGON,CREATURE_RAINBOW_DRAGON}
}
CreatureTable[2]={
                             {CREATURE_GREMLIN,CREATURE_MASTER_GREMLIN,CREATURE_GREMLIN_SABOTEUR},
                             {CREATURE_STONE_GARGOYLE,CREATURE_OBSIDIAN_GARGOYLE,CREATURE_MARBLE_GARGOYLE},
                             {CREATURE_IRON_GOLEM,CREATURE_STEEL_GOLEM,CREATURE_OBSIDIAN_GOLEM},
                             {CREATURE_MAGI,CREATURE_ARCH_MAGI,CREATURE_COMBAT_MAGE},
                             {CREATURE_GENIE,CREATURE_MASTER_GENIE,CREATURE_DJINN_VIZIER},
                             {CREATURE_RAKSHASA,CREATURE_RAKSHASA_RUKH,CREATURE_RAKSHASA_KSHATRI},
                             {CREATURE_GIANT,CREATURE_TITAN,CREATURE_STORM_LORD}
}
CreatureTable[3]={
                             {CREATURE_SCOUT,CREATURE_ASSASSIN,CREATURE_STALKER},
                             {CREATURE_WITCH,CREATURE_BLOOD_WITCH,CREATURE_BLOOD_WITCH_2},
                             {CREATURE_MINOTAUR,CREATURE_MINOTAUR_KING,CREATURE_MINOTAUR_CAPTAIN},
                             {CREATURE_RIDER,CREATURE_RAVAGER,CREATURE_BLACK_RIDER},
                             {CREATURE_HYDRA,CREATURE_CHAOS_HYDRA,CREATURE_ACIDIC_HYDRA},
                             {CREATURE_MATRON,CREATURE_MATRIARCH,CREATURE_SHADOW_MISTRESS},
                             {CREATURE_DEEP_DRAGON,CREATURE_BLACK_DRAGON,CREATURE_RED_DRAGON}
}
CreatureTable[4]={
                                {CREATURE_SKELETON,CREATURE_SKELETON_ARCHER,CREATURE_SKELETON_WARRIOR},
                                {CREATURE_WALKING_DEAD,CREATURE_ZOMBIE,CREATURE_DISEASE_ZOMBIE},
                                {CREATURE_MANES,CREATURE_GHOST,CREATURE_POLTERGEIST},
                                {CREATURE_VAMPIRE,CREATURE_VAMPIRE_LORD,CREATURE_NOSFERATU},
                                {CREATURE_LICH,CREATURE_DEMILICH,CREATURE_LICH_MASTER},
                                {CREATURE_WIGHT,CREATURE_WRAITH,CREATURE_BANSHEE},
                                {CREATURE_BONE_DRAGON,CREATURE_SHADOW_DRAGON,CREATURE_HORROR_DRAGON}
}
CreatureTable[5]={
                             {CREATURE_FAMILIAR,CREATURE_IMP,CREATURE_QUASIT},
                             {CREATURE_DEMON,CREATURE_HORNED_DEMON,CREATURE_HORNED_LEAPER},
                             {CREATURE_HELL_HOUND,CREATURE_CERBERI,CREATURE_FIREBREATHER_HOUND},
                             {CREATURE_SUCCUBUS,CREATURE_INFERNAL_SUCCUBUS,CREATURE_SUCCUBUS_SEDUCER},
                             {CREATURE_NIGHTMARE,CREATURE_FRIGHTFUL_NIGHTMARE,CREATURE_HELLMARE},
                             {CREATURE_PIT_FIEND,CREATURE_BALOR,CREATURE_PIT_SPAWN},
                             {CREATURE_DEVIL,CREATURE_ARCHDEVIL,CREATURE_ARCH_DEMON}
}
CreatureTable[6]={
                           {CREATURE_DEFENDER,CREATURE_STOUT_DEFENDER,CREATURE_STONE_DEFENDER},
                           {CREATURE_AXE_FIGHTER,CREATURE_AXE_THROWER,CREATURE_HARPOONER},
                           {CREATURE_BEAR_RIDER,CREATURE_BLACKBEAR_RIDER,CREATURE_WHITE_BEAR_RIDER},
                           {CREATURE_BROWLER,CREATURE_BERSERKER,CREATURE_BATTLE_RAGER},
                           {CREATURE_RUNE_MAGE,CREATURE_FLAME_MAGE,CREATURE_FLAME_KEEPER},
                           {CREATURE_THANE,CREATURE_WARLORD,CREATURE_THUNDER_THANE},
                           {CREATURE_FIRE_DRAGON,CREATURE_MAGMA_DRAGON,CREATURE_LAVA_DRAGON}
}
CreatureTable[7]={
                                {CREATURE_GOBLIN,CREATURE_GOBLIN_TRAPPER,CREATURE_GOBLIN_DEFILER},
                                {CREATURE_CENTAUR,CREATURE_CENTAUR_NOMAD,CREATURE_CENTAUR_MARADEUR},
                                {CREATURE_ORC_WARRIOR,CREATURE_ORC_SLAYER,CREATURE_ORC_WARMONGER},
                                {CREATURE_SHAMAN,CREATURE_SHAMAN_WITCH,CREATURE_SHAMAN_HAG},
                                {CREATURE_ORCCHIEF_BUTCHER,CREATURE_ORCCHIEF_EXECUTIONER,CREATURE_ORCCHIEF_CHIEFTAIN},
                                {CREATURE_WYVERN,CREATURE_WYVERN_POISONOUS,CREATURE_WYVERN_PAOKAI},
                                {CREATURE_CYCLOP,CREATURE_CYCLOP_UNTAMED,CREATURE_CYCLOP_BLOODEYED}
}

function GetCreatureData(creature)
         for i=0,7 do
             for j=1,7 do
                 for k=1,3 do
                     if CreatureTable[i][j][k]==creature then
                        return i,j,k
                     end
                 end
             end
         end
end

function GetCreatureByData(race,level,update)
         if race~=nil then
            if level~=nil then
               if update~=nil then
                  return CreatureTable[race][level][update]
               else
                   return CreatureTable[race][level]
               end
            else
                return CreatureTable[race]
            end
         else
             return CreatureTable
         end
end

function GetCreatureRace(creature)
         local x1,x2,x3=GetCreatureData(creature)
         return x1
end

function GetCreatureLevel(creature)
         local x1,x2,x3=GetCreatureData(creature)
         return x2
end

function GetCreatureUpdate(creature)
         local x1,x2,x3=GetCreatureData(creature)
         return x3
end
User Avatar
5 years ago
Auto-translated
I understand that the allied player is PLAYER_2, and after their death, the while loop runs endlessly without doing anything... And this leads to the error you're experiencing! Although, judging by the script, after that, the player loses...
5 years ago
Auto-translated
I removed this block from the script, and now everything works. Thank you very much!
User Avatar
5 years ago
Auto-translated
I'd like to make a small correction: the idea is that when you lose an ally, the player loses, so I recommend starting over, as if everything worked as intended.

Statistics

Welcome our newest member: recijeb