i need help with this script which i chopped, copied and mixed.
//*********************************************************************************************************************************************************************************
//*********************************************************************************************************************************************************************************
//***-- Script by :
//***-- --
//***
//*********************************************************************************************************************************************************************************
//*********************************************************************************************************************************************************************************
//***-- Messages :
//***-- This is nothing
//***-- but a mere trial
//***
//*********************************************************************************************************************************************************************************
//***
//*********************************************************************************************************************************************************************************
//***
//***
//*********************************************************************************************************************************************************************************
//-------------------------NPC [ Pet Farm ] --------------------------------------------------------------------
prontera,146,169,6 script Pet farmer 124,{
mes "[^119922 Pet farm ^000000]";
mes "What a wonderful day to catch something cute.";
mes "Ain't I right?";
next;
mes "[^119922 Pet farm ^000000]";
mes "Here at Pet farm, you can catch different pets.";
mes "It will only cost you 2 ^CCCC00 PetVouchers^000000";
mes "To enter and catch pets for 10 minutes!";
next;
mes "[^119922 Pet farmer ^000000]";
mes "What are you going to do now?";
switch(select("[Enter Petfarm]:[BuyPetVoucher]:[Net Shop]:Another Time")) {
case 1:
mes "[^119922 Pet farmer ^000000]";
mes "So you want to Enter the park.";
switch(select("Yep:I change my mind.")) {
case 1:
mes "[^119922 Pet farmer ^000000]";
if(countitem(501)<2) {
mes "You don't have enough Vouchers with you.";
mes "Sorry, maybe next time.";
close;
}
if(countitem(501)>=2) {
mes "Hmmm.. Ok you can enter!";
delitem 501,2;
next;}
mes "You will also receive some Nets!";
message strcharinfo(0), "Use these wisely!";
getitem 620,3;
next; {
warp .Map$,127,97;
initnpctimer;
end;
}
case 2:
mes "[^119922 Pet farmer ^000000]";
mes "Okay then.";
mes "Talk to me if you change your mind.";
mes "See yah!";
close;
end;
}
case 2:
mes "[^119922 Pet farmer ^000000]";
switch(select("Continue:Cancel")) {
case 1:
mes "[^119922 Pet farmer ^000000]";
mes "How much Vouchers are you going to buy?";
input .@amount;
.@a = (.@amount*10);
if (.@amount <=0) {
mes "Please input a number greater than 0.";
close;
}
else if (countitem(969) < .@tokens) {
mes "Sorry, you dont have enough balance.";
close;
}
else {
mes "Okay, here you go.";
mes "You get "+.@amount+" Vouchers.";
delitem 969, .@amount;
getitem 501, .@a;
close;
end;}
OnInit:
set .Map$,"petfarm";
set .timeOut,30000;
set $mobID1$,.@mob1[rand (getarraysize(.@mob1)) ];
set $mobID2$,.@mob2[rand (getarraysize(.@mob2)) ];
waitingroom "Pet Farm",0;
end;
for(.@ix = 0; .@ix < 5; .@ix++) {
monster .Map$,0,0,"--en--", $mobID1$, 5, strnpcinfo(0)+"::OnKillMob";
}
for(.@iy = 0; .@iy < 3; .@iy++) {
monster .Map$,0,0,"--en--", $mobID2$, 3, strnpcinfo(0)+"::OnKillMob";
}
monster .Map$,0,0,"--en--", 1031, 3, strnpcinfo(0)+"::OnKillMob";
end;
OnKillMob:
mapannounce .Map$,"There's an idiot who killed a pet!",bc_npc;
end;
//Index: MobID 1, MobID 2, MobID 3,etc...
setarray .@mob1[0], 3356, 3357;
setarray .@mob2[0], 3358, 3359;
OnTimer10000:
if(getnpctimer(0)>=.timeOut)
goto TimesUp;
else
{
message strcharinfo(0), "You have "+((.timeOut-getnpctimer(0))/1000)+" left.";
initnpctimer;
}
end;
TimesUp:
message strcharinfo(0), "Time's Up !! You will be warped out right now..";
mapwarp .Map$,"prontera",155,181;
end;
}
case 3:
mes "[^119922 Pet farmer ^000000]";
doevent "NetShop1::OnShop";
end;
case 4:
mes "[^119922 Pet farmer ^000000]";
mes "If that's what you want then.";
next;
mes "[^119922 Pet farmer ^000000]";
mes "Have a nice day.";
mes "Just come back here if you want to enter!";
close;
end;
}
}
// -- ***************************************** F I R S T S H O P **********************************************
- itemshop custom_seller2 -1,969:20,619:3000
- script NetShop1 -1,{
OnShop:
set @i,0;
mes "[^119922 Pet farmer ^000000]";
mes "I will sell you items for " + getitemname(.CoinID) + ".";
callshop "custom_seller2",1;
npcshopattach "custom_seller2";
end;
OnBuyItem:
for(set .@i,0; .@i<getarraysize(.customs); set .@i,.@i+1) {
for(set .@d,0; .@d<getarraysize(@bought_nameid); set .@d,.@d+1) {
if(@bought_nameid[.@d]==.customs[.@i]) {
if(checkweight(@bought_nameid[.@d],@bought_quantity[.@d])) {
if(countitem(.CoinID) >= .Price[.@i]*@bought_quantity[.@d]) {
delitem .CoinID,.Price[.@i]*@bought_quantity[.@d];
getitem @bought_nameid[.@d],@bought_quantity[.@d];
} else dispbottom "You don't have enough "+getitemname(.CoinID)+" to purchase that item.";
} else dispbottom "Purchasing these items will put you over the weight limit!";
}
}
}
deletearray @bought_quantity, getarraysize(@bought_quantity);
deletearray @bought_nameid, getarraysize(@bought_nameid);
close;
OnInit:
setarray .customs[0],619,620,621,622,623;// Enter the ID of customs here
set .CoinID,969; // Enter the ID of the coin here.
setarray .Price[0],2,5,5,7,7; // Price for each custom is set to 20 coins
npcshopitem "custom_seller2",0,0; // Don't touch any coding beyond here
for(set .i,0; .customs[.i]; set .i,.i+1) npcshopadditem "custom_seller2",.customs[.i],.Price[.i];
end;
}
// -- ***************************************** Exit NPC **********************************************
petfarm,126,104,4 script Exit#01::warp 124,{
mes "You want sure you want to exit?";
mes "You still have "+(getnpctimer(0)/1000)+" seconds you know?";
switch(select("I want to exit:Maybe later")) {
case 1:
mes "Okay then, I'll teleport you out.";
next; {
warp "prontera",155,183;
stopnpctimer;
end;
}
case 2:
mes "That's a good decision!";
close;
end;
}
}
petfarm,130,33,2 duplicate(warp) Exit#02 124
petfarm,73,41,6 duplicate(warp) Exit#03 124
petfarm,66,97,6 duplicate(warp) Exit#04 124
as you can see, i am trying to make a pet farm where everyone can enter anytime with a time limit of 10min.(i haven't set the clock yet to 10min., i think) with different pets..but the problem is, there is NO MONSTER. even the TIME LIMIT doesnt start. when ever i load my client, there are no errors. but whenever i enter the farm.. this error pops out
[Error]: script_rid2sd: fatal error ! player not attached!
[Debug]: Function: strcharinfo (1 parameter):
[Debug]: Data: number value=0
[Debug]: Source (NPC): Pet farmer at prontera (146,169)
and i dont know why, btw. i'm still really noob about scripting. please help me please. i tried reading other articles here in rathena and at hercules..i can't still seem to find the reason of this error.
Question
dqseishi
i need help with this script which i chopped, copied and mixed.
as you can see, i am trying to make a pet farm where everyone can enter anytime with a time limit of 10min.(i haven't set the clock yet to 10min., i think)
with different pets..but the problem is, there is NO MONSTER. even the TIME LIMIT doesnt start.
when ever i load my client, there are no errors. but whenever i enter the farm.. this error pops out
and i dont know why, btw. i'm still really noob about scripting.
Edited by dqseishiplease help me please.
i tried reading other articles here in rathena and at hercules..i can't still seem to find the reason of this error.
thanx in advance
Link to comment
Share on other sites
0 answers 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.