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

onLook - He is a player/tutor/gamemaster/god/senior tutor etc.

Fresh

Quack!
Joined
Oct 21, 2009
Messages
1,838
Solutions
18
Reaction score
617
Location
Poland
Hello.
As title say.
I need an onLook creaturescript script or C++ one what gives bonus attribute to Look function that display status of people after looking on them. If person is player message on look will be like this:
He is sorcerer. He is player.
If person got gamemaster or tutor the message will be like this:
He is sorcerer. He is gamemaster.
He is sorcerer. He is tutor.

If anyone can do it, I would be very grateful ;)

Thanks in advance,
Fresh!
 
I make something like this but its Not working:
Lua:
function onLook(cid, thing, position, lookDistance)

if(not isPlayer(cid) or not isPlayer(thing)) then
return
end
if getPlayerAccess(cid) == 1 then
doPlayerSetSpecialDescription(cid, 'You are helper.')
elseif getPlayerAccess(cid) == 2 then
doPlayerSetSpecialDescription(cid, 'You are tutor.')
elseif getPlayerAccess(cid) == 3 then
doPlayerSetSpecialDescription(cid, 'You are banner.')
elseif getPlayerAccess(cid) == 4 then
doPlayerSetSpecialDescription(cid, 'You are gamemaster.')
elseif getPlayerAccess(cid) == 5 then
doPlayerSetSpecialDescription(cid, 'You are administrator.')
else
doPlayerSetSpecialDescription(cid, 'You are player.')
end
if getPlayerAccess(thing) == 1 then
doPlayerSetSpecialDescription(thing, 'He is helper.')
elseif getPlayerAccess(thing) == 2 then
doPlayerSetSpecialDescription(thing, 'He is tutor.')
elseif getPlayerAccess(thing) == 3 then
doPlayerSetSpecialDescription(thing, 'He is banner.')
elseif getPlayerAccess(thing) == 4 then
doPlayerSetSpecialDescription(thing, 'He is gamemaster.')
elseif getPlayerAccess(thing) == 5 then
doPlayerSetSpecialDescription(thing, 'He is administrator.')
else
doPlayerSetSpecialDescription(thing, 'He is player.')
end

end
 
This is pretty challenging script :D Needs a sex check for He/She is a ...
I wonder if there is a function for groupId, getGroupId? Would be better to use that. My brain is crashing right now, can't help you out right now :D
 
I don't want sex check... just add sentence after all default sentences - level, she/he, etc etc...
 
You can add the "Show group description instead of vocation" flag to each group in data/XML/groups.xml
or change the getDescription function in player.cpp to this:
[CPP]
std::string Player::getDescription(int32_t lookDistance) const
{
std::stringstream s;
if(lookDistance == -1)
{
s << "yourself.";
if(hasFlag(PlayerFlag_ShowGroupNameInsteadOfVocation))
s << " You are " << group->getName();
else if(vocationId != 0)
s << " You are " << vocation->getDescription();
else
s << " You have no vocation";
}
else
{
s << nameDescription;
if(!hasCustomFlag(PlayerCustomFlag_HideLevel))
s << " (Level " << level << ")";

s << ". " << (sex % 2 ? "He" : "She") << " is " << group->getName();
if(vocationId != 0)
s << " is " << vocation->getDescription();
else
s << " has no vocation";
}[/CPP]
 
Reason why it doesn't work is probably because you don't return any value in the first part of the script.
It should be return false.
Also, this would be doable using arrays no?
 
Fixed.
[CPP]std::string Player::getDescription(int32_t lookDistance) const
{
std::stringstream s;
if(lookDistance == -1)
{
s << "yourself.";
if(vocation_id != 0)
s << " You are " << vocation->getDescription();
else
s << " You have no profession";

s << ". You are " << group->getName();
}
else
{
s << nameDescription;

s << ". " << (sex % 2 ? "He" : "She");
if(vocation_id != 0)
s << " is " << vocation->getDescription();
else
s << " has no profession";

s << ". " << (sex % 2 ? "He" : "She") << " is " << group->getName();
s << getSpecialDescription();
}

std::string tmp;
if(marriage && IOLoginData::getInstance()->getNameByGuid(marriage, tmp))
{
s << ", ";
if(vocation_id == 0)
{
if(lookDistance == -1)
s << "and you are";
else
s << "and is";

s << " ";
}

s << (sex % 2 ? "husband" : "wife") << " of " << tmp;
}

s << ".";
if(guildId)
{
if(lookDistance == -1)
s << " You are ";
else
s << " " << (sex % 2 ? "He" : "She") << " is ";

s << (rankName.empty() ? "a member" : rankName)<< " of the " << guildName;
if(!guildNick.empty())
s << " (" << guildNick << ")";

s << ".";
}

return s.str();
}[/CPP]
 
Reason why it doesn't work is probably because you don't return any value in the first part of the script.
It should be return false.
Also, this would be doable using arrays no?

C'mon...I'm pretty sure the guy will notice that I didn't copy the whole function when he's about to edit it...and why should I anyways? This perfectly shows from the beginning of the function to the edited part, I don't see any need to copy the rest.
And yeah it is possible. In fact, I think I've seen a similar script made by cbrm (?).
 
C'mon...I'm pretty sure the guy will notice that I didn't copy the whole function when he's about to edit it...and why should I anyways? This perfectly shows from the beginning of the function to the edited part, I don't see any need to copy the rest.
And yeah it is possible. In fact, I think I've seen a similar script made by cbrm (?).
What are you talking about even?
 
MM, this?

Lua:
std::string Player::getDescription(int32_t lookDistance) const
{
	std::stringstream s;
	if(lookDistance == -1)
	{
		s << "yourself.";
		if(hasFlag(PlayerFlag_ShowGroupNameInsteadOfVocation))
			s << " You are " << group->getName();
		else if(vocationId != 0)
			s << " You are " << vocation->getDescription();
		else
			s << " You have no vocation";
	}
	else
	{
		s << nameDescription;
		if(!hasCustomFlag(PlayerCustomFlag_HideLevel))
			s << " (Level " << level << ")";
		
		s << ". " << (sex % 2 ? "He" : "She");
		if(vocationId != 0)
			s << " is " << vocation->getDescription() ". " << (sex % 2 ? "He" : "She") << " is " << group->getName();
		else
			s << " has no vocation";
	}
 
Back
Top