• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

Solved Instead of death message.

slavi

#define SLAVI32 _WIN32
Senator
Joined
Sep 9, 2015
Messages
681
Solutions
11
Reaction score
561
GitHub
slavidodo
Last edited:
/data/creaturescripts/scripts/playerdeath.lua

line:10
Code:
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You are dead.")

maby, or if you're using another repo, then just in config: death_msg = "You are dead."
Unfortunately this is not what i mean , i mean the message which is says "unfairFightReduction" i don't want it to be shown, also teleporting player to temple , however he lose exp , skills like normal.
 
Code:
function onPrepareDeath(player, killer)
    player:teleportTo(player:getTown():getTemplePosition())
    player:addHealth(player:getMaxHealth())
    player:addMana(player:getMana())
    return false
end
 
Code:
function onPrepareDeath(player, killer)
    player:teleportTo(player:getTown():getTemplePosition())
    player:addHealth(player:getMaxHealth())
    player:addMana(player:getMana())
    return false
end
yep this i how you cheat death, but You have to add all the exp losses and item losses or not losses here too.
Also without sourceedit you have to make your game so that you cant be 1 shotted. else onPrepareDeath function will be skipped.
(or make onHealthchange for that, but if you do that then you need new defensive formulas in there too)
 
Code:
function onPrepareDeath(player, killer)
    player:teleportTo(player:getTown():getTemplePosition())
    player:addHealth(player:getMaxHealth())
    player:addMana(player:getMana())
    return false
end
Firstly thanks a lot, but is there other way for source edit? i mean i have checked player.cpp [player::death] trying to replace "SendReLoginWindows" with adding hp and teleporting to temple??
That's what i am trying to experience.
But anyway thanks.
 
yep this i how you cheat death, but You have to add all the exp losses and item losses or not losses here too.
Also without sourceedit you have to make your game so that you cant be 1 shotted. else onPrepareDeath function will be skipped.
(or make onHealthchange for that, but if you do that then you need new defensive formulas in there too)
hmm i want source not to add all the actions that already made , like losing experience, dropping corpse or loot, add unjustified frags, <yellow skull>
I did that before and happened the same happened to me before:
player teleports to temple {GOOD}
Relogin message not show {GOOD}
6ORFwne.png



This is the problem:: where is the player?? although he is not showing , he can't move.

Hope you help me with this printer
 
Did you add my edit aswell, on the player.cpp? Since it should update player health and mana to max.
 
Did you add my edit aswell, on the player.cpp? Since it should update player health and mana to max.
Ye, and you should update your pastepin script as it don't contain
Code:
uint8_t unfairFightReduction = 100;
.
Printer if you have skype you can give it to me cause i need to have some talk with you.
 
Replace unfair death message with teleporting player to temple.
Tfs 1.1

Replace whole this function:
https://github.com/otland/forgottenserver/blob/master/src/player.cpp#L1989

with this:
http://pastebin.com/Kc4hfP40[


And replace this:
https://github.com/otland/forgottenserver/blob/master/src/creature.cpp#L718

with this:

Code:
        if (!getPlayer()) {
            g_game.removeCreature(this, false);
        }

Thanks to [printer] it had been solved.
well, this function works:
teleport player [OK]
send message "You are dead," [OK]
but not lost exp
not have any message of how much exp you lost
I can't see if I lost level, because don't lost exp D:
how fix it ?
 
Last edited:
@BUMP, I found a little bug
Code:
Lua Script Error: [Event Interface]
data/events/scripts/player.lua:Player@onGainExperience
data/events/scripts/player.lua:197: attempt to perform arithmetic on a nil value
stack traceback:
        [C]: in function '__sub'
        data/events/scripts/player.lua:197: in function 'useStamina'
        data/events/scripts/player.lua:236: in function <data/events/scripts/player.lua:219>
when the player "die" and get teleported to temple and later try hunt again give this error and stop the dacaying of stamina
 
@BUMP, I found a little bug
Code:
Lua Script Error: [Event Interface]
data/events/scripts/player.lua:Player@onGainExperience
data/events/scripts/player.lua:197: attempt to perform arithmetic on a nil value
stack traceback:
        [C]: in function '__sub'
        data/events/scripts/player.lua:197: in function 'useStamina'
        data/events/scripts/player.lua:236: in function <data/events/scripts/player.lua:219>
when the player "die" and get teleported to temple and later try hunt again give this error and stop the dacaying of stamina
I will rework it, tonight mate.
 
Back
Top