- Joined
- Dec 30, 2007
- Messages
- 529
- Solutions
- 5
- Reaction score
- 191
Hello,
I found this command very usefull when trying the new scripts for events/quests that needed to dynamically change the aids/uids. I've developed it for my server Gunzodus.net and decided to release it for the community. Hope it helps you.
Usage: /attr [type] [value]
Possible types: aid, uid, description, text, attack, defense, extradefense. The value should be number.
aid - Action ID
uid - Unique ID
talkactions/scripts/thingattribute.lua
talkactions.xml
I found this command very usefull when trying the new scripts for events/quests that needed to dynamically change the aids/uids. I've developed it for my server Gunzodus.net and decided to release it for the community. Hope it helps you.
Usage: /attr [type] [value]
Possible types: aid, uid, description, text, attack, defense, extradefense. The value should be number.
aid - Action ID
uid - Unique ID
talkactions/scripts/thingattribute.lua
Code:
function onSay(cid, words, param)
local player = Player(cid)
if not player:getGroup():getAccess() then
return true
end
if player:getAccountType() < ACCOUNT_TYPE_GOD then
return false
end
local t = param:split(" ", 1)
local attr = t[1]
local value = (t[2])
local position = player:getPosition()
position:getNextPosition(player:getDirection())
local tile = position:getTile()
if not tile then
player:sendCancelMessage("Object not found.")
return false
end
local thing = tile:getTopVisibleThing(player)
if not thing then
player:sendCancelMessage("Thing not found.")
return false
end
if thing:isItem() then
if attr == "aid" then
thing:setAttribute(1, tonumber(value))
elseif attr == "uid" then
thing:setAttribute(2, tonumber(value))
elseif attr == "descr" or attr == "description" then
thing:setAttribute(4, value)
elseif attr == "text" then
thing:setAttribute(8, value)
elseif attr == "attack" then
thing:setAttribute(1024, tonumber(value))
elseif attr == "defense" then
thing:setAttribute(2048, tonumber(value))
elseif attr == "extradefense" then
thing:setAttribute(4096, tonumber(value))
else
player:sendCancelMessage("Bad Attribute.")
return true
end
end
position:sendMagicEffect(CONST_ME_MAGIC_RED)
return false
end
talkactions.xml
Code:
<talkaction words="/attr" separator=" " script="thingattribute.lua" />
Last edited: