[Bug]: Can't create multiple different NPC with the same display name
By submitting this bug issue, you agree to the following.
- [X] This is a bug in the software that resides in this repository, and not a support matter (use https://otland.net/forums/support.16/ for support)
- [X] This issue is reproducible without changes to the C++ code in this repository
- [X] This bug has not been resolved in master branch
- [X] There is no existing issue for this bug already
Does this bug crash tfs?
no
Server Version
1.7 (Master)
Operation System
all (listed below)
OS Description
No response
Bug description
Can't create multiple different NPC with the same display name
Possible Pull Requests which are to blame
- [x] #4671
- [x] #4724
- [x] #4741
- [x] #4747
Steps to reproduce
- Copy
Riona.xml->Riona_Two.xml - Add Riona Two to spawns (
/snot working if NPC isn't on the map) - Start server
-
/goto Riona_Two
Additiona:
/s Riona_Two not workin
Actual Behavior
/goto Riona_Two works, NPC have invalid name(name is taken from filename)
/s Riona_Two not working
Expected Behavior
/goto Riona_Two should not works, npc Riona_Two.xml NPC should have Riona name(taken from xml file from name field)
/s Riona_Two should create npc from Riona_Two.xml file named Riona
Backtrace
No response
for /s fix looks easy to be done
changes required in file place_npc.lua
function onSay(player, words, param)
if not player:getGroup():getAccess() then
return true
end
if player:getAccountType() < ACCOUNT_TYPE_GOD then
return false
end
local position = player:getPosition()
local npc = NpcType(param) -- <<< change to Game.createNpc(param, position)
if npc then
Game.createNpc(param, position) -- <<< to remove
position:sendMagicEffect(CONST_ME_MAGIC_RED)
else
player:sendCancelMessage("There is not enough room.")
position:sendMagicEffect(CONST_ME_POFF)
end
return false
end
I don't really get the sense behind this, as you can spawn the same npc just fine with /s or adding them several times in the mapeditor why would you want to make another xml file for the same npc?
I'll include the changes proposed to /s in revnpcsys version 1.4
Example from issue is to fast setup env when issue occure
example: i want to have 2 npc with displayed name Traveler Traveler1.xml (travel1.lua) that teleport player to Island Traveler2.xml (travel2.lua) that teleport player to main land What was possible before changes is both npc has the same display name. For now file name is used and described behavior is impossible On map i will have Traveler1 and Traveler2 instead 2x Traveler (with different behaviors)
About /s - npc must not be loaded during startup(not present in spawn.xml)
Fixed, closing.