Jump to content

Respawn on the same map


Drake
 Share

Recommended Posts

Hello everyone, im having an issue with the auto respawn in the same map, example “Capture the Flag”

I’m using the function at functions.lua:
            
CUSTOM_RETURN_POINTS         = {
                ['puzzleworld']            = 'Sacred Snow Mountain',
                ['puzzleworld2']        = 'Sacred Snow Mountain',
                ['garner2']        = 'Chaos Portal',
            }
            
            function GetChaRespawnPoint(Player, mapname)
                local ret                 = ""
                for i,v in pairs(CUSTOM_RETURN_POINTS) do
                    if(i == mapname) then
        if mapname == "puzzleworld" or  mapname == "puzzleworld2" then
            ReAll(Player)
        end
                        ret             = v
                    end
                end
                local SideID                = GetChaSideID(Player)
                if (mapname == "ctf") then
                    if (SideID == 1) then
                        return CTF.Spawns[2].Spawn
                    elseif (SideID == 2) then
                        return CTF.Spawns[1].Spawn
                    end
                end
                return ret
            end
 

 

And this is the source code code that i me using:

void CCharacter::BackToCity(bool bDie, cChar *szCityName, Long lMapCpyNO, Char chSwitchType) { SubMap *pCMap = GetSubMap(); pCMap->GoOut(this); SetToMainCha(bDie); CCharacter *pCMainCha = GetPlyMainCha(); pCMainCha->SetExistState(enumEXISTS_NATALITY); //pCMainCha->m_timerScripts.Reset(); /* if(bDie && (!strcmp(pCMap->GetName(), "guildwar"))) { if(GetGuildType() == emGldTypePirate) { szCityName = "guildwarpirateside"; } else { szCityName = "guildwarnavyside"; } } else if(bDie && (!strcmp(pCMap->GetName(), "guildwar2"))) { if(GetGuildType() == emGldTypePirate) { szCityName = "guildwarpirateside2"; } else { szCityName = "guildwarnavyside2"; } } */ if (g_CParser.DoString("MapRespawnOnDeath", enumSCRIPT_RETURN_STRING, 1, enumSCRIPT_PARAM_LIGHTUSERDATA, 1, pCMainCha, DOSTRING_PARAM_END)) szCityName = g_CParser.GetReturnString(0); if (!szCityName || !strcmp(szCityName, "")) pCMainCha->ResetBirthInfo(); else { SBirthPoint *pSBirthP; pSBirthP = GetRandBirthPoint(GetLogName(), szCityName); SetBirthMap(pSBirthP->szMapName); SetPos(pSBirthP->x * 100, pSBirthP->y * 100); } pCMainCha->SwitchMap(pCMap, pCMainCha->GetBirthMap(), pCMainCha->GetPos().x, pCMainCha->GetPos().y, false, chSwitchType, lMapCpyNO); }

 

im still being respawned to argent city when i’m dying instead of being Respawned into CTF

Link to comment
Share on other sites

  • Replies 5
  • Created
  • Last Reply

Top Posters In This Topic

Up.

Link to comment
Share on other sites

For the Lua function, no need to do loops.

Hidden Content

    To view, authorization is required.

As for the side of C++, you're looking at the wrong function. Check other functions within source where revive gets processed.

Edited by Angelix
Link to comment
Share on other sites

  • 2 weeks later...
On 8/1/2021 at 5:44 PM, Drake said:

And this is the source code code that i me using:

void CCharacter::BackToCity(bool bDie, cChar *szCityName, Long lMapCpyNO, Char chSwitchType) { SubMap *pCMap = GetSubMap(); pCMap->GoOut(this); SetToMainCha(bDie); CCharacter *pCMainCha = GetPlyMainCha(); pCMainCha->SetExistState(enumEXISTS_NATALITY); //pCMainCha->m_timerScripts.Reset(); /* if(bDie && (!strcmp(pCMap->GetName(), "guildwar"))) { if(GetGuildType() == emGldTypePirate) { szCityName = "guildwarpirateside"; } else { szCityName = "guildwarnavyside"; } } else if(bDie && (!strcmp(pCMap->GetName(), "guildwar2"))) { if(GetGuildType() == emGldTypePirate) { szCityName = "guildwarpirateside2"; } else { szCityName = "guildwarnavyside2"; } } */ if (g_CParser.DoString("MapRespawnOnDeath", enumSCRIPT_RETURN_STRING, 1, enumSCRIPT_PARAM_LIGHTUSERDATA, 1, pCMainCha, DOSTRING_PARAM_END)) szCityName = g_CParser.GetReturnString(0); if (!szCityName || !strcmp(szCityName, "")) pCMainCha->ResetBirthInfo(); else { SBirthPoint *pSBirthP; pSBirthP = GetRandBirthPoint(GetLogName(), szCityName); SetBirthMap(pSBirthP->szMapName); SetPos(pSBirthP->x * 100, pSBirthP->y * 100); } pCMainCha->SwitchMap(pCMap, pCMainCha->GetBirthMap(), pCMainCha->GetPos().x, pCMainCha->GetPos().y, false, chSwitchType, lMapCpyNO); }

 

im still being respawned to argent city when i’m dying instead of being Respawned into CTF


This is the Src Code:

Hidden Content

    To view, authorization is required.

 

On 8/6/2021 at 6:56 PM, Angelix said:

As for the side of C++, you're looking at the wrong function. Check other functions within source where revive gets processed.

You mean the src code above aint the right code? i forgot to write it on thread as CODE option so i've updated it just now.

Link to comment
Share on other sites

On 8/21/2021 at 6:09 AM, Drake said:


This is the Src Code:

Hidden Content

    To view, authorization is required.

 

You mean the src code above aint the right code? i forgot to write it on thread as CODE option so i've updated it just now.

Well especially now that I see my name in that line, yes, it's not right. I later figured out where it should be properly done so it works correctly. Could still be wrong and this line still work, I don't know anything about C++, but in another function I found it to work correctly.

Link to comment
Share on other sites

19 hours ago, Angelix said:

Well especially now that I see my name in that line, yes, it's not right. I later figured out where it should be properly done so it works correctly. Could still be wrong and this line still work, I don't know anything about C++, but in another function I found it to work correctly.

Oh ic, do you mind telling me in which code i should look up

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

Board Life Status


Board startup date: May 27, 2020 20:35:04
×
×
  • Create New...