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

[REQUEST] C++ Code fix for change name

lucas123

New Member
Joined
Jun 6, 2010
Messages
85
Reaction score
4
i'm have setCreatureName system [Scarlet Ayleid]
http://otland.net/f35/change-existing-monster-name-game-131643/

i'm need a fix bug for send information to client with new name for monster.
how can I do to update the function name for people who are near the time of return? -- google translater..


PT:
to com o sistema de setCreatureName do Scarlet Ayleid..

eu gostaria de saber como posso fazer para atualizar o nome do monstro na hora da troca pa quem está perto dele nessa hora.
alguem pode ajudar?

vlw..

thanks.
bye =D
 
You could have asked on my thread, but fine

You'd have to remove the creature from the Spectators list, then change the name, and then re-send the creature to the spectators list

I didn't implemented that because IMO it wasn't needed because I just used this function when the monsters were summoned so you could easily summon the monster in a far away place, change its name, and then teleport it to the player, which is why its a setCreatureName, not a changeCreatureName :p

you can still work around it and make it work like you want without changing my function in the sources

Code:
function changeCreatureName(cid, newName, newDescription)
   local farAwayPos = {x = 100, y = 100, z = 7} --Just make a 3x3 square around these coordenates
    local pos = getCreaturePosition(cid)
    local mobName = getCreatureName(cid)
    local hp = getCreatureHealth(cid)
    local master = getCreatureMaster(cid)
    if master == cid then
        master = nil
    end
    doRemoveCreature(cid)
    cid = doCreateMonster(mobName, farAwayPos)
    setCreatureName(cid, newName, newDescription)
    doCreatureAddHealth(cid, -(getCreatureMaxHealth(cid) - hp))
    doTeleportThing(cid, pos)
    if master ~= nil then
        doConvinceCreature(master, cid)
    end
    return true
end

this will remove the creature, create a new one in the far away position, change the name and put its HP like it was and teleport it to its original place and if it has a master, it sets the master. The only thing it doesn't do is that it doesn't register any creature scripts to it, appart from that, it should work :)

 
Last edited:
it doesn't works for me..
i'm need to all monsters onMap..
if i remove monster from map and create other, monsters go respaw 10000x.

i'm need : "remove the creature from the Spectators list, then change the name, and then re-send the creature to the spectators list"
please help..
your solution does not fit what I want.

PT:
isso não serve para o que eu quero..
eu ja tenhu isso feito em relação ao summon, porem preciso disso para os bixos do mapa e nao da pa ficar criando todos em uma posição toda hora...
alguem ae sabe resolver?
eu preciso realmente remover ele da spectator list, mudar o nome dps coloca-lo novamente.. alguem sabe fazer isso?
obrigado.
 
honestly, I don't know how to check the spectators list and update it and the reason I'm not gonna bother to check how to do it is because I make code for myself and for what I need and then maybe share it, however, if someone else does it, I'll gladly add it to my main thread and give credits
 
i'm use this code, but if i summon monster, i create monster, execute onSpawn and after convince creature,
i can't use onSpawn to change name too, i'm need fix for this code and not anothers solutions.
 
Its faster to find other solutions then to wait for someone else to do this(which most likely wont happen)

You want that when monsters spawn naturally, they change name, but when they are summoned, they keep their regular name, is that it?

a spawn file
Code:
local newName = "NewMonsterName"
local newDescription = "NewMonsterDescription"

function onSpawn(cid)
   setCreatureName(cid, newName, newDescription)
   return true
end

your script
Code:
function summonMonster(cid, monsterName)
   ...
   local farAwayPos = {x = 100, y = 100, z = 7} --Change This!! 
   local monster = doCreateMonster(monsterName, farAwayPos)
   setCreatureName(monster, monsterName, "a " .. monsterName)
   doTeleportThing(monster, getCreaturePosition(cid))
   doConvinceCreature(cid, monster)
   return true
end

there, now every monster you spawn will have the new name you want, and when you are summoning one, it'll change the name back to the regular name
 
Last edited:
man i have functions to duplicate monster and change name, but i'm need update list of spectators man...
How i can update list of spectators for name?
 
Back
Top Bottom