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

How to change description of items?

What distro are you using? It appears that it requires source editing in 8.42 and 8.5.

Unless you make a script using uniqueids, so that it wouldn't interfere with the one the door already has.

So, distro?
 
Oops.

For the description source is necessary. Well, unless, of course, you make another script that sets the door description. So, you sure you want lua? Again; source would be faster and less complex.
 
this one?

Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
	if item.uid == 10281 then
	if getPlayerLevel(cid) > 1 then -- what level you wanna change it self.
  			doPlayerSendTextMessage(cid, 22, "a gate of expertise for level 10K")
		else
			doPlayerSendTextMessage(cid, 22, "You may pass.")
			doTransformItem(item.uid, item.itemid + 1)
			doTeleportThing(cid, toPosition, TRUE)
		end
		return TRUE
	end
	return FALSE
end

ofc rep me :D
 
Thing is, brah, the description will stay the same. You could easily change it with another function, but if the script isn't used, the door will still have it's normal description.
 
Alas ;D

In your sources folder, look for a file called item.cpp, open in, and look for this:

Code:
	else if(it.levelDoor && item && item->getActionId() >= it.levelDoor &&

When you find it, change

Code:
	else if(it.levelDoor && item && item->getActionId() >= it.levelDoor &&
		item->getActionId() <= (it.levelDoor + g_config.getNumber(ConfigManager::MAXIMUM_DOOR_LEVEL)))
		s << " for level " << item->getActionId() - it.levelDoor;

For

Code:
	else if(it.levelDoor && item && item->getActionId() >= it.levelDoor &&
		item->getActionId() <= (it.levelDoor + g_config.getNumber(ConfigManager::MAXIMUM_DOOR_LEVEL)))
		s << " for level " << item->getActionId() - it.levelDoor << "[COLOR="Red"]K[/COLOR]";

Also; change the red part for what you want it to say after the required level. Now it would say it exactly the same way as your example does. Keep me posted on its workability.
 
Hello Santy, I know zero C++ but from what I could understand, in your code every leveldoor would now say "for level --K" right?

Would it be possible to make it more like (example is in "lua/nothing" XD):

Code:
	if actionID >= 2000 then
		description = "new 'K' one"
	else
		description = "normal one"
	end

Because AID 2000 is the one that says "for lvl 1000", so it starts to be "K" from there on, but if it were AID 1999 (for lvl 999) in your code it would say 999K? :eek:

Just pointing it out for you to make the perfect code :)
 
Thing is, as far as I've understood, he's not asking for >[1-9]000's to be replaced with [1-9]K, but for the level requirement to ask for a specified sort of level, I'm guessing that in his server (at least in the example's server), levels will be called k-levels, or something along these lines.

lulz :p
 
Code:
	else if(it.levelDoor && item && item->getActionId() >= it.levelDoor &&
		item->getActionId() <= (it.levelDoor + g_config.getNumber(ConfigManager::MAXIMUM_DOOR_LEVEL)))
	{
		if(item->getActionId() >= 2000)
			s << " for level " << ((item->getActionId() - it.levelDoor) / 1000) << "K";
		else
			s << " for level " << item->getActionId() - it.levelDoor;
	}

Voila. That should work.
But, it wouldn't say KK when a higher amount such as level 100000000 is set. It could be easily added, though. (Now it would say that level 100000k is required)

Edit: Lulz, the door's description could also be changed with a script executed as soon as the server starts. :rolleyes:
 
Last edited:
Back
Top