• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

CreatureEvent [TFS 1.1] Random Item Stats

@7804364
Update to the latest TFS 1.1 and it will function correctly.

@zbizu
Thanks for you help again. I updated to the latest TFS 1.1 and worked 100%, right away! Good job!
 
well i have 10.41 fresh install, tfs 1.1 no errors but when i kill something i get this error

Code:
Lua Script Error: [CreatureScript Interface]
data/creaturescripts/scripts/randomstats.lua:onKill
luaAddEvent(). Argument #3 is unsafe
stack traceback:
        [C]: in function 'addEvent'
        data/creaturescripts/scripts/randomstats.lua:257: in function <data/creaturescripts/scripts/randomstats.lua:255>

Litterly just compiled tfs 1.1 added nothing and i get this error...
 
well i have 10.41 fresh install, tfs 1.1 no errors but when i kill something i get this error

Code:
Lua Script Error: [CreatureScript Interface]
data/creaturescripts/scripts/randomstats.lua:onKill
luaAddEvent(). Argument #3 is unsafe
stack traceback:
        [C]: in function 'addEvent'
        data/creaturescripts/scripts/randomstats.lua:257: in function <data/creaturescripts/scripts/randomstats.lua:255>

Litterly just compiled tfs 1.1 added nothing and i get this error...
Passing userdata objects to addEvent is unsafe and might crash the server.

Change
Code:
addEvent(find_loot_Container, 2, player, target:getPosition())
to
Code:
addEvent(find_loot_Container, 2, player.uid, target:getPosition())

Change
Code:
function find_loot_Container(player, pos)
to
Code:
function find_loot_Container(cid, pos)
    local player = Player(cid)
    if not player then
        return
    end
 
Last edited:
Passing userdata objects to addEvent is unsafe and might crash the server.

Change
Code:
addEvent(find_loot_Container, 2, player, target:getPosition())
to
Code:
addEvent(find_loot_Container, 2, player.uid, target:getPosition())

Change
Code:
function find_loot_Container(player, pos)
to
Code:
function find_loot_Container(cid, pos)
    local player = Player(cid)
    if not player then
        return
    end
ok i did this, and i set the chance to 100% and i get no upgraded items, and no errors in console
 
Actually disregard that, it works now, only issue i see here is it NEVER upgrades weapons, only shields/necklaces
 
Actually disregard that, it works now, only issue i see here is it NEVER upgrades weapons, only shields/necklaces
I can confirm that. It happened also to me that only shields and necklaces were with custom stats.
 
first post updated
should work now

edit: updated again
fixed "argument is unsafe"

now find_loot_Container(pos) doesn't need a player parameter anymore
 
Last edited:
first post updated
should work now

edit: updated again
fixed "argument is unsafe"

now find_loot_Container(pos) doesn't need a player parameter anymore
Attack attribute now works, but still duration is not working for rings etc.

PS. is there any way to add speed boost to bohs for example? like ITEM_ATTRIBUTE_SPEED - does it exist anyways?
 
@Moj mistrz
It doesn't, unless you do source edits.


edit:
first post updated again

fixes:
- extradefense and other weapon attributes won't be assigned if base stat is 0
- stats for amulets and rings are assigned correctly now
 
Last edited:
@Moj mistrz
It doesn't, unless you do source edits.


edit:
first post updated again

fixes:
- extradefense and other weapon attributes won't be assigned if base stat is 0
- stats for amulets and rings are assigned correctly now
Works great now with amulets and rings, it still adds extradefense to weapons which dont have this, but I've changed it by myself doing
this
Code:
if it_id:getExtraDefense()  then
to this
Code:
if it_id:getExtraDefense() > 0 or it_id:getExtraDefense() < 0


Still have two questions.
1. Is it possible to add some armor to items which dont have armor?(ex. bohs).
2. Is it possible to change accuracy/extradef when it's on minus like in the devileye or demonbone?
Original
Code:
19:46 You see the devileye (Range:6, Atk+20, Hit%-20).
It can only be wielded properly by paladins of level 100 or higher.
It weighs 55.00 oz.
Boosted
Code:
19:45 You see [accurate][sharpened] the devileye (Range:6, Atk+25, Hit%-24).
It can only be wielded properly by paladins of level 100 or higher.
It weighs 55.00 oz.
[atk: +25%]
[accuracy: +22%]
As you can see, it went from Hit%-20 to Hit%-24.
Would be good if it was Hit%-16.
 
Last edited:
it still adds extradefense to weapons
fixed

1. Is it possible to add some armor to items which dont have armor?(ex. bohs).
it's possible, here is an example:
Code:
local i = player:addItem("boots of haste")
i:setAttribute(ITEM_ATTRIBUTE_ARMOR, 4)
However, this script uses % of values so 0 + 0 * x% is still 0

2. Is it possible to change accuracy/extradef when it's on minus like in the devileye?
replace:
Code:
it_u:setAttribute(stats_used[stat][1], basestat + (basestat * v / 100))
to:
Code:
it_u:setAttribute(stats_used[stat][1], basestat + math.abs(basestat * v / 100))
I did it in first post also.

20:05 You see epic the devileye (Range:6, Atk+23, Hit%-12).
It can only be wielded properly by paladins of level 100 or higher.
It weighs 55.00 oz.
[accuracy: +38%]
[atk: +16%]
 
Last edited:
Back
Top