Jump to content
  • 0

H>I want to active this npc OnFriday 15:00 ends OnFriday 23:59


itsmeyoe

Question


  • Group:  Members
  • Topic Count:  27
  • Topics Per Day:  0.01
  • Content Count:  54
  • Reputation:   1
  • Joined:  05/19/12
  • Last Seen:  

//===== rAthena Script =======================================
//= Guild Prize Giveaway
//===== By: ==================================================
//= AnnieRuru / Mysterious
//===== Current Version: =====================================
//= 1.5
//===== Compatible With: =====================================
//= rAthena SVN
//===== Description: =========================================
//= Rewards guild masters of castle owners after each
//= War of Emperium session.
//===== Additional Comments: =================================
//= v1.0 - Intitial Re-release [Mysterious]
//= v1.1 - Language structures [Mysterious]
//= v1.2 - Added divisions [Mysterious]
//= v1.3 - Added proper information [Mysterious]
//= v1.4 - Optimized! [Euphy]
//= v1.5 - Little bit of cleaning [Mysterious]
//============================================================

prontera,135,188,5    script    Scarlet Palace    871,{

    mes "[Castle Rewards]";
    if (agitcheck() || agitcheck2()) { mes "WoE is currently still in progress."; close; }
    mes "Please select a castle:";
    next;
    for(set .@i,0; .@i<30; set .@i,.@i+1)
        set .@menu$, .@menu$+getcastlename(.Castles$[.@i])+":";
    set .@i, select(.@menu$)-1;
    mes "[Castle Rewards]";
    if (getcastledata(.Castles$[.@i],1) != getcharid(2)) { mes "You aren't the owner of this castle."; close; }
    if (getguildmasterid(getcharid(2)) != getcharid(0)) { mes "Only the guild master can claim the reward."; close; }
    if ($castle_claimed&(1<<.@i)) { mes "You've already claimed this castle's reward!"; close; }
    mes "Here's your reward for conquering "+getcastlename(.Castles$[.@i])+".";
    set $castle_claimed, $castle_claimed | (1<<.@i);
    
    if (rand(100) <2) {
    setarray .RandItem,5518,5374,5377,5548,5483,1230; //2%
    }
    else if (rand(100) < 49) {
    setarray .RandItem,5013,2383,2410;
    }
    else {
    setarray .RandItem,2629,2630,2541; //10
    }
    getitem 7227,10;
    getitem    7199,10;
    getitem 674,2;
    getitem .RandItem[rand(getarraysize(.RandItem))], 1;  //Set your prize here!
    close;

OnAgitEnd:
    set $castle_claimed, 0;
    end;

OnInit:
    setarray .Castles$[0],
        "payg_cas02";
    end;

}

 

 

 

I want to make this script start at Friday 13:00 Ends 23:59 pleae help me thanks in advance.

Link to comment
Share on other sites

3 answers to this question

Recommended Posts


  • Group:  Content Moderator
  • Topic Count:  22
  • Topics Per Day:  0.00
  • Content Count:  639
  • Reputation:   599
  • Joined:  11/25/11
  • Last Seen:  

Add, below:

if (agitcheck() || agitcheck2()) { mes "WoE is currently still in progress."; close; }

This line:

if (gettime(4) == 5 && gettime(3) => 15 && gettime (3) =< 23){

And close it before the last close:

    getitem 7227,10;
    getitem    7199,10;
    getitem 674,2;
    getitem .RandItem[rand(getarraysize(.RandItem))], 1;  //Set your prize here!
}
close;

By the way, a simple look on doc/script_commands.txt and a few tries and you could solve this by yourself.

Edited by Haziel
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  27
  • Topics Per Day:  0.01
  • Content Count:  54
  • Reputation:   1
  • Joined:  05/19/12
  • Last Seen:  

Can you explain this function? is this npc pop out when friday? 15:00 time and ends in 23:59?

if (gettime(4) == 5 && gettime(3) => 15 && gettime (3) =< 23){

Link to comment
Share on other sites


  • Group:  Content Moderator
  • Topic Count:  22
  • Topics Per Day:  0.00
  • Content Count:  639
  • Reputation:   599
  • Joined:  11/25/11
  • Last Seen:  

My If just checks if it's on correct time.

if (
	gettime(4) == 5		// GetTime(4) returns the Day of Week, 5 is Friday
	&& 
	gettime(3) => 15	// GetTime(5) returns the Hour, 15 means 15:00 
	&&
	gettime (3) =< 23	// Same as above.
){

It checks if it's Friday, AND the hour is 15 or above AND the hour is 23 or below.
If it's not, it'll just close the window.

You can add an else { } with some message warning that it only works on those day and hours.
If you want the NPC to hide itself when It's not that period of time, just add.

OnFriday1500:
	enablenpc "Scarlet Palace";
	end;

OnSaturday0000:
	disablenpc "Scarlet Palace";
	end;

And edit:

OnInit:
	if (gettime(4) == 5 && gettime(3) => 15 && gettime (3) =< 23) disablenpc "Scarlet Palace";
	setarray .Castles$[0],"payg_cas02";
	end;
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...