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

Help with Special Description

Kakaher

Member
Joined
Nov 2, 2009
Messages
129
Reaction score
7
Hello everybody!

So, I'm trying to give player special descriptions as they complete some quests...

For example I have this script:
Lua:
function onLook(cid, thing, position, lookDistance)
	local storage = 1443332
		if isPlayer(thing.uid) and getPlayerStorageValue(thing.uid, storage) > 0 then
			doPlayerSetSpecialDescription(thing.uid,'.\n'..(getPlayerSex(thing.uid) == 0 and 'She' or 'He')..' is an Orc')
		end 
 
		if isPlayer(thing.uid) == cid then 
			doPlayerSetSpecialDescription(thing.uid,'.\n You are an Orc')
		end
	return true
end

It is just a test...

When I look at a char with that storage value I can see "he is a Test"
But, when I'm the one with the storage value and I look at myself, I just can't see "You are a Test"... It just returns a normal look "You see yourself...." .. No errors or whatever, "you are a test" just doesn't appear...

What is wrong with my code ?

Can someone please help me ?
Thanks a lot already
REP+
 
Lua:
local storage = 144332

function onLook(cid, thing, position, lookDistance)
	if (isPlayer(thing.uid) ~= cid and getPlayerStorageValue(thing.uid, storage) > 0) then
		doPlayerSetSpecialDescription(thing.uid,'.\n'..(getPlayerSex(thing.uid) == 0 and 'She' or 'He')..' is an Orc')
	end
		if (isPlayer(thing.uid) == cid and getPlayerStorageValue(thing.uid, storage) > 0) then
			doPlayerSetSpecialDescription(thing.uid,'.\n You are an Orc')
		end
	return true
end

-updated -
 
Last edited:
Lua:
local storage = 144332

function onLook(cid, thing, position, lookDistance)
	if (isPlayer(thing.uid) ~= cid and getPlayerStorageValue(thing.uid, storage) > 0) then
		doPlayerSetSpecialDescription(thing.uid,'.\n'..(getPlayerSex(thing.uid) == 0 and 'She' or 'He')..' is an Orc')
	else
		doPlayerSetSpecialDescription(thing.uid,'.\n You are an Orc')
	end
	return true
end

Thanks for trying to help...

But it is still not working...

And also when you look at someone it says "you are an orc" not he/she is
And, when you look at yourself still nothing happens...
 
Lua:
local storage = 144332
 
function onLook(cid, thing, position, lookDistance)
	if not isPlayer(thing.uid) then
		return true
	end
	
	if getPlayerStorageValue(thing.uid, storage) > 0 then
		if thing.uid ~= cid then
			doPlayerSetSpecialDescription(thing.uid,'.\n '..(getPlayerSex(thing.uid) == 0 and 'She' or 'He')..' is an Orc')
		else
			doPlayerSetSpecialDescription(thing.uid,'.\n You are an Orc')
		end
	end
	return true
end
 
Thanks for trying to help...

But it is still not working...

And also when you look at someone it says "you are an orc" not he/she is
And, when you look at yourself still nothing happens...

yeah I see where I messed up, however it's a source fault that you can't see your own special description. You'd need to edit the sources for you to see 'You're an Orc'
 
Lua:
local storage = 144332
 
function onLook(cid, thing, position, lookDistance)
	if not isPlayer(thing.uid) then
		return true
	end
	
	if getPlayerStorageValue(thing.uid, storage) > 0 then
		if thing.uid ~= cid then
			doPlayerSetSpecialDescription(thing.uid,'.\n '..(getPlayerSex(thing.uid) == 0 and 'She' or 'He')..' is an Orc')
		else
			doPlayerSetSpecialDescription(thing.uid,'.\n You are an Orc')
		end
	end
	return true
end

Didn't work either...


yeah I see where I messed up, however it's a source fault that you can't see your own special description. You'd need to edit the sources for you to see 'You're an Orc'

Yeah, probably you are right...
All the scripts here are correct, but they still don't work, it must be a source problem..

Do you have any idea on how to fix it ?


Thank you both for the help!
 
Look at the storage value of the first script (in first post) and Synthetic_'s script, that may be your problem.
 
Look at the storage value of the first script (in first post) and Synthetic_'s script, that may be your problem.

Thanks for the help!
But I noticed it, it isnt the problem = /

I´m pretty sure it must be a souce problem...

If anybody know how to fix it, it would be a great!
 
Oh, I think it's because you're using thing.uid.
Change it to cid, then look at yourself, if it works, then that is the problem.

To fix that, try adding isPlayer(cid) to the if statement.


Hold on, let me test it on my server.


Thanks again..
I tried like this:

first:
Lua:
function onLook(cid, thing, position, lookDistance)
	local storage = 1443332
		if isPlayer(thing.uid) and getPlayerStorageValue(thing.uid, storage) > 0 then
			doPlayerSetSpecialDescription(thing.uid,'.\n'..(getPlayerSex(thing.uid) == 0 and 'She' or 'He')..' is an Orc')
		end 
 
		if isPlayer(cid) and getPlayerStorageValue(thing.uid, storage) > 0 then 
			doPlayerSetSpecialDescription(cid,'.\n You are an Orc')
		end
	return true
end

Didn't work...

second:
Lua:
local storage = 1443332
 
function onLook(cid, thing, position, lookDistance)
	if (isPlayer(thing.uid) ~= cid and getPlayerStorageValue(thing.uid, storage) > 0) then
		doPlayerSetSpecialDescription(thing.uid,'.\n'..(getPlayerSex(thing.uid) == 0 and 'She' or 'He')..' is an Orc')
	end
		if (isPlayer(cid) and getPlayerStorageValue(thing.uid, storage) > 0) then
			doPlayerSetSpecialDescription(cid,'.\n You are an Orc')
		end
	return true
end

Neither worked... What leads me to think the problem is with the sources...
Any ideas ?
 
The ones you tested there are both incorrect (comparing isPlayer(thing.uid) ~= cid (bool ~= creatureid))

This should work though (with correct storage)
Lua:
local storage = 144332
 
function onLook(cid, thing, position, lookDistance)
	if not isPlayer(thing.uid) then
		return true
	end
 
	if getPlayerStorageValue(thing.uid, storage) > 0 then
		if thing.uid ~= cid then
			doPlayerSetSpecialDescription(thing.uid,'.\n '..(getPlayerSex(thing.uid) == 0 and 'She' or 'He')..' is an Orc')
		else
			doPlayerSetSpecialDescription(thing.uid,'.\n You are an Orc')
		end
	end
	return true
end
 
The ones you tested there are both incorrect (comparing isPlayer(thing.uid) ~= cid (bool ~= creatureid))

This should work though (with correct storage)
Lua:
local storage = 144332
 
function onLook(cid, thing, position, lookDistance)
	if not isPlayer(thing.uid) then
		return true
	end
 
	if getPlayerStorageValue(thing.uid, storage) > 0 then
		if thing.uid ~= cid then
			doPlayerSetSpecialDescription(thing.uid,'.\n '..(getPlayerSex(thing.uid) == 0 and 'She' or 'He')..' is an Orc')
		else
			doPlayerSetSpecialDescription(thing.uid,'.\n You are an Orc')
		end
	end
	return true
end

Maybe I´m missing something, but isnt that VirrageS script ?

But, anyway, just tried it, didnt work either = /
 
VirrageS' script works.

22:45 You see Name (Level 100). He has no vocation.
He is an Orc.

22:45 You see yourself. You are god.
You are an Orc.
 
Last edited:
Summ's script works.

22:45 You see Name (Level 100). He has no vocation.
He is an Orc.

22:45 You see yourself. You are god.
You are an Orc.

Yeah, it must be a problem with my sources = /
It doesn't work for me = /

Does anybody know how to fix it ?


23:56 You see Sworder (Level 100). He is a knight.
He is an Orc.

23:56 You see yourself. You are a knight.
 
@Evan
It is not mine. It's VirrageS' script.

It might only work if you don't look on yourself. In older versions (ex. 0.3.6) special description does only work on other players than yourself.
To fix that you gotta move
[cpp]s << getSpecialDescription();[/cpp]
in function Player::getDescription to the end of the function before:

[cpp]return s.str();[/cpp]

In newer versions that is fixed.
 
@Evan
It is not mine. It's VirrageS' script.

It might only work if you don't look on yourself. In older versions (ex. 0.3.6) special description does only work on other players than yourself.
To fix that you gotta move
[cpp]s << getSpecialDescription();[/cpp]
in function Player::getDescription to the end of the function before:

[cpp]return s.str();[/cpp]

In newer versions that is fixed.

THANK YOU!!
It IS working now...
So it was a source bug after all!!

Thanks so much man!!!
REP++


I will also REP everyone else who helped me on this thread!
Thanks A LOT you all!
 
Back
Top