TemplePlus icon indicating copy to clipboard operation
TemplePlus copied to clipboard

config.maxLevel for NPC

Open anatoliy-savchak opened this issue 3 years ago • 2 comments

My NPC in KoTS Commander Karef failed to be configured to level 20, as the check won't allow him. npc.make_class(toee.stat_level_fighter, 20) # 20 is max

python_object.cpp:

static PyObject * PyObjHandle_MakeClass(PyObject* obj, PyObject* args) {
	auto self = GetSelf(obj);
	int level;
	Stat statClass = stat_level_barbarian;
	if (!PyArg_ParseTuple(args, "ii", &statClass, &level)) {
		return nullptr;
	}

	if (level <= 0 || (uint32_t) level > config.maxLevel){
		return PyInt_FromLong(0);
	}

I think this limit should be applied to PC only. But let NPC to be as designed.

anatoliy-savchak avatar Jul 25 '22 10:07 anatoliy-savchak

Heh, it's just an ancient cheat code I used to test high level features. I think it's harmless to set the upper bound to 30 or something like that (I guess the limit would be XPTABLE_MAXLEVEL-3). Note that the code is simple enough that you could do it in python anyway...

DudeMcDude avatar Jul 25 '22 17:07 DudeMcDude

"Note that the code is simple enough that you could do it in python anyway..." - sure. I just accidently caught that.

Default value btw is 10.

anatoliy-savchak avatar Jul 25 '22 18:07 anatoliy-savchak