Jump to content
  • 0

How to add specific item to enter farm zone


topechi

Question


  • Group:  Members
  • Topic Count:  24
  • Topics Per Day:  0.01
  • Content Count:  52
  • Reputation:   2
  • Joined:  11/13/16
  • Last Seen:  

I'd like to add like a specific item for example a farm room ticket with expiration (1hour) to enter the farm zone. If the ticket expires, players will be warped out of the farm zone and ticket will disappear. please and thank you!

prontera,155,185,5 script Farm Zone 1_F_MARIA,{

while ( true ) {

mes "How can i help you ?";

switch( select( "Information:Farm Items" )) {

case 1:

mes "This is a Farm Zone.";

mes "You are able to Hunt Monster inside this Room.";

mes "Every Monster will award you random items.";

next;

mes "But there is some Condition..";

mes "You can only go in ^FF0000once every "+.RoomCleanMin+" minutes for 1 times.^000000";

mes "And Maximum of ^FF0000"+.MaxPlayers+" Players per "+.RoomCleanMin+" Minutes.^000000";

mes "Maximum Hunting Limit ^FF0000"+.MaxItemLimit+"^000000";

next;

mes "There will be a ^FF0000Room Cleaning^000000 from time to time...";

mes "All players will be kicked out, it is your bad luck if you meet this.";

mes "Delay will still apply even though you just go in for 1 Seconds..";

next;

break;

case 2:

// #HuntRoomDelay = 0;

if ( #HuntRoomDelay + .DelayMin * 60 > gettimetick(2) ) {

mes "Wait for ^FF0000"+( ( ( #HuntRoomDelay + .DelayMin * 60 ) - gettimetick(2) )/60 )+" Minutes^000000.";

close;

} else if ( getarraysize( .Hunter ) >= .MaxPlayers ) {

mes "Currently the Room is Full. Please try again later.";

close;

} else {

warp .Map$,0,0;

set .Hunter[getarraysize( .Hunter )], getcharid(3);

set #HuntRoomDelay, gettimetick(2); // please don't set the deny variable into the future, if admin adjust the setting to decrease the value, player will experience long deny

set #FarmHunt,0;

end;

}

}

}

close;

OnNormalKill:

monster .Map$,0,0,"--ja--",.normal_mob[rand(.normal_mob_size)],1,strnpcinfo(0)+"::OnNormalKill";

getitem .farm_normal[rand(.farm_normal_size)], 1;

goto L_kill;

OnBossKill:

monster .Map$,0,0,"--ja--",.boss_mob[rand(.boss_mob_size)],1,strnpcinfo(0)+"::OnBossKill";

getitem .farm_boss[rand(.farm_boss_size)], 1;

L_kill:

#FarmHunt++;

dispbottom "[ Farm Zone ] : Farmed "+ #FarmHunt +" / "+.MaxItemLimit+" Items";

if ( #FarmHunt >= .MaxItemLimit ) {

message strcharinfo(0),"Limit Reach , you may join again later.";

sleep2 2000;

warp "prontera",155,181;

}

end;

OnInit:

// Maximum Player can join per X Minutes.

set .MaxPlayers,5;

// Adding X Minutes of Delay before can go in again.

set .DelayMin,15;

// Maximum Hunt Limit per round inside the Zone.

set .MaxItemLimit,1000;

// Map that will be used in thos Zone.

set .Map$,"moc_fild19";

// Clear Map Every X Minutes.

set .RoomCleanMin,15;

// Mapflag Initialization

setmapflag .Map$, mf_nomobloot;

setmapflag .Map$, mf_nomvploot;

setmapflag .Map$, mf_nowarpto;

setmapflag .Map$, mf_nochat;

setmapflag .Map$, mf_novending;

setmapflag .Map$, mf_nocommand,60;

setmapflag .Map$, mf_nojobexp;

setmapflag .Map$, mf_nobaseexp;



setarray .farm_normal, 501,502,503,504,505; // farm 1 of these items when kill normal mobs

setarray .farm_boss, 506,507,508,509,510; // farm 1 of these items when kill boss monsters



setarray .normal_mob, 2401,2402,2403,2404;

setarray .boss_mob, 1388, 1096, 1120;



.farm_normal_size = getarraysize(.farm_normal);

.farm_boss_size = getarraysize(.farm_boss);

.boss_mob_size = getarraysize(.boss_mob);

.normal_mob_size = getarraysize(.normal_mob);

while ( true ) {

killmonster .Map$, "All";

cleanmap .Map$; // you also forgot about this command

mapwarp .Map$,"prontera",155,181;

for ( .@i = 0; .@i < 80; .@i++ )

monster .Map$,0,0, "[ Farm Zone ] Resident", .normal_mob[ rand( .normal_mob_size ) ], 1, strnpcinfo(0)+"::OnNormalKill";

for ( .@i = 0; .@i < 5; .@i++ )

monster .Map$,0,0, "[ Farm Zone ] Guardian", .boss_mob[ rand( .boss_mob_size ) ], 1, strnpcinfo(0)+"::OnBossKill";

deletearray .Hunter;

announce "[ Farm Zone ] : Farming Zone has been Cleaned up, another 5 Players may go in now.", bc_blue;

sleep ( .RoomCleanMin * 60000 );

mapannounce .Map$,"[ Farm Zone ] : Room Clean Up now...All Users will be warped Out.", bc_map;

killmonster .Map$, "All";

sleep 3000;

}

end;

}

 

Edited by Emistry
Please use CODEBOX.
Link to comment
Share on other sites

5 answers to this question

Recommended Posts

  • 0

  • Group:  Members
  • Topic Count:  6
  • Topics Per Day:  0.00
  • Content Count:  261
  • Reputation:   53
  • Joined:  11/11/16
  • Last Seen:  

if(countitem(501) >= 1 && countitem(502) >= 1 && countitem(503) >= 1)
    {
        delitem 501,1;
        delitem 502,1;
        delitem 503,1;
        getitem <ID_COIN>,1;
        mes "Complete!";
    }
else
    {
        mes "You do not have items.";
    }
close;
}
//    mvp room summoner
-    script    Main_MVP_warper    -1,{
   .@id = atoi( strnpcinfo(2) );
   mes "[ ^0065DF"+ strnpcinfo(1) +"^000000 ]";
   mes "Would you like to enter Room "+ .@id +" ?";
   next;
   if ( select ( "Yes", "No" ) == 2 ) {
       mes "Good bye then.";
       close;
   }
   if ( getd( "timeused"+ .@id ) + 180000 > gettimetick(2) ) { // 180,000 seconds delay (5 hours)
       mes "We are revitalizing Room "+ .@id +", come back later.";
       close;
   }
   if ( getmapusers( "bossnia_0"+ .@id ) ) {
       mes "Sorry, a player is in the room.";
       close;
   }
   warp "bossnia_0"+ .@id, 180,71;
   deltimer strnpcinfo(0) +"::OnKick";
   addtimer 600000, strnpcinfo(0) +"::OnKick"; // 600,000 seconds warp out (10 minutes)
   setd "timeused"+ .@id, gettimetick(2);
   end;
OnKick:
   if ( strcharinfo(3) == "bossnia_0"+ .@id )
       warp "SavePoint", 0,0;
   end;
}

First box will show you how to check for item, take it, 2nd code box will show you how to set the timer in the room.

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  24
  • Topics Per Day:  0.01
  • Content Count:  52
  • Reputation:   2
  • Joined:  11/13/16
  • Last Seen:  

21 hours ago, srhmike said:

if(countitem(501) >= 1 && countitem(502) >= 1 && countitem(503) >= 1)
    {
        delitem 501,1;
        delitem 502,1;
        delitem 503,1;
        getitem <ID_COIN>,1;
        mes "Complete!";
    }
else
    {
        mes "You do not have items.";
    }
close;
}

//    mvp room summoner
-    script    Main_MVP_warper    -1,{
   .@id = atoi( strnpcinfo(2) );
   mes "[ ^0065DF"+ strnpcinfo(1) +"^000000 ]";
   mes "Would you like to enter Room "+ .@id +" ?";
   next;
   if ( select ( "Yes", "No" ) == 2 ) {
       mes "Good bye then.";
       close;
   }
   if ( getd( "timeused"+ .@id ) + 180000 > gettimetick(2) ) { // 180,000 seconds delay (5 hours)
       mes "We are revitalizing Room "+ .@id +", come back later.";
       close;
   }
   if ( getmapusers( "bossnia_0"+ .@id ) ) {
       mes "Sorry, a player is in the room.";
       close;
   }
   warp "bossnia_0"+ .@id, 180,71;
   deltimer strnpcinfo(0) +"::OnKick";
   addtimer 600000, strnpcinfo(0) +"::OnKick"; // 600,000 seconds warp out (10 minutes)
   setd "timeused"+ .@id, gettimetick(2);
   end;
OnKick:
   if ( strcharinfo(3) == "bossnia_0"+ .@id )
       warp "SavePoint", 0,0;
   end;
}

First box will show you how to check for item, take it, 2nd code box will show you how to set the timer in the room.

Which part of the script should i insert box 1 and 2 sir? sorry just a newbie here. thanks in advance sir!

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  6
  • Topics Per Day:  0.00
  • Content Count:  261
  • Reputation:   53
  • Joined:  11/11/16
  • Last Seen:  

prontera,155,185,5	script	Farm Zone	1_F_MARIA,{

while ( true ) {
mes "How can i help you ?";
switch( select( "Information:Farm Items" )) {

case 1:
mes "This is a Farm Zone.";
mes "You are able to Hunt Monster inside this Room.";
mes "Every Monster will award you random items.";
next;
mes "But there is some Condition..";
mes "You can only go in ^FF0000once every "+.RoomCleanMin+" minutes for 1 times.^000000";
mes "And Maximum of ^FF0000"+.MaxPlayers+" Players per "+.RoomCleanMin+" Minutes.^000000";
mes "Maximum Hunting Limit ^FF0000"+.MaxItemLimit+"^000000";
next;
mes "There will be a ^FF0000Room Cleaning^000000 from time to time...";
mes "All players will be kicked out, it is your bad luck if you meet this.";
mes "Delay will still apply even though you just go in for 1 Seconds..";
next;

break;

case 2:

// #HuntRoomDelay = 0;

if ( #HuntRoomDelay + .DelayMin * 60 > gettimetick(2) ) {
mes "Wait for ^FF0000"+( ( ( #HuntRoomDelay + .DelayMin * 60 ) - gettimetick(2) )/60 )+" Minutes^000000.";
close;

if ( getarraysize( .Hunter ) >= .MaxPlayers ) {
mes "Currently the Room is Full. Please try again later.";
close;

if(countitem(501) >= 1)
    {
        delitem 501,1;
		deltimer strnpcinfo(0) +"::OnKick";
   addtimer 600000, strnpcinfo(0) +"::OnKick"; // 600,000 seconds warp out (10 minutes)
   setd "timeused"+ .@id, gettimetick(2);
  mes "Complete!";
  end;
 
    }
else
    {
        mes "You do not have items.";
    }
close;


warp .Map$,0,0;

set .Hunter[getarraysize( .Hunter )], getcharid(3);

set #HuntRoomDelay, gettimetick(2); // please don't set the deny variable into the future, if admin adjust the setting to decrease the value, player will experience long deny

set #FarmHunt,0;


end;

}

}

}

close;
OnKick:
   if ( strcharinfo(3) == ".Map$"+ .@id )
       warp "SavePoint", 0,0;
   end;

OnNormalKill:
monster .Map$,0,0,"--ja--",.normal_mob[rand(.normal_mob_size)],1,strnpcinfo(0)+"::OnNormalKill";
getitem .farm_normal[rand(.farm_normal_size)], 1;
goto L_kill;

OnBossKill:
monster .Map$,0,0,"--ja--",.boss_mob[rand(.boss_mob_size)],1,strnpcinfo(0)+"::OnBossKill";
getitem .farm_boss[rand(.farm_boss_size)], 1;

L_kill:

#FarmHunt++;

dispbottom "[ Farm Zone ] : Farmed "+ #FarmHunt +" / "+.MaxItemLimit+" Items";

if ( #FarmHunt >= .MaxItemLimit ) {

message strcharinfo(0),"Limit Reach , you may join again later.";

sleep2 2000;

warp "prontera",155,181;

}

end;

OnInit:

// Maximum Player can join per X Minutes.
set .MaxPlayers,5;
// Adding X Minutes of Delay before can go in again.
set .DelayMin,15;
// Maximum Hunt Limit per round inside the Zone.
set .MaxItemLimit,1000;
// Map that will be used in thos Zone.
set .Map$,"moc_fild19";
// Clear Map Every X Minutes.
set .RoomCleanMin,15;
// Mapflag Initialization

setmapflag .Map$, mf_nomobloot;

setmapflag .Map$, mf_nomvploot;

setmapflag .Map$, mf_nowarpto;

setmapflag .Map$, mf_nochat;

setmapflag .Map$, mf_novending;

setmapflag .Map$, mf_nocommand,60;

setmapflag .Map$, mf_nojobexp;

setmapflag .Map$, mf_nobaseexp;



setarray .farm_normal, 501,502,503,504,505; // farm 1 of these items when kill normal mobs

setarray .farm_boss, 506,507,508,509,510; // farm 1 of these items when kill boss monsters



setarray .normal_mob, 2401,2402,2403,2404;

setarray .boss_mob, 1388, 1096, 1120;



.farm_normal_size = getarraysize(.farm_normal);

.farm_boss_size = getarraysize(.farm_boss);

.boss_mob_size = getarraysize(.boss_mob);

.normal_mob_size = getarraysize(.normal_mob);

while ( true ) {

killmonster .Map$, "All";

cleanmap .Map$; // you also forgot about this command

mapwarp .Map$,"prontera",155,181;

for ( .@i = 0; .@i < 80; .@i++ )

monster .Map$,0,0, "[ Farm Zone ] Resident", .normal_mob[ rand( .normal_mob_size ) ], 1, strnpcinfo(0)+"::OnNormalKill";

for ( .@i = 0; .@i < 5; .@i++ )

monster .Map$,0,0, "[ Farm Zone ] Guardian", .boss_mob[ rand( .boss_mob_size ) ], 1, strnpcinfo(0)+"::OnBossKill";

deletearray .Hunter;

announce "[ Farm Zone ] : Farming Zone has been Cleaned up, another 5 Players may go in now.", bc_blue;

sleep ( .RoomCleanMin * 60000 );

mapannounce .Map$,"[ Farm Zone ] : Room Clean Up now...All Users will be warped Out.", bc_map;

killmonster .Map$, "All";

sleep 3000;

}

end;

}

Something like this, I dont think the proper [Tab] are in the codebox.

Also on the ticket you are using youll have to change it in the script.  Right now its using item 501. 

Crap I messed up.  Let me change it up lol

Edited by srhmike
screwed up
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  6
  • Topics Per Day:  0.00
  • Content Count:  261
  • Reputation:   53
  • Joined:  11/11/16
  • Last Seen:  

prontera,155,185,5	script	Farm Zone	1_F_MARIA,{

while ( true ) {
mes "How can i help you ?";
switch( select( "Information:Farm Items" )) {

case 1:
mes "This is a Farm Zone.";
mes "You are able to Hunt Monster inside this Room.";
mes "Every Monster will award you random items.";
next;
mes "But there is some Condition..";
mes "You can only go in ^FF0000once every "+.RoomCleanMin+" minutes for 1 times.^000000";
mes "And Maximum of ^FF0000"+.MaxPlayers+" Players per "+.RoomCleanMin+" Minutes.^000000";
mes "Maximum Hunting Limit ^FF0000"+.MaxItemLimit+"^000000";
next;
mes "There will be a ^FF0000Room Cleaning^000000 from time to time...";
mes "All players will be kicked out, it is your bad luck if you meet this.";
mes "Delay will still apply even though you just go in for 1 Seconds..";
next;

break;

case 2:

// #HuntRoomDelay = 0;

if ( #HuntRoomDelay + .DelayMin * 60 > gettimetick(2) ) {
mes "Wait for ^FF0000"+( ( ( #HuntRoomDelay + .DelayMin * 60 ) - gettimetick(2) )/60 )+" Minutes^000000.";
close;

if ( getarraysize( .Hunter ) >= .MaxPlayers ) {
mes "Currently the Room is Full. Please try again later.";
close;

if(countitem(501) >= 1)
    {
	delitem 501,1;
	deltimer strnpcinfo(0) +"::OnKick";
	addtimer 600000, strnpcinfo(0) +"::OnKick"; // 600,000 seconds warp out (10 minutes)
	setd "timeused"+ .@id, gettimetick(2);
	warp .Map$,0,0;
	set .Hunter[getarraysize( .Hunter )], getcharid(3);
	set #HuntRoomDelay, gettimetick(2); // please don't set the deny variable into the future, if admin adjust the setting to decrease the value, player will experience long deny
	set #FarmHunt,0;
	mes "Complete!";
 
    }
else
    {
        mes "You do not have items.";
    }
close;

end;

}

}

}

close;
OnKick:
   if ( strcharinfo(3) == ".Map$"+ .@id )
       warp "SavePoint", 0,0;
   end;

OnNormalKill:
monster .Map$,0,0,"--ja--",.normal_mob[rand(.normal_mob_size)],1,strnpcinfo(0)+"::OnNormalKill";
getitem .farm_normal[rand(.farm_normal_size)], 1;
goto L_kill;

OnBossKill:
monster .Map$,0,0,"--ja--",.boss_mob[rand(.boss_mob_size)],1,strnpcinfo(0)+"::OnBossKill";
getitem .farm_boss[rand(.farm_boss_size)], 1;

L_kill:

#FarmHunt++;

dispbottom "[ Farm Zone ] : Farmed "+ #FarmHunt +" / "+.MaxItemLimit+" Items";

if ( #FarmHunt >= .MaxItemLimit ) {

message strcharinfo(0),"Limit Reach , you may join again later.";

sleep2 2000;

warp "prontera",155,181;

}

end;

OnInit:

// Maximum Player can join per X Minutes.
set .MaxPlayers,5;
// Adding X Minutes of Delay before can go in again.
set .DelayMin,15;
// Maximum Hunt Limit per round inside the Zone.
set .MaxItemLimit,1000;
// Map that will be used in thos Zone.
set .Map$,"moc_fild19";
// Clear Map Every X Minutes.
set .RoomCleanMin,15;
// Mapflag Initialization

setmapflag .Map$, mf_nomobloot;

setmapflag .Map$, mf_nomvploot;

setmapflag .Map$, mf_nowarpto;

setmapflag .Map$, mf_nochat;

setmapflag .Map$, mf_novending;

setmapflag .Map$, mf_nocommand,60;

setmapflag .Map$, mf_nojobexp;

setmapflag .Map$, mf_nobaseexp;



setarray .farm_normal, 501,502,503,504,505; // farm 1 of these items when kill normal mobs

setarray .farm_boss, 506,507,508,509,510; // farm 1 of these items when kill boss monsters



setarray .normal_mob, 2401,2402,2403,2404;

setarray .boss_mob, 1388, 1096, 1120;



.farm_normal_size = getarraysize(.farm_normal);

.farm_boss_size = getarraysize(.farm_boss);

.boss_mob_size = getarraysize(.boss_mob);

.normal_mob_size = getarraysize(.normal_mob);

while ( true ) {

killmonster .Map$, "All";

cleanmap .Map$; // you also forgot about this command

mapwarp .Map$,"prontera",155,181;

for ( .@i = 0; .@i < 80; .@i++ )

monster .Map$,0,0, "[ Farm Zone ] Resident", .normal_mob[ rand( .normal_mob_size ) ], 1, strnpcinfo(0)+"::OnNormalKill";

for ( .@i = 0; .@i < 5; .@i++ )

monster .Map$,0,0, "[ Farm Zone ] Guardian", .boss_mob[ rand( .boss_mob_size ) ], 1, strnpcinfo(0)+"::OnBossKill";

deletearray .Hunter;

announce "[ Farm Zone ] : Farming Zone has been Cleaned up, another 5 Players may go in now.", bc_blue;

sleep ( .RoomCleanMin * 60000 );

mapannounce .Map$,"[ Farm Zone ] : Room Clean Up now...All Users will be warped Out.", bc_map;

killmonster .Map$, "All";

sleep 3000;

}

end;

}

I'm noob too, but I'm trying, lol. 

Edited by srhmike
Link to comment
Share on other sites

  • 0

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

	warp .Map$,0,0;
	set .Hunter[getarraysize( .Hunter )], getcharid(3);
	set #HuntRoomDelay, gettimetick(2); // please don't set the deny variable into the future, if admin adjust the setting to decrease the value, player will experience long deny
	set #FarmHunt,0;
	end;

change to

	if ( countitem( 512 ) >= 10 ) {
		delitem 512,10;
		
		warp .Map$,0,0;
		set .Hunter[getarraysize( .Hunter )], getcharid(3);
		set #HuntRoomDelay, gettimetick(2); // please don't set the deny variable into the future, if admin adjust the setting to decrease the value, player will experience long deny
		set #FarmHunt,0;
		end;
	}
	else {
		mes "You need 10 Apple.";
		close;
	}

 

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...