• 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] Revive System


I've disabled this:
Code:
-- Player --
function Player.allowMovement(self, allow)
return self:setStorageValue(STORAGE.blockMovementStorage, allow and -1 or 1)
end

But as it's said, the only thing it changes is that when i die, i can't move.

Console error:
41bdacdff4f51bb1cb5f57ccd7c98965.png

I don't understand this also: https://otland.net/threads/tfs-1-1-revive-system.229948/page-3#post-2235842

Do i have to change any ID on a player?. I mean, i've included the new group (ID: 4). But i haven't changed any char to that group, do i have to set all chars to ID 4 then?.

Ty for helping!.
 
You don't have to change any Id on any player (not manually at least).

Did you edited anything in the script? The lines that are giving you errors are the ones that add the town choices to the modalWindow.
 
Ok, let's go by parts.

1. It seems the error was caused because you must put more than 1 town.
The public script in page 1 of this topic got this:
Code:
for i = 1, #Game.getTowns() do
modal:addChoice(i, Town(i):getName())
end
It was not working with only one id.
I changed it to:
Code:
   for i = 1,2, #Game.getTowns() do
     modal:addChoice(i, Town(i):getName())
   end
And it worked.

2. Now no errors are shown in the console, BUT there is only listened Venore (id:1) and not Thais (id:2), while looking at the code are supposed to be show these 2, not only venore.

3. Apart from this, when i click "teleport" on "venore" (the only one shown), i respawn on Thais temple, so, what with this? o_O.

4. Having in mind the errors were caused by only puting 1 town, could be failing something of the code structure? I mean, i would only want to put Thais to respawn and from what we see it's impossible to put only 1 town T_T.

Thanks!.
 
for i = 1,2, #Game.getTowns() do
modal:addChoice(i, Town(i):getName())
end

That isn't a valid code, check your map too see if you have more than 1 town, and all towns have name. Use the original code that I provided or read TFS patches too see if town metatables changed in any way.
 
Of course i have more than 1 town and they have ids, we can see it as easy as looking at map editor:

5a011f9aa78ee17ddf09dae8e8eb6c36.png


With the original code (only with 1 number) the script is not working for me, lmao. But if i make it functional, it's bugged. So, what's the solution? Aren't any there?.

Thanks!.
 
Using the length operator to get the total amount of iterations may have been correct, but the variable i shouldn't have been used as a townId, but instead as index for the array that Game.getTowns returns.

e.g
Code:
local towns = Game.getTowns()
for i = 1, #towns do
   local town = towns[i]
   modal:addChoice(i, town:getName())
end
Using ipairs looks much cleaner though
Code:
for choiceId, town in ipairs(Game.getTowns()) do
   modal:addChoice(choiceId, town:getName())
end
 
Code:
local towns = Game.getTowns()
for i = 1, #towns do
   local town = towns[i]
   modal:addChoice(i, town:getName())
end

This works!. Thank you so much. How would it be if i only want Thais to appear in the list?.
 
This works!. Thank you so much. How would it be if i only want Thais to appear in the list?.
Remove the for loop, and replace i with the town id for Thais, and town:getName() with "Thais".
Code:
modal:addChoice(2, "Thais")
 
I modified it a bit and made it so that in order to Teleport to Town you have to have an enchanted chicken wing or a Shade
 
Remove the for loop, and replace i with the town id for Thais, and town:getName() with "Thais".
Code:
modal:addChoice(2, "Thais")

How can i removw the loop properly? I've been modifying the code but always get errors :(

Ty!.
 
What do you want to do?

When i die, in the modal windows appears like 20 times "Thais". I just want to remove all of them. So basically teleporting only to thais (town id: 2).

I'm using the code Ninja proposed:
Code:
local towns = Game.getTowns()
for i = 1, #towns do
local town = towns[i]
modal:addChoice(2, "Thais")
end
 
When i die, in the modal windows appears like 20 times "Thais". I just want to remove all of them. So basically teleporting only to thais (town id: 2).

I'm using the code Ninja proposed:
Code:
local towns = Game.getTowns()
for i = 1, #towns do
local town = towns[i]
modal:addChoice(2, "Thais")
end
Just use the code that ninja provided, don't use the rest.
 
Just use the code that ninja provided, don't use the rest.
Remove the for loop, and replace i with the town id for Thais, and town:getName() with "Thais".
Code:
modal:addChoice(2, "Thais")

That's the problem. I don't know how to remove the loop properly. Always get an error on trying.
 
That's the problem. I don't know how to remove the loop properly. Always get an error on trying.

Code:
local towns = Game.getTowns() -- Remove
for i = 1, #towns do -- The loop begins here
    local town = towns[i] -- Remove
    modal:addChoice(2, "Thais")
end -- The loop ends here

When you have removed the loop, and the unnecessary variables, then all that's left should be this.
Code:
modal:addChoice(2, "Thais")
 
Code:
local towns = Game.getTowns() -- Remove
for i = 1, #towns do -- The loop begins here
    local town = towns[i] -- Remove
    modal:addChoice(2, "Thais")
end -- The loop ends here

When you have removed the loop, and the unnecessary variables, then all that's left should be this.
Code:
modal:addChoice(2, "Thais")

Lol i had understood it wrong from the beginning. Thank you so much, master.

^^.
 
Seems interesting enough to look into for a less punishing system when killed by monsters and not players. Good job!
 
Hello!

This is a great script, i love it!

It almost works for me... (Using last commit from Github)

The player dies, the modalwindow shows up... But the options doesn't work, if i select teleport, the window just dissapears and you have to wait for the countdown and die... Same if i select "kill me now"...

If i have the item to revive and want to use it.. Same thing, window dissapears and just can wait for the countdown and die :(

Can please, someone help me?
 
Back
Top