Jump to content
  • 0

NPC for newbie


patr3k

Question


  • Group:  Members
  • Topic Count:  104
  • Topics Per Day:  0.02
  • Content Count:  257
  • Reputation:   7
  • Joined:  03/12/12
  • Last Seen:  

How can i add this items in this script by Joseph

1pc valkyrie Armor +7 Item ID# 2357

1pc Valkyrie Manteau +7 Item ID# 2524

1pc Valkyrie Shoes +7 Item ID# 2421

1pc Valkyrie Shield +7 Item ID# 2115

3pcs - Bubble Gum 5 Box Item ID# 13607

3pcs - Battle Manual 5 Box Item ID# 14208

10pcs - Bloody Branch Item ID# 12103

10pcs - Mithril Coin Item ID# 674

4pcs - Abysmal Knight Card Item ID# 4140

http://rathena.org/b...ies/#entry91434

amatsu,116,146,3 script Seyra 90,{

set .@n$, "[seyra]";
setarray .@rwd[0],2115,1,2357,1,2421,1,2524,1; // Rewards: <item id>,<item amount>

query_sql ("SELECT `last_ip` FROM `login` WHERE `account_id`=" + getcharid(3) + "", .@lip$);

if ( getd("$" + .@lip$ + "_NG") > 0 || #NewbieGift > 0)
{
mes .@n$;
mes "I'm sorry, the rewards are exclusively for new players.";
close;
}

mes .@n$;
mes "Welcome! Here are some free gifts";
mes "for newcomers:";

for ( set .@i, 0; .@i < getarraysize(.@rwd); set .@i, .@i + 2 )
mes .@rwd[.@i+1] + " x " + getitemname(.@rwd[.@i]);

close2;
set #NewbieGift, 1;
setd "$" + .@lip$ + "_NG", getd("$" + .@lip$ + "_NG") + 1;

for ( set .@i, 0; .@i < getarraysize(.@rwd); set .@i, .@i + 2 )
getitem .@rwd[.@i], .@rwd[.@i+1];

end;

OnInit:

waitingroom "Newbie Gift!",0;
end;

}

Link to comment
Share on other sites

9 answers to this question

Recommended Posts


  • Group:  Members
  • Topic Count:  72
  • Topics Per Day:  0.02
  • Content Count:  2997
  • Reputation:   1130
  • Joined:  05/27/12
  • Last Seen:  

At least try reading the code first...

// Rewards: <item id>,<item amount>

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  104
  • Topics Per Day:  0.02
  • Content Count:  257
  • Reputation:   7
  • Joined:  03/12/12
  • Last Seen:  

yeah i know.. but how can i put the item +7 valk armor etc...?

Edited by patr3k
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  72
  • Topics Per Day:  0.02
  • Content Count:  2997
  • Reputation:   1130
  • Joined:  05/27/12
  • Last Seen:  

Use "getitem2" (it works the same way as @item2), add the lines under the "getitem" and don't include the items in the array.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  104
  • Topics Per Day:  0.02
  • Content Count:  257
  • Reputation:   7
  • Joined:  03/12/12
  • Last Seen:  

Can you give me an example? :) sorry still new to this..

And thanks Euphy in advance /no1

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  9
  • Topics Per Day:  0.00
  • Content Count:  56
  • Reputation:   30
  • Joined:  02/22/12
  • Last Seen:  

I normally don't do this... but here.... This is a modified version of the script to support refined items.

What I've done is added a third value to the Reward Array for a refined amount. You set it to 0 if there is no refine option for that item.

getitem2 works similarly to getitem, the difference is that it supports more parameters. Giving you the ability to set the refine amount, identify, and cards in an items. The item must support these options though.

What this script is doing is... you specify the rewards in the Reward Array. The query_sql grabs the user's ip address and uses it for checking if they got the items on another account they own. If so, it throws them an error message that only new players are allowed to get the rewards. If not, then the script continues...

The npc will then loop through all the items in the array and spit out a list. The modification I've done checks if the item it's currently looping on doesn't have a 0 for the refined option. If not then it will display a +<refined value> in the list. If it is a 0 then it doesn't include the refined part in the list...

After showing the player the list, there is a close2 button. Which works like a close button, but allows you to perform an action / script after the button is clicked. What it's doing is similar to the previous loop. Only this time it's actually giving the player the item. With the modification it checks for the refined option.

After this it's finished with an end; to make sure the script ends and allows the player to move in-game once finished talking to the npc.

Hope this helps. Please be sure to read the scripting guides on the Wiki and be sure to read the Script_Commands documentation for more in-depth explanations of certain script functions.

amatsu,116,146,3 script Seyra 90,{

 // Reward Array <Item Id>, <Qty>, <Refine>
 // Set refine option to 0 if non-refinable.
 setarray .@rwd[0],13607,3,0,14208,3,0,12103,10,0,674,10,0,4140,4,0,2357,1,7,2524,1,7,2421,1,7,2115,1,7;

 query_sql ("SELECT `last_ip` FROM `login` WHERE `account_id`=" + getcharid(3) + "", .@lip$);

 if ( getd("$" + .@lip$ + "_NG") > 0 || #NewbieGift > 0)
 {
mes "[seyra]";
mes "I'm sorry, the rewards are exclusively for new players.";
close;
 }

 mes "[seyra]";
 mes "Welcome! Here are some free gifts";
 mes "for newcomers:";

 // List all the items.
 for ( set .@i, 0; .@i < getarraysize(.@rwd); set .@i, .@i + 3 )
// Check if refined option is not 0.
if(.@rwd[.@i+2] != 0) {
   mes .@rwd[.@i+1] + " x +" + .@rwd[.@i+2] + " " + getitemname(.@rwd[.@i]);
}else{
   mes .@rwd[.@i+1] + " x " + getitemname(.@rwd[.@i]);
 }

 close2;

 // Get Items
 for ( set .@i, 0; .@i < getarraysize(.@rwd); set .@i, .@i + 3 )
// Check if refined option is not 0.
if(.@rwd[.@i+2] != 0) {
  	  // getitem2 <id>, <qty>, <identify>, <refine>, <attribute>, <card1>, <card2>, <card3>, <card4>
  	  getitem2 .@rwd[.@i], .@rwd[.@i+1], 1, .@rwd[.@i+2], 0, 0, 0, 0, 0;
}else{
   getitem .@rwd[.@i], .@rwd[.@i+1];
}

 // Set variable to make sure player can't get items again.
 set #NewbieGift, 1;
 setd "$" + .@lip$ + "_NG", getd("$" + .@lip$ + "_NG") + 1;

 end;

 OnInit:
waitingroom "Newbie Gift!",0;
end;
}

  • Upvote 1
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  72
  • Topics Per Day:  0.02
  • Content Count:  2997
  • Reputation:   1130
  • Joined:  05/27/12
  • Last Seen:  

Woah Kisuka, definitely overkill, lol... xD (If you've got extra time on your hands, help me with my scripts instead~)

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  9
  • Topics Per Day:  0.00
  • Content Count:  56
  • Reputation:   30
  • Joined:  02/22/12
  • Last Seen:  

Woah Kisuka, definitely overkill, lol... xD (If you've got extra time on your hands, help me with my scripts instead~)

XD No extra time, wrote this after I woke up. Kinda of a brain exercise to wake myself up :P

I'll probably help with some AEGIS script conversion once I get my server back up and running.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  104
  • Topics Per Day:  0.02
  • Content Count:  257
  • Reputation:   7
  • Joined:  03/12/12
  • Last Seen:  

Thank you so much Kisuka! /lv/no1

also thanks to Euphy! /no1

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  6
  • Topics Per Day:  0.00
  • Content Count:  25
  • Reputation:   4
  • Joined:  11/06/12
  • Last Seen:  

what if they want 1 per account in a single ip? how to change it?

 

Thank You

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