Is Player Visible?

Started by Old Guy, Fri 29/05/2009 01:20:32

Previous topic - Next topic

Old Guy

The game I am working has 180 rooms; 50% of the rooms are 3rd-person perspective (ShowPlayerCharacter set to True), and 50% are 1st-person perspective (ShowPlayerCharacter set to False). On the Iconbar, there is a spot that when clicked executes code in the global script which moves the character slightly (a bit of humor). This works fine in 3rd-person perspective, and as my beta testers just found out, does not work in 1st-person perspective. I do understand that moving the character while in 1st-person perspective should not work, and I am okay with that.

In order to fix things, I went looking for some way that the global script could tell whether or not the character was visible in the room. If the character was not visible, the script would not execute the offending portion of the code.

I was hoping to find something like a ‘player.visible’ property that could be tested by the script. Unfortunately, I have been unable to find any way to obtain this information.

Next, I hoped my script could find out if the Walk cursor in that room was disabled or not. If disabled, that would imply that the character was not visible. I wasn’t able to do this either.

So it seems my best option would be to create a custom Boolean property called PlayerVisible for example, and then set the property to True in 50% of the rooms. It seems a shame to do that since this information has already been specified by the ShowPlayerCharacter property.

Does anyone have a more elegant or less labor-intensive solution?

Ghost

The player "visibility" can be checked. Use the transparency setting:

if (player.transparency == 100) // invisible
if (player.transparency == 0) // visibile

Old Guy

Quote from: Ghost on Fri 29/05/2009 01:48:58
The player "visibility" can be checked. Use the transparency setting:

if (player.transparency == 100) // invisible
if (player.transparency == 0) // visibile

Ghost,

Thanks for your suggestion.

Actually, although I didn't mention it, I did try this option.

It seem that the Transparency property only has significance if the player can be visible (I.E. actually exists in the room). In the situation I described, player.Transparency is always 0, no matter if the setting for ShowPlayerCharacter was True of False.

Old Guy

Ghost

Ah, okay... well, in that case you might be better off with your initial idea. Sounds like some work, but if it sees you through it's surely worth it.

Khris

Try checking player.on.
It's a hidden property that should be set to false if "Show player character" is disabled.

Old Guy

Quote from: KhrisMUC on Fri 29/05/2009 08:15:16
Try checking player.on.
It's a hidden property that should be set to false if "Show player character" is disabled.


Perfect! It works like a charm.

Thanks very much.

Old Guy

cat

Thanks, this was very helpful. Is there a list of hidden properties somewhere?

Pumaman

Well, hidden properties shouldn't really be used because they're not officially tested and supported. In this case the Character.on property generally works, but when I get round to it I want to properly test it and make it a formal Character.Visible property.

SMF spam blocked by CleanTalk