Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   Future Improvements (https://forums.graalonline.com/forums/forumdisplay.php?f=10)
-   -   onObserverMode function. (https://forums.graalonline.com/forums/showthread.php?t=76591)

Googi 09-01-2007 03:06 AM

onObserverMode function.
 
Maybe also a flag automatically set when a player goes into observer mode (isobserver or something), though scripters could do that themselves if the function were added. It would be good if a server wanted to return trials back to the starting/unstick location or something when they entered observer mode.

Horrified 09-01-2007 03:29 AM

agreed, big time

do this

Skyld 09-01-2007 11:48 AM

Quote:

Originally Posted by Stefan
The observer mode has been changed so that scripts get onPlayerLogin / onPlayerLogout / onActionPlayerOnline events when the the player is switched to / from observer mode. That should fix the problem with the treasure map.

Quote:

Originally Posted by Stefan
Players disappear for scripting when they are in observer mode. May be I can add an event when the player switches from observer mode to normal mode again (onSwitchObserverToPlayer) and add a time variable when the player switched to normal mode (player.lastobservermodetime)

Looks like things are already in the works.

Chompy 09-01-2007 01:41 PM

Quote:

Originally Posted by Skyld (Post 1345064)

Quote:

Originally Posted by Stefan
The observer mode has been changed so that scripts get onPlayerLogin / onPlayerLogout / onActionPlayerOnline events when the the player is switched to / from observer mode. That should fix the problem with the treasure map.

Quote:

Originally Posted by Stefan
Players disappear for scripting when they are in observer mode. May be I can add an event when the player switches from observer mode to normal mode again (onSwitchObserverToPlayer) and add a time variable when the player switched to normal mode (player.lastobservermodetime)

Looks like things are already in the works.

uhm..
Quote:

Originally Posted by Stefan
Players disappear for scripting

can we edit the player object then? Like would we be able to.. uhm.

PHP Code:

findplayer(<account>).setlevel2("osl.nw"3030); 

etc.. if they went into observer mode?

Or would it be like the onPlayerLogout() function that you can only access the object for an amount of time?

Admins 09-01-2007 02:13 PM

There is now

onSwitchPlayerToObserver(pl)
onSwitchObserverToPlayer(pl)
player.isobserver

Also when the player is switched to/from observer mode the events onPlayerLogout(pl) and onPlayerLogin(pl) (for all scripts) and onActionPlayerOnline (for Control-NPC) are now invoked.

Observers are not visible to players, but on clientside you have the variable "ghostsnear" which say if there are ghosts or observers near the player.
Observers don't invoke any events, so there will not be any onPlayerEnters or similar, and they are not in the players[] array. They still appear in allplayers[] and level.players[] though and act like normal players, but once they are switched back to the normal player mode they will load the old attributes again.

Chompy 09-01-2007 04:12 PM

Quote:

Originally Posted by Stefan (Post 1345086)
There is now

onSwitchPlayerToObserver(pl)
onSwitchObserverToPlayer(pl)
player.isobserver

Also when the player is switched to/from observer mode the events onPlayerLogout(pl) and onPlayerLogin(pl) (for all scripts) and onActionPlayerOnline (for Control-NPC) are now invoked.

Observers are not visible to players, but on clientside you have the variable "ghostsnear" which say if there are ghosts or observers near the player.
Observers don't invoke any events, so there will not be any onPlayerEnters or similar, and they are not in the players[] array. They still appear in allplayers[] and level.players[] though and act like normal players, but once they are switched back to the normal player mode they will load the old attributes again.

Very nice :)


All times are GMT +2. The time now is 10:31 PM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.