Jump to content
  • 0

OnClock command


karazu

Question


  • Group:  Members
  • Topic Count:  57
  • Topics Per Day:  0.01
  • Content Count:  374
  • Reputation:   5
  • Joined:  03/09/12
  • Last Seen:  

Hello instead of typing on NPC script
 

OnClock0100:
OnClock0300:
OnClock0500:
OnClock0700:
OnClock0900:
OnClock1100:
 
 
 
how to make it shorter that the NPC will  just activate every hour or every 30 mins?


This is every 3 hours?
 

 

OnMinute00:
    if ( ( gettime(3) % 3 ) == 0 )
        // start the event
    end;
 
Link to comment
Share on other sites

4 answers to this question

Recommended Posts


  • Group:  Members
  • Topic Count:  57
  • Topics Per Day:  0.01
  • Content Count:  374
  • Reputation:   5
  • Joined:  03/09/12
  • Last Seen:  

Thank you for the reply.


I am supposed to add it in this script

//Author-Script        Goddameit    My forum : http://bit.ly/MDuQ9F    
//Author-Map        TrojanWorm
//Version        2012-10-31

//Don't re-release in anywhere and anyway

//////////////////////////////////////////////////////////////////////////

endless_war    mapflag    battleground    2
endless_war,218,86,0    script    #BattleGroundwarpA2    100,{
    end;
OnInit:
    waitingroom "Join Team A(Click)",2,"#BattleGroundwarpA2::OnJoin",1;
    end;
OnJoin:
    if(!$@bg_id_a)
        set $@bg_id_a,waitingroom2bg("endless_war",205,85,"","");
    else
        waitingroom2bg_single($@bg_id_a,"endless_war",205,85,"#BattleGroundwarpA2");
    warpwaitingpc "endless_war",205,85;
    end;
}
endless_war,40,86,0    script    #BattleGroundwarpB2    100,{
    end;
OnInit:
    waitingroom "Join Team B(Click)",2,"#BattleGroundwarpB2::OnJoin",1;
    end;
OnJoin:
    if(!$@bg_id_
        set $@bg_id_b,waitingroom2bg("endless_war",53,85,"","");
    else
    waitingroom2bg_single($@bg_id_b,"endless_war",53,85,"#BattleGroundwarpB2");
    warpwaitingpc "endless_war",53,85;
    end;
}
endless_war,165,86,0    script    #BattleGroundwarpA1    45,2,2,{
    warp "endless_war",161,86;
    end;
}
endless_war,90,86,0    script    #BattleGroundwarpB1    45,2,2,{
    warp "endless_war",94,86;
    end;
}
prontera,150,180,4    script    Battle Ground    100,{
    if(.status==2)
    {
        mes "Game is running.";
        close;
    }
    if(.status==1)
    {
        
        if(.playernm>=128)
        {
            mes "Sorry, full";
            close;
        }
        select("Join");
        if(!.playerid[1])
        {
            //callsub OnEndd;
            initnpctimer;
        }
        set .playernm,.playernm+1;
        set .playerid[.playernm],getcharid(0);
        mes "Complete";
        close;
    }
    end;
OnClock0100:
OnClock0300:
OnClock0500:
OnClock0700:
OnClock0900:
OnClock1100:
OnClock1300:
OnClock1500:
OnClock1700:
OnClock1900:
OnClock2100:
OnClock2300:
    callsub OnActive;
    end;
OnActive:
    callsub OnEndd;
    set .status,1;
    Announce "[Battle Ground]:Someone active the game! Go to prontera,150,180 and join us!",0;
    end;
OnTimer60000:
    if(.playernm<=32)
    {
        Announce "[Battle Ground]:Sorry, player amount isn't enough",0;
        callsub OnEndd;
        end;
    }
    Announce "[Battle Ground]:Event is ready!",0;
    for(set .@i,1;.@i<=.playernm;set .@i,.@i+1)
    {
        if(.@i%2==0)
            warpchar "endless_war",218,86,.playerid[.@i];
        else
            warpchar "endless_war",40,86,.playerid[.@i];
    }
    callsub OnEnab2;
    end;
OnTimer90000:
    set .status,2;
    Announce "[Battle Ground]:Go!",0;
    bg_monster $@bg_id_a,"endless_war",128,120,"A",1907,"Battle Ground::OnAdestory";
    bg_monster $@bg_id_b,"endless_war",127,46,"B",1907,"Battle Ground::OnBdestory";
    callsub OnEnab1;
    end;
OnTimer190000:
    if(.point[1]>.point[2])
    {
        Announce "[Battle Ground]:Team A Win!",0;
    }else if(.point[2]>.point[1])
    {
        Announce "[Battle Ground]:Team B Win!",0;
    }else
    {
        Announce "[Battle Ground]:Draw!",0;
    }
    sleep2 3000;
    callsub OnEndd;    
    end;
OnBdestory:
    set .point[1],.point[1]+5;
    set .point[2],.point[2]-3;
    bg_updatescore "endless_war",.point[1],.point[2];
    detachrid;
    sleep2 10000;
    bg_monster $@bg_id_b,"endless_war",127,46,"B",1907,"Battle Ground::OnBdestory";
    end;
OnAdestory:
    set .point[2],.point[2]+5;
    set .point[1],.point[1]-3;
    bg_updatescore "endless_war",.point[1],.point[2];
    detachrid;
    sleep2 10000;
    bg_monster $@bg_id_a,"endless_war",128,120,"A",1907,"Battle Ground::OnAdestory";
    end;
OnEndd:
    set .status,0;
    bg_destroy $@bg_id_a;
    bg_destroy $@bg_id_b;
    set $@bg_id_a,0;
    set $@bg_id_b,0;
    setarray .point[1],0,0;
    killmonsterall "endless_war";
    bg_updatescore "endless_war",.point[1],.point[2];
    deletearray .playerid[0],128;
    mapwarp "endless_war","prontera",150,180;
    callsub OnDisa;
    return;
OnEnab1:
    enablenpc "#BattleGroundwarpA1";
    enablenpc "#BattleGroundwarpB1";
    return;
OnEnab2:
    enablenpc "#BattleGroundwarpA2";
    enablenpc "#BattleGroundwarpB2";
    return;
OnDisa:
    disablenpc "#BattleGroundwarpA1";
    disablenpc "#BattleGroundwarpB1";
    disablenpc "#BattleGroundwarpA2";
    disablenpc "#BattleGroundwarpB2";
    return;
OnInit:
    sleep2 10000;
    setwall "endless_war",218,87,1,1,0,"BattleGroundwarpA21";
    setwall "endless_war",219,87,1,1,0,"BattleGroundwarpA22";
    setwall "endless_war",219,86,1,1,0,"BattleGroundwarpA23";
    setwall "endless_war",219,85,1,1,0,"BattleGroundwarpA24";
    setwall "endless_war",218,85,1,1,0,"BattleGroundwarpA25";
    setwall "endless_war",217,85,1,1,0,"BattleGroundwarpA26";
    setwall "endless_war",217,86,1,1,0,"BattleGroundwarpA27";
    setwall "endless_war",217,87,1,1,0,"BattleGroundwarpA28";
    setwall "endless_war",40,87,1,1,0,"BattleGroundwarpB21";
    setwall "endless_war",41,87,1,1,0,"BattleGroundwarpB22";
    setwall "endless_war",41,86,1,1,0,"BattleGroundwarpB23";
    setwall "endless_war",41,85,1,1,0,"BattleGroundwarpB24";
    setwall "endless_war",40,85,1,1,0,"BattleGroundwarpB25";
    setwall "endless_war",39,85,1,1,0,"BattleGroundwarpB26";
    setwall "endless_war",39,86,1,1,0,"BattleGroundwarpB27";
    setwall "endless_war",39,87,1,1,0,"BattleGroundwarpB28";
    callsub OnEndd;
    end;
OnPCKillEvent:
    if(strcharinfo(3)=="endless_war" && $@bg_id_a && $@bg_id_
    {
        if(getcharid(4) == $@bg_id_a)
        {
            set .point[1],.point[1]+1;
        }else
            set .point[2],.point[2]+1;
        bg_updatescore "endless_war",.point[1],.point[2];
    }
    end;
}
 

ok ill try this one

OnMinute00:
OnMinute30:

// range of 30....
 

currently on my script..

    end;
OnMinute00:
OnMinute30:
    callsub OnActive;
    end;
OnActive:
    callsub OnEndd;
    set .status,1;
    Announce "[Battle Ground]:Someone active the game! Go to prontera,150,180 and join us!",0;
    end;
OnTimer60000:
    if(.playernm<=32)
    {
 

Thank you. This is now solve.

Please help me the about another problem

Link to comment
Share on other sites


  • Group:  Developer
  • Topic Count:  10
  • Topics Per Day:  0.00
  • Content Count:  2407
  • Reputation:   613
  • Joined:  07/05/12
  • Last Seen:  

This

OnMinute00:
    if ( ( gettime(3) % 3 ) == 0 )
        // start the event
    end;
 

will start your event every 3 hours yeah but note that OnClock use less ressource (a bit) than this one since the server will trigger OnMinute label at every 00 minute and check the condition and it will trigger only at 01:00 for OnClock0100

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  31
  • Topics Per Day:  0.01
  • Content Count:  666
  • Reputation:   93
  • Joined:  04/27/12
  • Last Seen:  

Will activate every hour on the hour.

OnMinute00: do this; end;

Will Activate every hour at  XX:30

OnMinute30: do this; end;

If your trying to make it start every X amount of hours, but don't want to use alot of labels, than, you can do what you did, however, keep in mind that the calculations only return remainders, and well, you can get same remainders unintentionally.

So to play it safe you can do this:

-    script    events    -1,{
OnInit:
//We Skip 0 because it's not needed in this case, you'll see why later.
//Put the sub labels that start the event here. Ex:  "NpcName::OnMyEventStart"
setarray .events$[1],"NPC1::OnEvent1","NPC2::OnEvent2","NPC3::OnEvent3";
end;
OnMinute00:
set .Hour,.Hour+1;{ if( .Hour == getarraysize(.events$) ){set .Hour,1;} }
donpcevent .events$[.Hour]
end;
}

This way you can use 1 Script to activate all your Event NPCs. This will also allow your to have events start every X amount of hours. Though, it WOULD be simpler to just use OnClock labels, to start certain events. Because this can only go so far, before it becomes obsolete.

  • Upvote 1
Link to comment
Share on other sites


  • Group:  Forum Moderator
  • Topic Count:  93
  • Topics Per Day:  0.02
  • Content Count:  10015
  • Reputation:   2348
  • Joined:  10/28/11
  • Last Seen:  

how to make it shorter that the NPC will  just activate every hour or every 30 mins?

OnMinute00:    // ( 00 ~ 59 )

how to make it shorter that the NPC will  just activate every hour or every 30 mins?

OnMinute00:
OnMinute30:

// range of 30....
  • Upvote 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...