• 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!

TFS 1.X+ Argument #3 unsafe

Mjmackan

Mapper ~ Writer
Premium User
Joined
Jul 18, 2009
Messages
1,234
Solutions
8
Reaction score
111
Location
Sweden
Why does this return with: Argument #3 is unsafe? Can someone explain these effin' basics to me? Tfs 1.3

Do i need to declare what monster is inside each addevent or can i just use the declaration I have used in my action script? And how if so?
Lua:
            addEvent(function(id)
            local monster = Monster(id)
            if not monster then
                return
            end
            monster:setLevel(player:getStorageValue(storePetLevel) + 1)
            doCreatureAddHealth(monster, getCreatureMaxHealth(monster) - getCreatureHealth(monster))
            end, 1400, monster)
 
Solution
Why does this return with: Argument #3 is unsafe? Can someone explain these effin' basics to me? Tfs 1.3

Do i need to declare what monster is inside each addevent or can i just use the declaration I have used in my action script? And how if so?
Lua:
            addEvent(function(id)
            local monster = Monster(id)
            if not monster then
                return
            end
            monster:setLevel(player:getStorageValue(storePetLevel) + 1)
            doCreatureAddHealth(monster, getCreatureMaxHealth(monster) - getCreatureHealth(monster))
            end, 1400, monster)
You are passing monster ref as an argument, pass monster.uid instead.

4Nathu4

valoria.online
Joined
Oct 27, 2009
Messages
325
Solutions
9
Reaction score
185
GitHub
4mrcn4
Why does this return with: Argument #3 is unsafe? Can someone explain these effin' basics to me? Tfs 1.3

Do i need to declare what monster is inside each addevent or can i just use the declaration I have used in my action script? And how if so?
Lua:
            addEvent(function(id)
            local monster = Monster(id)
            if not monster then
                return
            end
            monster:setLevel(player:getStorageValue(storePetLevel) + 1)
            doCreatureAddHealth(monster, getCreatureMaxHealth(monster) - getCreatureHealth(monster))
            end, 1400, monster)
You are passing monster ref as an argument, pass monster.uid instead.
 
Solution
OP
OP
Mjmackan

Mjmackan

Mapper ~ Writer
Premium User
Joined
Jul 18, 2009
Messages
1,234
Solutions
8
Reaction score
111
Location
Sweden
You are passing monster ref as an argument, pass monster.uid instead.
I did it like that and wondered why one addevent stopped working, now i did see that I added a monster check when there was no monster and it was suppose to spawn a monster. Lol, thanks! <3
 

4Nathu4

valoria.online
Joined
Oct 27, 2009
Messages
325
Solutions
9
Reaction score
185
GitHub
4mrcn4
When I did that somehow it wont create the summon afterwards.

These are the 3 addevents, top one is the only one working doing it like "that" aka adding monster.uid.
Lua:
            addEvent(function(id)
            local monster = Monster(id)
            if not monster then
                return
            end
            player:setStorageValue(99981, player:getStorageValue(99981) + 1)
            player:setStorageValue(99982, player:getStorageValue(99982) + 1)
            player:setStorageValue(99983, player:getStorageValue(99983) + 1)
            player:setStorageValue(99984, player:getStorageValue(99984) + 1)
            player:setStorageValue(99985, player:getStorageValue(99985) + 1)
            player:setStorageValue(99986, player:getStorageValue(99986) + 1)
          
            monster:remove()
            end, 1300, monster.uid)
          
            addEvent(function(id)
            local monster = Monster(id)
            if not monster then
                return
            end
            local petSummon = Game.createMonster(petSummonChecker(player.uid), player:getPosition(), true, true)
            player:addSummon(petSummon)
            end, 1350, monster.uid)
          
            addEvent(function(id)
            local monster = Monster(id)
            if not monster then
                return
            end
            monster:setLevel(player:getStorageValue(storePetLevel) + 1)
            doCreatureAddHealth(monster, getCreatureMaxHealth(monster) - getCreatureHealth(monster))
            end, 1400, monster.uid)
You remove the monster after 1300 ms, it just returns after there is no monsters in later events.


I did it like that and wondered why one addevent stopped working, now i did see that I added a monster check when there was no monster and it was suppose to spawn a monster. Lol, thanks! <3
Cheers mate
 
Last edited:
Top