User Tools

Site Tools


lua:scripting:examples:turninobjects

Differences

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

Link to this comparison view

lua:scripting:examples:turninobjects [2014/12/24 05:44] – created vodurlua:scripting:examples:turninobjects [2026/10/16 20:02] (current) – removed - external edit (Unknown date) 127.0.0.1
Line 1: Line 1:
-<code lua> +
--- Initializes the tracker variable with empty names if it doesn't exist +
-tracker = tracker or { +
-    [18405] = "", +
-    [18406] = "", +
-    [18407] = "", +
-    [18408] = "", +
-    [18409] = "", +
-    [18410] = "", +
-    [18411] = "", +
-    [18412] = "", +
-    [18413] = "", +
-    [18425] = "", +
-    [18430] = "", +
-} +
-  +
-if tracker[obj1.vnum] == nil then -- We don't want this thing +
-    say("I don't want that!") +
-    mdo("drop %s", obj1.name) +
-    return +
-end +
-  +
-if tracker[obj1.vnum] == ch.name then -- Player was the last one to give it +
-    say("You were the last one to give me that already!") +
-    mdo("give '%s' %s", obj1.name, ch.name) +
-    mdo("drop %s", obj1.name) +
-    return +
-end +
-  +
--- If we got here then we need to reward and track the player +
-say("Thanks %s! Just what I was looking for!", ch.name) +
-obj1:destroy() +
-reward(ch, "qp", 5) +
-tracker[obj1.vnum]=ch.name +
-</code>+