num 3-4 that i talk aboutIn the first place, what you are saying is not very well understood.
Second the thread title does not describe any problem If you want help, please write a better explanation, and if you don't know how to explain it, maybe you can describe the steps to reproduce your problem
Example:
1. Login
2. Go to a far away place and let a monster kill you
3. When connecting the character appears in the city of the devil, but should appear in his city of residence
4. When reconnecting the character continues to appear in the city of the demon and never appears in his city of residence
In your request you don't need c++ edits at all, all you want just teleporting the player in his town as i understood what u need "you need to teleport him to his town id while he is dead"-when logout in anyposition .. character save this position and when die . back to the logout position how to solve it ..
-should be back to townid when dead . .not to logout position
function onDeath(cid, corpse, killer)
doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)))
return true
end
registerCreatureEvent(cid, "teleport_to_town")
<event type="death" name="teleport_to_town" event="script" value="balbala.lua"/>
In your request you don't need c++ edits at all, all you want just teleporting the player in his town as i understood what u need "you need to teleport him to his town id while he is dead"
you can use this:
Lua:function onDeath(cid, corpse, killer) doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid))) return true end
Lua:registerCreatureEvent(cid, "teleport_to_town")
but I'm sure u have a bug somewhere in your creaturescripts it blocks player from saving or smth. you need also to mention your Tfs/engine version to provide more help.XML:<event type="death" name="teleport_to_town" event="script" value="balbala.lua"/>
-when logout in anyposition .. character save this position and when die . back to the logout position how to solve it ..
-should be back to townid when dead . .not to logout position
Well but i did what he wants there's another solution he could use this instead this will check player postion then it willl teleport him to his town if he isn't therethis is not a good idea
because that lines are gonna make the player not die normally,not loose any looot, he will just get teleported to temple when HP is 0 like death on events.
function onLogin(cid)
doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)))
return true
end
maaan, this will teleport any player to temple after relogWell but i did what he wants there's another solution he could use this instead this will check player postion then it willl teleport him to his town if he isn't there
PS: if u used this you don't need to register into login.lua anymore.Lua:function onLogin(cid) doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid))) return true end
This what he wants already..maaan, this will teleport any player to temple after relog
so if u logout on dp, and came back you will be on temple
this could be used on war map
This what he wants already..
Excuse me but you need to speak more clearly or giving some examples as what Sarah said because your request is really identical to my script.if you dont understand what i post about dont post about anything from your mind
-- my problem in player.cpp
player when logout . - character save in this position
and after he got die by '" he is return to the logout position
that i mean!!
and ty for your help!
can you mention the one you talks to?if you dont understand what i post about dont post about anything from your mind
-- my problem in player.cpp
player when logout . - character save in this position
and after he got die by '" he is return to the logout position
that i mean!!
and ty for your help!
2. Go to a far away place and let a monster kill youExcuse me but you need to speak more clearly or giving some examples as what Sarah said because your request is really identical to my script.
also it maybe not from player.cpp have u checked your map ? is your map really defined putting town as 1 .
also to better help you should provide your engine / Tfst version if the issue was really related with sources because there's more sources u will not have the right code .
Kids
Have you ever opened player.cpp?
We can’t help you fix your code if you don’t provide your code so we can find the issue in it.
Since you don’t say what engine you use I will assume TFS1.3, so the problem will be in this function:
void Player::death(Creature* lastHitCreature)
void Player::eek:nDie()
{
Creature::eek:nDie();
sendTextMessage(MSG_EVENT_ADVANCE, "You are dead.");
NetworkMessage msg;
msg.AddByte(0x28);
client->WriteBuffer(msg);
loginPosition = masterPos;
if(skillLoss){
//Magic level loss
uint32_t sumMana = 0;
int32_t lostMana = 0;
//sum up all the mana
for(int32_t i = 1; i <= magLevel; ++i){
sumMana += vocation->getReqMana(i);
}
sumMana += manaSpent;
lostMana = (int32_t)std::ceil(sumMana * ((double)lossPercent[LOSS_MANASPENT]/100));
dude and we just need to help youi need just fix my problem and he insult me !!
that all
Idk what that's about, it's the classic Tibia client, so I can't do much there to help.
Might be internal video card settings. Heard of issues before with Inte and nVidia control panels
DEVLAND that i used
void Player:nDie()
Post automatically merged:
C++:void Player::eek:nDie() { Creature::eek:nDie(); sendTextMessage(MSG_EVENT_ADVANCE, "You are dead."); NetworkMessage msg; msg.AddByte(0x28); client->WriteBuffer(msg); loginPosition = masterPos; if(skillLoss){ //Magic level loss uint32_t sumMana = 0; int32_t lostMana = 0; //sum up all the mana for(int32_t i = 1; i <= magLevel; ++i){ sumMana += vocation->getReqMana(i); } sumMana += manaSpent; lostMana = (int32_t)std::ceil(sumMana * ((double)lossPercent[LOSS_MANASPENT]/100));
void Player::die()
{
Creature::die();
sendTextMessage(MSG_EVENT_ADVANCE, "You are dead.");
NetworkMessage msg;
msg.AddByte(0x28);
client->WriteBuffer(msg);
loginPosition = getTown()->getTemplePosition();
Yea .. but i need it when dead by monster back to townid@3688599 please post your server version, so someone can help you!
This is what you want?
View attachment 59230
Tried my previous post?Yea .. but i need it when dead by monster back to townid
not when logout/login
player.cpp base operand of `->' is not a pointerSo try this
C++:void Player::die() { Creature::die(); sendTextMessage(MSG_EVENT_ADVANCE, "You are dead."); NetworkMessage msg; msg.AddByte(0x28); client->WriteBuffer(msg); loginPosition = getTown()->getTemplePosition();
when add this (( make errorTried my previous post?