Mabuhay Posted July 20, 2013 Group: Members Topic Count: 105 Topics Per Day: 0.02 Content Count: 446 Reputation: 232 Joined: 03/20/12 Last Seen: October 22, 2020 Share Posted July 20, 2013 prontera,148,189,5 script Map Warper 456,{ function t; .@item_required = 607; .@timer_allow = 3600 * 2; // allow to warp 1h .@level_required = 255; .@special_map$ = "map_01"; .@special_map1$ = "map_02"; .@special_map2$ = "map_03"; if ( #allow_use_warper && #allow_use_warper > gettimetick(2) ) { mes "you can use the warp for "+ t( #allow_use_warper - gettimetick(2) ); next; } else { if ( #allow_use_warper && #allow_use_warper < gettimetick(2) ) { #allow_use_warper = 0; setd ".allow_"+ getcharid(3), 0; } if ( BaseLevel < .@level_required ) { mes "you must be level "+ .@level_required +" to go further."; close; } else if ( countitem( .@item_required ) == 0 ) { mes "you need a "+ getitemname( .@item_required ); close; } else if ( #delay_special_warp > gettimetick(2) ) { mes "I'm sorry you can't use this warper. you must wait "+ t( #delay_special_warp - gettimetick(2) ); close; } } mes "Where would you want to go?"; switch(select( "map_01:map_02:map_03" )) { Case 1: warp .@special_map$,0,0; // your warp map if ( !#allow_use_warper ) { #allow_use_warper = gettimetick(2) + .@timer_allow; #delay_special_warp = gettimetick(2) + 86400 / 7; // 1 week of delay } if ( !getd( ".allow_"+ getcharid(3) ) ) { setd ".allow_"+ getcharid(3), 1; attachnpctimer; initnpctimer; } end; Case 2: warp .@special_map1$,0,0; // your warp map if ( !#allow_use_warper ) { #allow_use_warper = gettimetick(2) + .@timer_allow; #delay_special_warp = gettimetick(2) + 86400 / 7; // 1 week of delay } if ( !getd( ".allow_"+ getcharid(3) ) ) { setd ".allow_"+ getcharid(3), 1; attachnpctimer; initnpctimer; } end; Case 3: warp .@special_map2$,0,0; // your warp map if ( !#allow_use_warper ) { #allow_use_warper = gettimetick(2) + .@timer_allow; #delay_special_warp = gettimetick(2) + 86400 / 7; // 1 week of delay } if ( !getd( ".allow_"+ getcharid(3) ) ) { setd ".allow_"+ getcharid(3), 1; attachnpctimer; initnpctimer; } end; } OnTimer300000: // check timer every 5mins OnTimer600000: OnTimer900000: OnTimer1200000: OnTimer1500000: OnTimer1800000: OnTimer2100000: OnTimer2400000: OnTimer2700000: OnTimer3000000: OnTimer3300000: OnTimer3600000: if ( strcharinfo(3) == .@special_map$ && #allow_use_warper && #allow_use_warper < gettimetick(2) ) { stopnpctimer; warp "prontera",0,0; message strcharinfo(0), "end of time"; setd ".allow_"+ getcharid(3), 0; } else if ( strcharinfo(3) != .@special_map$ ) stopnpctimer; end; function t { function s; set .@left, getarg(0); if ( .@left <= 0 ) return getarg(0); set .@day, .@left / 86400; set .@hour, .@left % 86400 / 3600; set .@min, .@left % 3600 / 60; set .@sec, .@left % 60; return ( ( .@day ? .@day +" day"+ s( .@day ) : "" ) + ( .@hour ? .@hour +" hour"+ s( .@hour ) : "" ) + ( .@min ? .@min +" min"+ s( .@min ) : "" ) + ( .@sec ? .@sec +" sec"+ s( .@sec,1 ) : "" ) ); function s { return ( ( getarg(0) > 1 ? "s" : "" ) + ( getarg(1,0) ? "" : " " ) ); } } } I need a little help for that script. = The required item will be consumed once upon activating the warper. = While warper is activated, the npc will not ask for the required item anymore until the next day he enters. = So the next time the player reactivates the warper, it will ask for the requirement again. Thanks :3 Quote Link to comment Share on other sites More sharing options...
Capuche Posted July 20, 2013 Group: Developer Topic Count: 10 Topics Per Day: 0.00 Content Count: 2407 Reputation: 616 Joined: 07/05/12 Last Seen: May 8 Share Posted July 20, 2013 like this? prontera,148,189,5 script Map Warper 456,{ function t; @stoptrick = 0; if ( #allow_use_warper > gettimetick(2) ) {// can use the warper mes "you can use the warp for "+ t( #allow_use_warper - gettimetick(2) ); next; } else { if ( #allow_use_warper && #allow_use_warper < gettimetick(2) ) { #allow_use_warper = 0; } if ( BaseLevel < .level_required ) { mes "you must be level "+ .level_required +" to go further."; close; } else if ( #delay_special_warp > gettimetick(2) ) { mes "I'm sorry you can't use this warper. you must wait "+ t( #delay_special_warp - gettimetick(2) ); close; } else if ( countitem( .item_required ) == 0 ) { mes "you need a "+ getitemname( .item_required ); close; } } mes "Where would you want to go?"; next; switch( select( "map_01:map_02:map_03" ) ) { case 1: if ( @stoptrick ) { mes "I'm sorry you can't use this warper. you must wait "+ t( #delay_special_warp - gettimetick(2) ); close; } warp .special_map1$,0,0; // your warp map break; case 2: if ( @stoptrick ) { mes "I'm sorry you can't use this warper. you must wait "+ t( #delay_special_warp - gettimetick(2) ); close; } warp .special_map2$,0,0; // your warp map break; case 3: if ( @stoptrick ) { mes "I'm sorry you can't use this warper. you must wait "+ t( #delay_special_warp - gettimetick(2) ); close; } warp .special_map3$,0,0; // your warp map break; } if ( !#allow_use_warper ) { #allow_use_warper = gettimetick(2) + .timer_allow; #delay_special_warp = gettimetick(2) + 86400 * 7; // 1 week of delay delitem .item_required, 1; } if ( @timer_alreadyon == 0 ) { .@timer = ( #allow_use_warper - gettimetick(2) ) * 1000; addtimer .@timer, strnpcinfo(3) +"::OnEndofTime"; @timer_alreadyon = 1; } end; OnEndofTime: #allow_use_warper = @timer_alreadyon = 0; .@map$ = strcharinfo(3); if ( .@map$ == .special_map1$ || .@map$ == .special_map2$ || .@map$ == .special_map3$ ) { warp "prontera",0,0; message strcharinfo(0), "end of time"; } else @stoptrick = 1; end; OnPCLoginEvent: callsub L_check; end; L_check: if ( #allow_use_warper > gettimetick(2) ) { addtimer ( #allow_use_warper - gettimetick(2) )* 1000, strnpcinfo(3) +"::OnEndofTime"; @timer_alreadyon = 1; } else if ( #allow_use_warper ) #allow_use_warper = 0; return; function t { function s; set .@left, getarg(0); if ( .@left <= 0 ) return getarg(0); set .@day, .@left / 86400; set .@hour, .@left % 86400 / 3600; set .@min, .@left % 3600 / 60; set .@sec, .@left % 60; return ( ( .@day ? .@day +" day"+ s( .@day ) : "" ) + ( .@hour ? .@hour +" hour"+ s( .@hour ) : "" ) + ( .@min ? .@min +" min"+ s( .@min ) : "" ) + ( .@sec ? .@sec +" sec"+ s( .@sec,1 ) : "" ) ); function s { return ( ( getarg(0) > 1 ? "s" : "" ) + ( getarg(1,0) ? "" : " " ) ); } } OnInit: .item_required = 607; .timer_allow = 3600 * 2; // allow to warp 2h .level_required = 255; .special_map1$ = "geffen"; .special_map2$ = "alberta"; .special_map3$ = "payon"; /* // case of reload script - enable if you want .@count = query_sql( "select `account_id` from `char` where `online` = 1", .@account_id ); while( .@i < .@count ) { attachrid .@account_id[.@i]; callsub L_check; .@i++; } */ } 1 Quote Link to comment Share on other sites More sharing options...
Question
Mabuhay
I need a little help for that script.
= The required item will be consumed once upon activating the warper.
= While warper is activated, the npc will not ask for the required item anymore until the next day he enters.
= So the next time the player reactivates the warper, it will ask for the requirement again.
Thanks :3
Link to comment
Share on other sites
1 answer to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.