• 0
Juan Meissner

Monster Couting Game

Question

 

I'm trying to convert some rathena events to use in the herc.ws emulator, however for some reason I'm not getting through with this one, could anyone help?

 

Quote



 
prontera,155,181,5  script  Monster Counting Game   757,{
    function xy_wall;
    end;
    
    OnInit:
        defpattern 1,"([^:]+):.\\*"+[email protected]+".*", "OnRight";
        .max_round = 3;
        .max_duration = 3;
        .wall_mob_id = 1085;
        setarray .xy_area,
            151,169,
            161,179;
        setarray .monster,
            PORING,
            DROPS,
            MARIN,
            POPORING;
            
        .monster_size = getarraysize( .monster );
        .npc_name$ = strnpcinfo(0);
        getmapxy( .map$,.npc_x,.npc_y,1 );
        setmapflag .map$,mf_monster_noteleport;
        end;
        
    OnMinute00:
    OnStartEvent:
        if ( !.status ) {
            areawarp .map$,.xy_area[0],.xy_area[1],.xy_area[2],.xy_area[3],.map$,.npc_x,.npc_y;
            killmonster .map$,.npc_name$+"::OnDied";
            killmonster .map$,.npc_name$+"::OnWallDied";
            setcell .map$,.xy_area[0],.xy_area[1],.xy_area[2],.xy_area[3],cell_basilica,1;
            setcell .map$,.xy_area[0],.xy_area[1],.xy_area[2],.xy_area[3],cell_walkable,1;
            .status = 1;
            
            for( [email protected] = .xy_area[0]; [email protected] <= .xy_area[2]; [email protected]++ ){
                xy_wall( [email protected],.xy_area[1] );
                xy_wall( [email protected],.xy_area[3] );
            }
            for( [email protected] = .xy_area[1]; [email protected] <= .xy_area[3]; [email protected]++ ){
                xy_wall( .xy_area[0],[email protected],0 );
                xy_wall( .xy_area[2],[email protected] );
            }
            
            do{
                [email protected]round++;
                npctalk "Round # "+[email protected]round;
                sleep 5000;
                
                .status = 2;
                [email protected] = .monster[ rand( .monster_size ) ];
                [email protected] = rand( 5,10 );
                // add-on size influence ?
                areamonster .map$,.xy_area[0],.xy_area[1],.xy_area[2],.xy_area[3],"",[email protected],[email protected],.npc_name$+"::OnDied";
            
                deletepset 1;
                defpattern 1,"([^:]+):.\\*"+[email protected]+".*", "OnRight";
                //defpattern 1, "([^:]+):.*\\sandar 1.*", "Lwarp1";
                activatepset 1;
                waitingroom "How many's there?",0;
                npctalk "Tell me the correct amount of monster in there.";
                // debugmes " > "[email protected]+" "+getmonsterinfo( [email protected],MOB_NAME );
                
                sleep ( .max_duration * 60000 );
                
                killmonster .map$,.npc_name$+"::OnDied";
                delwaitingroom;
                deletepset 1;
                .status = 1;
                sleep 5000;
                
            }while( [email protected]round < .max_round );
            
            npctalk "That's the Last, thank you for participating.";
            emotion e_thx;
            
            killmonster .map$,.npc_name$+"::OnDied";
            killmonster .map$,.npc_name$+"::OnWallDied";
            setcell .map$,.xy_area[0],.xy_area[1],.xy_area[2],.xy_area[3],cell_basilica,0;
            setcell .map$,.xy_area[0],.xy_area[1],.xy_area[2],.xy_area[3],cell_walkable,1;
            .status = 0;
        }
        end;
        
    OnDied:
    OnWallDied:
        end;
 
    OnRight:
        getmapxy( [email protected]$,[email protected],[email protected],0 );
        if ( .status == 0 ) {
            dispbottom "[Counting Game] Event isnt running.";
        }
        else if ( .status == 1 ) {
            dispbottom "[Counting Game] Please wait for the round to start.";
        }
        else if ( distance( .npc_x,.npc_y,[email protected],[email protected] ) > 14 ) {
            dispbottom "[Counting Game] You're too far away.";
        }
        else {
            npctalk "Bravo!! "+strcharinfo(0)+" is correct!!";
            
            // rewards
            getitem 512,1;
            getitem 512,2;
            getitem 512,3;
            
            specialeffect2 EF_POTION_CON;
            awake .npc_name$;
        }
        end;
        
    function    xy_wall {
        [email protected] = getarg(0);
        [email protected] = getarg(1);
        monster .map$,[email protected],[email protected],"",.wall_mob_id,1,.npc_name$+"::OnWallDied";
        setcell .map$,[email protected],[email protected],[email protected],[email protected],cell_walkable,0;
        // setcell .map$,[email protected],[email protected],[email protected],[email protected],cell_basilica,1;
        return;
    }
 
}





 

 

Share this post


Link to post
Share on other sites

3 answers to this question

  • 0

 

I looked here and nothing, no warning, just does not work when you enter the number for the NPC, otherwise npc works perfectly, but the event ends up being useless because the function of typing the number of monsters does not work.

Share this post


Link to post
Share on other sites
  • 0

try this
 

defpattern 1,"([^:]+):.*"+.@amount+".*", "OnRight";

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now