User Tools

Site Tools


give_item

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Last revisionBoth sides next revision
give_item [2017/04/12 13:06] justingive_item [2023/04/26 12:19] justin
Line 2: Line 2:
 ---- ----
  
-Gives the specified item to the player. The name of the item should match the name as defined in the Item Editor and is case-sensitive.+Gives one or more of the specified [[item]] to the player. The ID of the [[item]] is case-sensitive and should match the name assigned to it in the [[item_editor|Item Editor]]. The [[item|item(s)]] will be placed into the first open slot(s) of the player's [[inventory]].
  
 +====Signature:====
 <code python> <code python>
-give_item(item_name)+give_item(item_id, count, character)
 </code> </code>
  
 ^Argument^Description^Type^Required^ ^Argument^Description^Type^Required^
-|item_name|Name of the item.|[[String]]|Yes|+|item_id|ID of the [[item]] (as defined in the [[Item Editor]]).|[[String]]|Yes
 +|count|How many of the [[item]] to give to the player (defaults to 1).|[[Number]]|No| 
 +|character|[[Character]] the [[item]] will be given to (defaults to the main [[player character]]).|[[Entity]]|No| 
 + 
 +^Return Value^Description^Type^ 
 +|Number Given|Returns the actual number of [[item|items]] that were given to the player. This could be less than the count supplied to the function, for example if the player's [[inventory]] becomes full.|[[Number]]|
  
 ====Example:==== ====Example:====
-<code python+<code bauxite
-give_item("item_name")+give_item("ITEM_0007", 5);
 </code> </code>
-//Results://+//Results:// Five of ITEM_0007 are placed into the player's [[inventory]]. 
 + 
 +<WRAP center round tip 100%> 
 +Use the **Give Item** function to reward the player for completing a quest or as a way of collecting [[item|items]] from treasure chests and other [[item_container|containers]]. 
 +</WRAP> 
 + 
 +----
  
 <WRAP group> <WRAP group>
Line 25: Line 37:
 <WRAP half column> <WRAP half column>
 ====Visual Demo:==== ====Visual Demo:====
 +{{:wiki:give_item_demo.gif?nolink|}}
 </WRAP> </WRAP>
 </WRAP> </WRAP>
give_item.txt · Last modified: 2023/04/26 12:22 by justin