Jump to content
  • 0

Freebies NPC


Ukiram

Question


  • Group:  Members
  • Topic Count:  45
  • Topics Per Day:  0.02
  • Content Count:  291
  • Reputation:   26
  • Joined:  12/16/17
  • Last Seen:  

Hi, anyone can help me with the script? It's a Freebies NPC and Account Bounded, but can't get the item.

PER ACCOUNT

AND IF YOU GET IT, ACCOUNT BOUNDED

Here's the script

force_3-1,169,180,4	script	Freebies NPC	123,{
    query_sql ("SELECT `last_ip` FROM `login` WHERE `account_id`= '" + getcharid(3) + "'", .@lip$);
    mes "[Hello]";
    mes "[I can give you a free gift based on your future job.]";
    mes "[Please choose the correct item for the future job]";
    next;
    if(!#Freeitems && ( getd("$" + .@lip$ + "_ASD") == 0 )) {
        mes "Select one:";
        next;
        switch(select("Swordsman:Magician:Archer:Acolyte:Merchant:Thief")) {
            case 1:
                getitem2 3670,1,1,0,0,0,0,0,0;
                getitem2 3671,1,1,0,0,0,0,0,0;
                getitem2 3672,1,1,0,0,0,0,0,0;
                getitem2 3673,1,1,0,0,0,0,0,0;
                getitem2 12263,5,1,0,0,0,0,0,0;
		getitem2 1108,1,7,0,0,0,0,0,0;
                break;

            case 2:
                getitem2 3670,1,1,0,0,0,0,0,0;
                getitem2 3671,1,1,0,0,0,0,0,0;
                getitem2 3672,1,1,0,0,0,0,0,0;
                getitem2 3673,1,1,0,0,0,0,0,0;
                getitem2 12263,5,1,0,0,0,0,0,0;
		getitem2 1602,1,7,0,0,0,0,0,0;
                break;

            case 3:
                getitem2 3670,1,1,0,0,0,0,0,0;
                getitem2 3671,1,1,0,0,0,0,0,0;
                getitem2 3672,1,1,0,0,0,0,0,0;
                getitem2 3673,1,1,0,0,0,0,0,0;
                getitem2 12263,5,1,0,0,0,0,0,0;
		getitem2 1702,1,7,0,0,0,0,0,0;
                break;
                
            case 4:
                getitem2 3670,1,1,0,0,0,0,0,0;
                getitem2 3671,1,1,0,0,0,0,0,0;
                getitem2 3672,1,1,0,0,0,0,0,0;
                getitem2 3673,1,1,0,0,0,0,0,0;
                getitem2 12263,5,1,0,0,0,0,0,0;
		getitem2 1550,1,7,0,0,0,0,0,0;
		getitem2 1505,1,7,0,0,0,0,0,0;
                break;
            
            case 5:
                getitem2 3670,1,1,0,0,0,0,0,0;
                getitem2 3671,1,1,0,0,0,0,0,0;
                getitem2 3672,1,1,0,0,0,0,0,0;
                getitem2 3673,1,1,0,0,0,0,0,0;
                getitem2 12263,5,1,0,0,0,0,0,0;
		getitem2 1302,1,7,0,0,0,0,0,0;
                break;
            
            case 6:
                getitem2 3670,1,1,0,0,0,0,0,0;
                getitem2 3671,1,1,0,0,0,0,0,0;
                getitem2 3672,1,1,0,0,0,0,0,0;
                getitem2 3673,1,1,0,0,0,0,0,0;
                getitem2 12263,5,1,0,0,0,0,0,0;
		getitem2 1209,1,7,0,0,0,0,0,0;
                break;
                
            }
            set #Freebie, 1;
            setd "$" + .@lip$ + "_ASD", getd("$" + .@lip$ + "_ASD") + 1;
            close;
    }
    OnInit:
    waitingroom "Get your freebies here!",0;
    end;
}

 

Link to comment
Share on other sites

3 answers to this question

Recommended Posts

  • 0

  • Group:  Members
  • Topic Count:  162
  • Topics Per Day:  0.04
  • Content Count:  745
  • Reputation:   47
  • Joined:  03/12/14
  • Last Seen:  

2 hours ago, Ryo Osaki said:

Hi, anyone can help me with the script? It's a Freebies NPC and Account Bounded, but can't get the item.

PER ACCOUNT

AND IF YOU GET IT, ACCOUNT BOUNDED

Here's the script


force_3-1,169,180,4	script	Freebies NPC	123,{
    query_sql ("SELECT `last_ip` FROM `login` WHERE `account_id`= '" + getcharid(3) + "'", .@lip$);
    mes "[Hello]";
    mes "[I can give you a free gift based on your future job.]";
    mes "[Please choose the correct item for the future job]";
    next;
    if(!#Freeitems && ( getd("$" + .@lip$ + "_ASD") == 0 )) {
        mes "Select one:";
        next;
        switch(select("Swordsman:Magician:Archer:Acolyte:Merchant:Thief")) {
            case 1:
                getitem2 3670,1,1,0,0,0,0,0,0;
                getitem2 3671,1,1,0,0,0,0,0,0;
                getitem2 3672,1,1,0,0,0,0,0,0;
                getitem2 3673,1,1,0,0,0,0,0,0;
                getitem2 12263,5,1,0,0,0,0,0,0;
		getitem2 1108,1,7,0,0,0,0,0,0;
                break;

            case 2:
                getitem2 3670,1,1,0,0,0,0,0,0;
                getitem2 3671,1,1,0,0,0,0,0,0;
                getitem2 3672,1,1,0,0,0,0,0,0;
                getitem2 3673,1,1,0,0,0,0,0,0;
                getitem2 12263,5,1,0,0,0,0,0,0;
		getitem2 1602,1,7,0,0,0,0,0,0;
                break;

            case 3:
                getitem2 3670,1,1,0,0,0,0,0,0;
                getitem2 3671,1,1,0,0,0,0,0,0;
                getitem2 3672,1,1,0,0,0,0,0,0;
                getitem2 3673,1,1,0,0,0,0,0,0;
                getitem2 12263,5,1,0,0,0,0,0,0;
		getitem2 1702,1,7,0,0,0,0,0,0;
                break;
                
            case 4:
                getitem2 3670,1,1,0,0,0,0,0,0;
                getitem2 3671,1,1,0,0,0,0,0,0;
                getitem2 3672,1,1,0,0,0,0,0,0;
                getitem2 3673,1,1,0,0,0,0,0,0;
                getitem2 12263,5,1,0,0,0,0,0,0;
		getitem2 1550,1,7,0,0,0,0,0,0;
		getitem2 1505,1,7,0,0,0,0,0,0;
                break;
            
            case 5:
                getitem2 3670,1,1,0,0,0,0,0,0;
                getitem2 3671,1,1,0,0,0,0,0,0;
                getitem2 3672,1,1,0,0,0,0,0,0;
                getitem2 3673,1,1,0,0,0,0,0,0;
                getitem2 12263,5,1,0,0,0,0,0,0;
		getitem2 1302,1,7,0,0,0,0,0,0;
                break;
            
            case 6:
                getitem2 3670,1,1,0,0,0,0,0,0;
                getitem2 3671,1,1,0,0,0,0,0,0;
                getitem2 3672,1,1,0,0,0,0,0,0;
                getitem2 3673,1,1,0,0,0,0,0,0;
                getitem2 12263,5,1,0,0,0,0,0,0;
		getitem2 1209,1,7,0,0,0,0,0,0;
                break;
                
            }
            set #Freebie, 1;
            setd "$" + .@lip$ + "_ASD", getd("$" + .@lip$ + "_ASD") + 1;
            close;
    }
    OnInit:
    waitingroom "Get your freebies here!",0;
    end;
}

 

 

Screenshot_20191201-230842_Chrome.jpg

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  105
  • Topics Per Day:  0.02
  • Content Count:  446
  • Reputation:   229
  • Joined:  03/20/12
  • Last Seen:  

 

2 hours ago, Ryo Osaki said:

PER ACCOUNT

Can't you read the script you made posted? You are offering service (in your signature) yet you still dont know how to work with variables?

Variables
---------

The meat of every programming language is variables - places where you store
data.

In the rAthena scripting language, variable names are not case sensitive.

Variables are divided into and uniquely identified by the combination of:
prefix  - determines the scope and extent (or lifetime) of the variable
name    - an identifier consisting of '_' and alphanumeric characters
postfix - determines the type of the variable: integer or string

Scope can be:
global    - global to all servers
local     - local to the server
account   - attached to the account of the character identified by RID
character - attached to the character identified by RID
npc       - attached to the NPC
scope     - attached to the scope of the instance

Extent can be:
permanent - They still exist when the server resets.
temporary - They cease to exist when the server resets.

Prefix: scope and extent
nothing  - A permanent variable attached to the character, the default variable
           type. They are stored by char-server in the `char_reg_num` and
           `char_reg_str`.
"@"      - A temporary variable attached to the character.
           SVN versions before 2094 revision and RC5 version will also treat
           'l' as a temporary variable prefix, so beware of having variable
           names starting with 'l' if you want full backward compatibility.
"$"      - A global permanent variable.
           They are stored by map-server in database table `mapreg`.
"$@"     - A global temporary variable.
           This is important for scripts which are called with no RID
           attached, that is, not triggered by a specific character object.
"."      - A NPC variable.
           They exist in the NPC and disappear when the server restarts or the
           NPC is reloaded. Can be accessed from inside the NPC or by calling
           'getvariableofnpc'. Function objects can also have .variables which
           are accessible from inside the function, however 'getvariableofnpc'
           does NOT work on function objects.
".@"     - A scope variable.
           They are unique to the instance and scope. Each instance has its
           own scope that ends when the script ends. Calling a function with
           callsub/callfunc starts a new scope, returning from the function
           ends it. When a scope ends, its variables are converted to values
           ('return .@var;' returns a value, not a reference).
"'"      - An instance variable.
           These are used with the instancing system and are unique to each
           instance type. Can be accessed from inside the instance or by calling
           'getvariableofinstance'.
"#"      - A permanent local account variable.
           They are stored by char-server in the `acc_reg_num` table and
           `acc_reg_str`.
"##"     - A permanent global account variable stored by the login server.
           They are stored in the `global_acc_reg_num` table and
		   `global_acc_reg_str`.
           The only difference you will note from normal # variables is when
           you have multiple char-servers connected to the same login server.
           The # variables are unique to each char-server, while the ## variables
           are shared by all these char-servers.

Postfix: integer or string
nothing - integer variable, can store positive and negative numbers, but only
          whole numbers (so don't expect to do any fractional math)
'$'     - string variable, can store text

Examples:
  name  - permanent character integer variable
  name$ - permanent character string variable
 @name  - temporary character integer variable
 @name$ - temporary character string variable
 $name  - permanent global integer variable
 $name$ - permanent global string variable
$@name  - temporary global integer variable
$@name$ - temporary global string variable
 .name  - NPC integer variable
 .name$ - NPC string variable
.@name  - scope integer variable
.@name$ - scope string variable
 'name  - instance integer variable
 'name$ - instance string variable
 #name  - permanent local account integer variable
 #name$ - permanent local account string variable
##name  - permanent global account integer variable
##name$ - permanent global account string variable

If a variable was never set, it is considered to equal zero for integer
variables or an empty string ("", nothing between the quotes) for string
variables. Once you set it to that, the variable is as good as forgotten
forever, and no trace remains of it even if it was stored with character or
account data.

 

 

2 hours ago, Ryo Osaki said:

AND IF YOU GET IT, ACCOUNT BOUNDED

*getitembound <item id>,<amount>,<bound type>{,<account ID>};
*getitembound "<item name>",<amount>,<bound type>{,<account ID>};

This command behaves identically to 'getitem', but the items created will be
bound to the target character as specified by the bound type. All items created
in this manner cannot be dropped, sold, vended, auctioned, or mailed, and in
some cases cannot be traded or stored.

Valid bound types are:
 Bound_Account : Account Bound item
 Bound_Guild   : Guild Bound item
 Bound_Party   : Party Bound item
 Bound_Char    : Character Bound item

---------------------------------------

*getitembound2 <item id>,<amount>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>,<bound type>{,<account ID>};
*getitembound2 "<item name>",<amount>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>,<bound type>{,<account ID>};
*getitembound3 <item id>,<amount>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>,<bound type>,<RandomIDArray>,<RandomValueArray>,<RandomParamArray>{,<account ID>};
*getitembound3 "<item name>",<amount>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>,<bound type>,<RandomIDArray>,<RandomValueArray>,<RandomParamArray>{,<account ID>};

This command behaves identically to 'getitem2', but the items created will be
bound to the target character as specified by the bound type. All items created
in this manner cannot be dropped, sold, vended, auctioned, or mailed, and in
some cases cannot be traded or stored.

For a list of bound types see 'getitembound'.

'getitembound3' is advance version of 'getitembound2' that also use Item Random Option as additional values.
<RandomIDArray>    : Array variable of ID for item random option, see db/[pre-]re/item_randomopt_db.txt
<RandomValueArray> : Array variable of item random option's value.
<RandomParamArray> : Array variable of item random option's param.

Example to get Crimson Weapon with Ghost property:
	// +9 Crimson Dagger [2]
	setarray .@OptID[0],RDMOPT_WEAPON_ATTR_TELEKINESIS;
	setarray .@OptVal[0],0;
	setarray .@OptParam[0],0;
	getitembound3 28705,1,1,9,0,0,0,0,0,BOUND_CHAR,.@OptID,.@OptVal,.@OptParam;

 

Or download this in-case you didnt see this in your server files :

script_commands.txt

Spoiler

//===== rAthena Documentation================================
//= rAthena Script Commands
//===== By:==================================================
//= rAthena Dev Team
//===== Last Updated:========================================
//= 20180831
//===== Description:=========================================
//= A reference manual for the rAthena scripting language.
//= Commands are sorted depending on their functionality.
//===========================================================

This document is a reference manual for all the scripting commands and functions
available in rAthena. It is not a simple tutorial. When people tell you to
"Read The F***ing Manual", they mean this.

This is not a place to teach you basic programming. This document will not teach
you basic programming by itself. It's more of a reference for those who have at
least a vague idea of what they want to do and want to know what tools they have
available to do it. We've tried to keep it as simple as possible, but if you
don't understand it, getting a clear book on programming in general will help
better than yelling around the forum for help.

A little learning never caused anyone's head to explode.

 

 

Edited by Mabuhay
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  45
  • Topics Per Day:  0.02
  • Content Count:  291
  • Reputation:   26
  • Joined:  12/16/17
  • Last Seen:  

10 minutes ago, Mabuhay said:

 

Can't you read the script you made posted? You are offering service (in your signature) yet you still dont know how to work with variables?


Variables
---------

The meat of every programming language is variables - places where you store
data.

In the rAthena scripting language, variable names are not case sensitive.

Variables are divided into and uniquely identified by the combination of:
prefix  - determines the scope and extent (or lifetime) of the variable
name    - an identifier consisting of '_' and alphanumeric characters
postfix - determines the type of the variable: integer or string

Scope can be:
global    - global to all servers
local     - local to the server
account   - attached to the account of the character identified by RID
character - attached to the character identified by RID
npc       - attached to the NPC
scope     - attached to the scope of the instance

Extent can be:
permanent - They still exist when the server resets.
temporary - They cease to exist when the server resets.

Prefix: scope and extent
nothing  - A permanent variable attached to the character, the default variable
           type. They are stored by char-server in the `char_reg_num` and
           `char_reg_str`.
"@"      - A temporary variable attached to the character.
           SVN versions before 2094 revision and RC5 version will also treat
           'l' as a temporary variable prefix, so beware of having variable
           names starting with 'l' if you want full backward compatibility.
"$"      - A global permanent variable.
           They are stored by map-server in database table `mapreg`.
"$@"     - A global temporary variable.
           This is important for scripts which are called with no RID
           attached, that is, not triggered by a specific character object.
"."      - A NPC variable.
           They exist in the NPC and disappear when the server restarts or the
           NPC is reloaded. Can be accessed from inside the NPC or by calling
           'getvariableofnpc'. Function objects can also have .variables which
           are accessible from inside the function, however 'getvariableofnpc'
           does NOT work on function objects.
".@"     - A scope variable.
           They are unique to the instance and scope. Each instance has its
           own scope that ends when the script ends. Calling a function with
           callsub/callfunc starts a new scope, returning from the function
           ends it. When a scope ends, its variables are converted to values
           ('return .@var;' returns a value, not a reference).
"'"      - An instance variable.
           These are used with the instancing system and are unique to each
           instance type. Can be accessed from inside the instance or by calling
           'getvariableofinstance'.
"#"      - A permanent local account variable.
           They are stored by char-server in the `acc_reg_num` table and
           `acc_reg_str`.
"##"     - A permanent global account variable stored by the login server.
           They are stored in the `global_acc_reg_num` table and
		   `global_acc_reg_str`.
           The only difference you will note from normal # variables is when
           you have multiple char-servers connected to the same login server.
           The # variables are unique to each char-server, while the ## variables
           are shared by all these char-servers.

Postfix: integer or string
nothing - integer variable, can store positive and negative numbers, but only
          whole numbers (so don't expect to do any fractional math)
'$'     - string variable, can store text

Examples:
  name  - permanent character integer variable
  name$ - permanent character string variable
 @name  - temporary character integer variable
 @name$ - temporary character string variable
 $name  - permanent global integer variable
 $name$ - permanent global string variable
$@name  - temporary global integer variable
$@name$ - temporary global string variable
 .name  - NPC integer variable
 .name$ - NPC string variable
.@name  - scope integer variable
.@name$ - scope string variable
 'name  - instance integer variable
 'name$ - instance string variable
 #name  - permanent local account integer variable
 #name$ - permanent local account string variable
##name  - permanent global account integer variable
##name$ - permanent global account string variable

If a variable was never set, it is considered to equal zero for integer
variables or an empty string ("", nothing between the quotes) for string
variables. Once you set it to that, the variable is as good as forgotten
forever, and no trace remains of it even if it was stored with character or
account data.

 

 


*getitembound <item id>,<amount>,<bound type>{,<account ID>};
*getitembound "<item name>",<amount>,<bound type>{,<account ID>};

This command behaves identically to 'getitem', but the items created will be
bound to the target character as specified by the bound type. All items created
in this manner cannot be dropped, sold, vended, auctioned, or mailed, and in
some cases cannot be traded or stored.

Valid bound types are:
 Bound_Account : Account Bound item
 Bound_Guild   : Guild Bound item
 Bound_Party   : Party Bound item
 Bound_Char    : Character Bound item

---------------------------------------

*getitembound2 <item id>,<amount>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>,<bound type>{,<account ID>};
*getitembound2 "<item name>",<amount>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>,<bound type>{,<account ID>};
*getitembound3 <item id>,<amount>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>,<bound type>,<RandomIDArray>,<RandomValueArray>,<RandomParamArray>{,<account ID>};
*getitembound3 "<item name>",<amount>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>,<bound type>,<RandomIDArray>,<RandomValueArray>,<RandomParamArray>{,<account ID>};

This command behaves identically to 'getitem2', but the items created will be
bound to the target character as specified by the bound type. All items created
in this manner cannot be dropped, sold, vended, auctioned, or mailed, and in
some cases cannot be traded or stored.

For a list of bound types see 'getitembound'.

'getitembound3' is advance version of 'getitembound2' that also use Item Random Option as additional values.
<RandomIDArray>    : Array variable of ID for item random option, see db/[pre-]re/item_randomopt_db.txt
<RandomValueArray> : Array variable of item random option's value.
<RandomParamArray> : Array variable of item random option's param.

Example to get Crimson Weapon with Ghost property:
	// +9 Crimson Dagger [2]
	setarray .@OptID[0],RDMOPT_WEAPON_ATTR_TELEKINESIS;
	setarray .@OptVal[0],0;
	setarray .@OptParam[0],0;
	getitembound3 28705,1,1,9,0,0,0,0,0,BOUND_CHAR,.@OptID,.@OptVal,.@OptParam;

 

Or download this in-case you didnt see this in your server files :

script_commands.txt 372.16 kB · 0 downloads

  Reveal hidden contents


//===== rAthena Documentation================================
//= rAthena Script Commands
//===== By:==================================================
//= rAthena Dev Team
//===== Last Updated:========================================
//= 20180831
//===== Description:=========================================
//= A reference manual for the rAthena scripting language.
//= Commands are sorted depending on their functionality.
//===========================================================

This document is a reference manual for all the scripting commands and functions
available in rAthena. It is not a simple tutorial. When people tell you to
"Read The F***ing Manual", they mean this.

This is not a place to teach you basic programming. This document will not teach
you basic programming by itself. It's more of a reference for those who have at
least a vague idea of what they want to do and want to know what tools they have
available to do it. We've tried to keep it as simple as possible, but if you
don't understand it, getting a clear book on programming in general will help
better than yelling around the forum for help.

A little learning never caused anyone's head to explode.

 

 

I already fixed sorry. ? 

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