Difference between revisions of "LUA:AddLootItem"

(Created page with "= LUA Functions: AddLootItem() = Adds an item to the given spawns loot table. ==== Syntax ==== AddLootItem(param1, param2, [param3]) ==== Parameters ==== ; Required - ''param1...")
 
 
Line 1: Line 1:
= LUA Functions: AddLootItem() =
+
{{LUAFunction
Adds an item to the given spawns loot table.
+
|Name = AddLootItem
 
+
|Description = Adds an item to the given spawns loot table.
==== Syntax ====
+
|Param1 = Spawn
AddLootItem(param1, param2, [param3])
+
|Param1Desc = is the spawn to add the item to
 
+
|Param2 = int32
 
+
|Param2Desc = is the item id
==== Parameters ====
+
|OptionalParam1 = int16
; Required - ''param1'' (Spawn), ''param2'' (int32)
+
|OptionalParam1Desc = is the amount of the specified item to give, will default to 1 if left out
: ''param1'' is the spawn to add the item to
+
|Example =
: ''param2'' is the item id
 
; Optional - ''param3'' (int16)
 
: ''param3'' is the amount of the specified item to give
 
 
 
 
 
==== Usage ====
 
 
<pre>
 
<pre>
 
function cast(Caster, Target)
 
function cast(Caster, Target)
Line 21: Line 15:
 
end
 
end
 
</pre>
 
</pre>
 
+
|ExampleDesc = This would add a stack of 5 items with the id of 100 to the Target's loot table.
This would add a stack of 5 items with the id of 100 to the Target's loot table.
+
|Notes = None
 
+
}}
 
 
== Notes ==
 
If ''param3'' is left out it will default to 1.
 

Latest revision as of 12:01, 30 January 2021


LUA:AllFunctions - AddLootItem

Return to: LUA:AllFunctions | Tutorials | Portal | Forum | Project Manager | Bug Tracker


Adds an item to the given spawns loot table.

Syntax

AddLootItem(param1, param2, [opt param1])

Parameters

Required - param1 (Spawn), param2 (int32)
param1 is the spawn to add the item to
param2 is the item id
Optional - opt param1 (int16)
opt param1 is the amount of the specified item to give, will default to 1 if left out

Example

function cast(Caster, Target)
    -- Add a stack of 5 items with the id of 100
    AddLootItem(Target, 100, 5)
end

This would add a stack of 5 items with the id of 100 to the Target's loot table.

Notes

None