Jump to content
  • 0

Modify hourly point snpc


dave23

Question


  • Group:  Members
  • Topic Count:  49
  • Topics Per Day:  0.01
  • Content Count:  99
  • Reputation:   0
  • Joined:  04/23/12
  • Last Seen:  

Hi,

 

I have a hourly points npc but I want to put "You stayed in game for 1 minute" and so on so that players can monitor their playing time. How can I do it?

//===== Hourly Points Script =========================================
//===== By: ==========================================================
//= GorthexTiger modified by Nibi
//===== Current Version: =============================================
//= 1.0
//===== Compatible With: =============================================
//= Any eAthena Version
//===== Description: =================================================
//= Get Points every successful hours of gameplay, you cannot get
//= the points even if you miss a second or a minute. A player will
//= get a very big bonus if they played 3 hours consecutively
//= or without logging out of the game. If the player is vending
//= the script will then stop.
//===== Additional Comments: =========================================
//= You can modify the script to your liking.
//= The default points is Kafrapoints change it anyway if you like.
//= 1.1 = Check Chatting too
//= 1.2 = 5 Minute Idle Check & @at/@autotrade check.
//= 1.3 = Corrected the current balance line on 12 Hours Consecutive
//====================================================================
-	script	hourlypoints	-1,{
//--Start of the Script
OnPCLoginEvent:
    addtimer .timer,"hourlypoints::OnPointGet";
    end;
    
OnPointGet:
    while(checkvending() >= 1 || checkchatting() == 1 || checkidle()>=.dlimit) {
        sleep2 .delay;
        if(.@mes$=="")
            dispbottom set(.@mes$,"The hourly points event haulted because you were vending, chatting, or idle.");
    }
    set #CASHPOINTS, #CASHPOINTS + .point_amt;
    dispbottom "You received "+.point_amt+" Kafrapoints by staying ingame for 1 hour";
    dispbottom "Current Balance = "+#CASHPOINTS+" Kafrapoints";
    set @consecutive_hour, @consecutive_hour + 1;

    //Check for 3 hours consecutive
    if(@consecutive_hour == 3) {
        set @consecutive_hour,0;
        set #CASHPOINTS, #CASHPOINTS + .cpoint_amt;
        dispbottom "You receive "+.cpoint_amt+" Kafrapoints in playing for 12 consecutive hours";
        dispbottom "Current Balance = "+#CASHPOINTS+" Kafrapoints";
    }
    addtimer .timer,"hourlypoints::OnPointGet";
    end;

OnInit:
    set .timer, 1000*60*60; //Timer in milliseconds.
    set .cpoint_amt, 10; //Points gained for consecutive time online.
    set .point_amt, 1; //Normal points gained.
    set .delay, 1000; //Delay for idle re-check check.
    set .dlimit, 60*5; //Stop points if afk greater then in seconds.
}

-	script	check	-1,{
    OnInit:
        bindatcmd "check",strnpcinfo(3)+"::OnCheck";
        end;
    OnCheck:
        dispbottom "You have " +#CASHPOINTS+ " cash points.";
        end;
}
Link to comment
Share on other sites

1 answer to this question

Recommended Posts

  • 1

  • Group:  Forum Moderator
  • Topic Count:  33
  • Topics Per Day:  0.01
  • Content Count:  1268
  • Reputation:   382
  • Joined:  02/03/12
  • Last Seen:  

Hi,

I have a hourly points npc but I want to put "You stayed in game for 1 minute" and so on so that players can monitor their playing time. How can I do it?

Currently untested you'll have to let me know if somethings up.

 

At this point I'm just compiling all of my edits into this script because many people are asking for it.

//===== Hourly Points Script =========================================
//===== By: ==========================================================
//= GorthexTiger modified by Nibi
//===== Current Version: =============================================
//= 1.4.1
//===== Compatible With: =============================================
//= Any eAthena Version
//===== Description: =================================================
//= Get Points every successful hours of gameplay, you cannot get
//= the points even if you miss a second or a minute. A player will
//= get a very big bonus if they played 3 hours consecutively
//= or without logging out of the game. If the player is vending
//= the script will then stop.
//===== Additional Comments: =========================================
//= You can modify the script to your liking.
//= The default points is Kafrapoints change it anyway if you like.
//= 1.1 = Check Chatting too
//= 1.2 = 5 Minute Idle Check & @at/@autotrade check.
//= 1.3 = Corrected the current balance line on 12 Hours Consecutive
//= 1.4 = Added command to check remaining time and updated idle check. (Skorm)
//= 1.4.1 = Modified the msgs to display according to .timer. (Skorm)
//====================================================================
-	script	hourlypoints	-1,{
    
OnPointGet:
	//Check for idle.
	while(checkvending() >= 1 || checkchatting() == 1 || checkidle() >= .idle) {
		if( .@mes$ == "" ) {
			dispbottom set( .@mes$, "The hourly points event stopped because you were vending, chatting, or idle!" );
			set @hourly_points_timer, 0;
		}
		sleep2 .delay;
	}
	
	@consecutive_timer++;
	.@time_string$ = Time2Str( @consecutive_timer * ( .timer / 1000 ) );
	dispbottom "You received "+.points+" Kafrapoint(s) by staying ingame for "+.@time_string$+".";
	#CASHPOINTS = #CASHPOINTS + .points;
	dispbottom "Current Balance = "+#CASHPOINTS+" Kafrapoints";
	@consecutive_bonus++;

	//Check for consecutive timer.
	if(@consecutive_bonus == .cdelay) {
		@consecutive_bonus = 0;
		#CASHPOINTS = #CASHPOINTS + .cpoints;
		dispbottom "You receive a bonus "+.cpoints+" Kafrapoint(s) by playing for "+.@time_string$+" consecutively!!!";
		dispbottom "Current Balance = "+#CASHPOINTS+" Kafrapoint(s)";
	}
	
OnPCLoginEvent:
	addtimer .timer,"hourlypoints::OnPointGet";
	@hourly_points_timer = gettimetick(2) + ( .timer / 1000 );
	end;
	
OnCmdHour:
	message strcharinfo(0),@hourly_points_timer ? Time2Str( @hourly_points_timer )+" remaining before you get your Hourly Reward(s).":"Something went wrong or you're considered idle at the moment, try relogging!";
	end;

OnInit:
	bindatcmd "ctr","hourlypoints::OnCmdHour"; //@ctr to view time till next point.
	.timer   = 1000*60*60; //Timer in milliseconds. ( Default: 1000*60*60 [ = 1 Hour ] )
	.cdelay  = 3;          //Delay before receiving the consecutive bonus. ( Default: 3 [ { ~ 3 Hours } *Using default timer ] )
	.cpoints = 10;         //Points gained for consecutive time online. ( Default: 10 )
	.points  = 1;          //Normal points gained. ( Default: 1 )
	.delay   = 1000;       //Delay for idle re-check check. ( Default: 1000 [ = 1 Second ] )
	.idle    = 60*5;       //Player is idle after not moving for this many seconds. ( Default: 60*5 [ = 5 Minutes ] )
}

-	script	check	-1,{
    OnInit:
        bindatcmd "check",strnpcinfo(3)+"::OnCheck";
        end;
    OnCheck:
        dispbottom "You have " +#CASHPOINTS+ " cash points.";
        end;
}
  • Upvote 2
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...