summaryrefslogblamecommitdiff
path: root/npc/011-3/flood.txt
blob: 2d1d0abbb2859507d624b0eb4c3eb734a6abd04a (plain) (tree)
1
2
3
4
5
6
7
8
9




                              
                                                                                 
                                                                                     
                                                          
                                                     
 






                                                            
                                     
        
 
           
           
           
           
           
           
           
           
           
           
           
           
                                                                   



                                                                                      
                                         















                                                                               
                                                


















                                                                                                                  
 
// TMW2 scripts.
// Authors:
//    Jesusalva
// Description:
//    Controls Eternal Swamps.
//    Contains functions to flood the map (hide the bridges - mask 1024 + mask 2)
//    Flood happens at random and causes BluePar to be spawn. Runs every 6/4 minutes.
//    At the 6th minute of an hour (6, 16, 26, 36, 46, 56)
//    At the 2nd minute of an hour (2, 14 ... 44, 54)

011-3,0,0,0	script	#EternalSwampCore	NPC_HIDDEN,{
    end;

OnSwampMob:
    end;

OnInit:
    addmapmask "011-3", MASK_SPECIAL;
    end;

OnMinute02:
OnMinute06:
OnMinute12:
OnMinute16:
OnMinute22:
OnMinute26:
OnMinute32:
OnMinute36:
OnMinute42:
OnMinute46:
OnMinute52:
OnMinute56:
    .@fd=!(getmapmask("011-3")&MASK_SPECIAL); // .@fd - is flooded?

    if (.@fd) {
        // If it is flooded, unflood it to prevent players getting struck for too long
        killmonster("011-3", "#EternalSwampCore::OnSwampMob");
        addmapmask "011-3", MASK_SPECIAL;
        delcells "EterSwampBridge1";
        delcells "EterSwampBridge2";
        delcells "EterSwampBridge3";
        delcells "EterSwampBridge4";
        delcells "EterSwampBridge5";
        delcells "EterSwampBridge6";
        delcells "EterSwampBridge7";
        mapannounce "011-3", "Eternal Swamps: The flood ceases!",bc_all|bc_npc;
    } else {
        // 40% chances to flood, 75% during night
        .@odds=40;
        if (is_night())
            .@odds+=35;

        // Maybe we should flood it
        if (rand(0,100) < .@odds) {
            removemapmask "011-3", MASK_SPECIAL;

            setcells "011-3", 37, 22, 39, 24, 3, "EterSwampBridge1";
            setcells "011-3", 37, 34, 39, 41, 3, "EterSwampBridge2";
            setcells "011-3", 31, 67, 33, 73, 3, "EterSwampBridge3";
            setcells "011-3", 40, 96, 42, 102, 3, "EterSwampBridge4";
            setcells "011-3", 38, 130, 40, 136, 3, "EterSwampBridge5";
            setcells "011-3", 41, 157, 43, 163, 3, "EterSwampBridge6";
            setcells "011-3", 36, 187, 38, 193, 3, "EterSwampBridge7";

            areamonster "011-3", 20, 20, 60, 220, "Bluepar", Bluepar, rand(8,26), "#EternalSwampCore::OnSwampMob";
            mapannounce "011-3", "Eternal Swamps: A flood starts!",bc_all|bc_npc;

            // TODO: Handle players in bridges
        }

    }

    end;
}