Jump to content
  • 0

Map Reward


Ninjamon

Question


  • Group:  Members
  • Topic Count:  113
  • Topics Per Day:  0.03
  • Content Count:  295
  • Reputation:   2
  • Joined:  03/06/12
  • Last Seen:  

Can anyone give me a Hourly reward but its only enable on a specific map with NO 5 mins AFK Restriction?



up

Link to comment
Share on other sites

17 answers to this question

Recommended Posts

  • 0

  • Group:  Members
  • Topic Count:  32
  • Topics Per Day:  0.01
  • Content Count:  123
  • Reputation:   6
  • Joined:  03/12/13
  • Last Seen:  

On 3/11/2013 at 6:49 AM, Capuche said:

-	script	hjklm	-1,{
OnPCLoginEvent:
	while(1) {
		sleep2 5000;
		if ( strcharinfo(3) == .map_hourly$ && checkidle() < 60 * .afk_time ) {
			.@loop++;
			if( .@loop == 12 * 60 ) {// 1h
				getitem .item_gain, .item_num;
				.@loop = 0;
			}
		}
		else
			.@loop = 0;
	}
OnInit:
	.item_gain = 501;			// Item ID gained
	.item_num = 1;				// number item gained
	.afk_time = 5;				// afk restriction 5 min
	.map_hourly$ = "prontera";	// map restriction
	end;
}

nice script! but is that works with autotrade user (if i set afk time to 0) ?

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  6
  • Topics Per Day:  0.00
  • Content Count:  150
  • Reputation:   11
  • Joined:  12/03/18
  • Last Seen:  

hi guys can you set this for selected maps only?

 

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  23
  • Topics Per Day:  0.01
  • Content Count:  127
  • Reputation:   36
  • Joined:  01/21/13
  • Last Seen:  

Here you go: hourly.txt

Be sure to read the header notes. Your server needs to be updated to at least r17127 for this to work, as the script calls upon a new script command, checkidle().

Edited by Via
  • Upvote 1
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  113
  • Topics Per Day:  0.03
  • Content Count:  295
  • Reputation:   2
  • Joined:  03/06/12
  • Last Seen:  

Here you go:

 

Be sure to read the header notes. Your server needs to be updated to at least r17127 for this to work, as the script calls upon a new script command, checkidle().

Does this take effect on a specific map only?

Cant Download

up

up

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  23
  • Topics Per Day:  0.01
  • Content Count:  127
  • Reputation:   36
  • Joined:  01/21/13
  • Last Seen:  

Link updated in my previous post. You can define the map in the configuration settings. It is defaulted to Prontera.

 

    // Configuration
    //OnWhisperGlobal:
    OnInit:
        $idletime = 5;                // Allowed idle time in minutes
        $hourlymap$ = "prontera";    // Designated reward map
        $hourlymin = 0;                // The minute on which ro receive reward (0-59)
        $hourlyitem = 909;            // Item ID of the item received hourly
        $hourlyamount = 1;            // Amount of the item to be received
        $servername$ = "Server";    // Server name for thank-you message
        dispbottom "Hourly Reward config has been loaded.";    // Vanity confirmation to confirm load
        end;

 

Read the header in the file for more instructions if need be.

  • Upvote 2
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:  

Replace all Prefix $ to .

You don't need permanent variables here - and it's not a php file

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  23
  • Topics Per Day:  0.01
  • Content Count:  127
  • Reputation:   36
  • Joined:  01/21/13
  • Last Seen:  

Updated: hourly.txt

Edited by Via
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  37
  • Topics Per Day:  0.01
  • Content Count:  144
  • Reputation:   4
  • Joined:  10/28/12
  • Last Seen:  

can you pls modify this so that only 1 person randomly can receive the price in a specific map???ty n adv !!!!

Edited by hyuna
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:  

dispbottom requires an RID and player is not attached on OnInit Label

 

The same for do... while... there are no triggers, no player attached so this do while loop will never start

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  23
  • Topics Per Day:  0.01
  • Content Count:  127
  • Reputation:   36
  • Joined:  01/21/13
  • Last Seen:  

Used an if statement instead with a OnPCLoadMapEvent: hourly.txt

 

The map will need a loadevent mapflag unless you've made the necessary source modifications so that loadevent is run on every map.



dispbottom requires an RID and player is not attached on OnInit Label

 

It runs when the NPC is whispered to, if you're loading this during live gameplay. o-o

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:  

You will say I harrass you but...

 

gettime(2) == .hourlymin

The player must load/warp on the map at the exact minute of the setting otherwise he doesn't get the reward, it's a little weird

 

checkidle() < .idletime*60

If the player load/warp then no need of checkidle coz he won't be idle --'

 

 

It runs when the NPC is whispered to, if you're loading this during live gameplay. o-o

Why not but OnWhisperGlobal were commented in your script

 

 

A good way would be to do a loop when the player log in and check some condition

Another way : a hourly gift to player online (but that's not the request I think)

Edited by Capuche
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  23
  • Topics Per Day:  0.01
  • Content Count:  127
  • Reputation:   36
  • Joined:  01/21/13
  • Last Seen:  

You will say I harrass you but...

 

It's fine. I'd rather have someone point out what's wrong and/or could be improved with my scripts. So if I used a do...while loop that's triggered by an OnPCLoadMapEvent, would that work?

 

    OnPCLoadMapEvent:
        do {
        
            // Receive item
            getitem    .hourlyitem,.hourlyamount;
            
            // Thank-you message
            dispbottom "You have received "+ .hourlyamount +" "+ getitemname(.hourlyitem) +" as your hourly reward.";
            dispbottom "Thank you for playing at "+ .servername$ +"!";
            end;
           
        } while (strcharinfo(3) == .hourlymap$ && gettime(2) == .hourlymin && checkidle() < .idletime*60);
 

 

In theory, OnPCLoadMapEvent would trigger the loop, which would run checks on the condition until it's met, then execute the script. I also added an end statement within the loop so it wouldn't run indefinitely or until the minute was over.

Edited by Via
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:  

So if I used a do...while loop that's triggered by an OnPCLoadMapEvent, would that work?

Yes it will work but be careful about multi-loop : each time a player will warp, a new loop will start

 

which would run checks on the condition until it's met, then execute the script

No the loop will start only if the conditions while( conditions ) are true

 

 

Thinks about it more carefully and make some test on local, you can do it

while I will dream of some horse and pink flowers in dreamland bouhou

Edited by Capuche
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  23
  • Topics Per Day:  0.01
  • Content Count:  127
  • Reputation:   36
  • Joined:  01/21/13
  • Last Seen:  

Yes it will work but be careful about multi-loop : each time a player will warp, a new loop will start

 

So instead, we could add a conditional check to see if the loop has already been run once (.runonce)?

 

    OnPCLoadMapEvent:
        do {
        
            // Receive item
            getitem    .hourlyitem,.hourlyamount;
            
            // Thank-you message
            dispbottom "You have received "+ .hourlyamount +" "+ getitemname(.hourlyitem) +" as your hourly reward.";
            dispbottom "Thank you for playing at "+ .servername$ +"!";
            .runonce = 1;
            end;
           
        } while (strcharinfo(3) == .hourlymap$ && gettime(2) == .hourlymin && checkidle() < .idletime*60 && .runonce != 1);

 

Thinks about it more carefully and make some test on local, you can do it

while I will dream of some horse and pink flowers in dreamland

Wat

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  113
  • Topics Per Day:  0.03
  • Content Count:  295
  • Reputation:   2
  • Joined:  03/06/12
  • Last Seen:  

How to remove the 5 mins idle here?

 

-	script	hourlypoints	-1,{

//--Start of the Script
OnPCLoginEvent:
attachnpctimer ""+strcharinfo(0)+"";
initnpctimer;
end;
    
OnTimer30000:
//Check if Vending (normal or @at)
if(checkvending() >= 1 || checkchatting() == 1) {
    dispbottom "The hourly points event stopped because you were vending / chatting. Please relog if you wish to start again.";
    stopnpctimer;
    end;
}
//Check if Idle
getmapxy( .@map$, .@x, .@y, 0 );
if(@map$ == .@map$ && @x == .@x && @y == .@y) {
    set @afk, @afk + 1;
}
//If move timer resets
else {
    set @afk, 0;
}
    set @map$, .@map$; set @x, .@x; set @y, .@y;
//Idle Check for 5 Minutes
if(@afk == 5) {
    dispbottom "The hourly points event stopped because you were idle for 5 minutes. Please relog if you wish to start again.";
    stopnpctimer;
    end;
}
end;

OnTimer60000:
set @minute, @minute + 1;
//Check for 1 Minute
if(@minute == 60){
    set @minute,0;
    getitem 20517,1;
    dispbottom "You received 1 "+getitemname( 20517 )+" by staying ingame for 1 hour";
    set @consecutive_hour, @consecutive_hour + 1;
    }
//Check for 12 hours consecutive
    if(@consecutive_hour == 6) {
    set @consecutive_hour,0;
    getitem 20517,1;
    dispbottom "You received 6 "+getitemname( 20517 )+" by staying ingame for consecutive of 6 hour";
    }
stopnpctimer;
initnpctimer;
end;

}

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  23
  • Topics Per Day:  0.01
  • Content Count:  127
  • Reputation:   36
  • Joined:  01/21/13
  • Last Seen:  

How to remove the 5 mins idle here?

 

A bit off-topic but uh...change this:

 

//Idle Check for 5 Minutes
if(@afk == 5) {
    dispbottom "The hourly points event stopped because you were idle for 5 minutes. Please relog if you wish to start again.";
    stopnpctimer;
    end;
}

 

to this:

 

/*
//Idle Check for 5 Minutes
if(@afk == 5) {
    dispbottom "The hourly points event stopped because you were idle for 5 minutes. Please relog if you wish to start again.";
    stopnpctimer;
    end;
}
*/

 

...or you can just completely remove that block of code if you never want to check for 5-mins idle again.

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:  

Can anyone give me a Hourly reward but its only enable on a specific map with NO 5 mins AFK Restriction?

up

-	script	hjklm	-1,{
OnPCLoginEvent:
	while(1) {
		sleep2 5000;
		if ( strcharinfo(3) == .map_hourly$ && checkidle() < 60 * .afk_time ) {
			.@loop++;
			if( .@loop == 12 * 60 ) {// 1h
				getitem .item_gain, .item_num;
				.@loop = 0;
			}
		}
		else
			.@loop = 0;
	}
OnInit:
	.item_gain = 501;			// Item ID gained
	.item_num = 1;				// number item gained
	.afk_time = 5;				// afk restriction 5 min
	.map_hourly$ = "prontera";	// map restriction
	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...