Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Can't create multiple different NPC with the same display name #4759

Open
8 tasks done
ArturKnopik opened this issue Jun 23, 2024 · 3 comments
Open
8 tasks done
Assignees
Labels
bug An issue describing unexpected behavior of code
Milestone

Comments

@ArturKnopik
Copy link
Contributor

ArturKnopik commented Jun 23, 2024

By submitting this bug issue, you agree to the following.

  • 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)
  • This issue is reproducible without changes to the C++ code in this repository
  • This bug has not been resolved in master branch
  • 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

Steps to reproduce

  1. Copy Riona.xml -> Riona_Two.xml
  2. Add Riona Two to spawns (/s not working if NPC isn't on the map)
  3. Start server
  4. /goto Riona_Two

Additiona:
/s Riona_Two not workin

Zrzut ekranu 2024-06-23 211139

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

@ArturKnopik ArturKnopik added bug An issue describing unexpected behavior of code needs-confirmation not confirmed by a developer yet labels Jun 23, 2024
@github-project-automation github-project-automation bot moved this to Backlog in TFS 1.8 Jun 23, 2024
@ArturKnopik
Copy link
Contributor Author

ArturKnopik commented Jun 23, 2024

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

@EvilHero90
Copy link
Contributor

EvilHero90 commented Jun 23, 2024

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

@EvilHero90 EvilHero90 removed the needs-confirmation not confirmed by a developer yet label Jun 23, 2024
@EvilHero90 EvilHero90 added this to the 1.8 milestone Jun 23, 2024
@ArturKnopik
Copy link
Contributor Author

ArturKnopik commented Jun 23, 2024

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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug An issue describing unexpected behavior of code
Projects
Status: Backlog
Development

No branches or pull requests

2 participants