Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting
FAQ Members List Calendar Today's Posts

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 08-22-2011, 11:39 PM
Televangelist Televangelist is offline
Registered User
Join Date: Aug 2011
Posts: 21
Televangelist is on a distinguished road
Quick question: Can you alter the dungeon reset timers?

So, I know there's a 'standard' timer for when a level resets if nobody's on it.


Can that be overridden?

For puzzle reasons, I'd like for some of my dungeons to function such that if nobody's in any of the dungeon's rooms, it resets instantly.



(Explanation: This ties into a mechanic I'm building my game around, whereby your character can only adventure outside of 'safe' areas for a certain amount of time, and if the timer runs out they're warped back to their spawn point... building around this idea allows me to make wilderness areas feel more 'wild' and unexplored. I'm not doing stats, XP, or levels in my game for the most part, but over time, characters can find items scattered throughout the world that will increase the length of time they can continuously adventure into the wild.

Sort of like how in many games your ability to dive underwater is restricted by an oxygen bar, which then refills when you return to the surface!

This lets me build a certain 'tension' into a dungeon run, as you're working against the clock... and enables some content to get 'easier' as you become a more experienced player of the game, without the crude mechanic of levels, stats, and XP where content becomes easier because your 'numbers' become bigger than the enemy's.


If the dungeon didn't reset when all the players exited it -- well, that tension would be broken, because you could re-enter the dungeon before it resets and all your progress has already been 'saved'.


This feels like it should be easy... but perhaps it isn't?
Reply With Quote
  #2  
Old 08-22-2011, 11:44 PM
ffcmike ffcmike is offline
Banned
Join Date: Jul 2004
Location: London
Posts: 2,029
ffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond repute
Send a message via AIM to ffcmike Send a message via MSN to ffcmike
You could easily do this via:

PHP Code:
function onPlayerLeaves(){
  if(
players.size() == 0){
    
//reset stuff
  
}

Reply With Quote
  #3  
Old 08-23-2011, 08:31 AM
Televangelist Televangelist is offline
Registered User
Join Date: Aug 2011
Posts: 21
Televangelist is on a distinguished road
Ooh, nice!


So, just so I'm clear:

1. players.size refers to the number of players in the level, not the overall server?

2. The larger plan I have for the 'adventuring time limit' that can be expanded via power-ups (in the same way your heart meter, say, can be expanded in a Zelda game over time) is feasible as well?

Thanks!
Reply With Quote
  #4  
Old 08-23-2011, 09:58 AM
Tricxta Tricxta is offline
The Muffin Man
Tricxta's Avatar
Join Date: Oct 2010
Location: Australia
Posts: 563
Tricxta is just really niceTricxta is just really nice
Thats also simple, you can store the time limit for each player using a client string. To set this client string simple do:
PHP Code:
client.timelimit=32
Yep! it's as simple as that although you will want to use a clientr string so players can't use a memory scanner to manipulate it, clientr strings can only be set serverside but read both client and server side so you should keep that in mind.

Also i'm going to assume your relatively new to scripting in general so just so there's no confusion client and clientr are reserved words but the name isn't fixed and can be whatever you like.
Reply With Quote
  #5  
Old 08-23-2011, 12:08 PM
Crow Crow is offline
ǝɔɐɹq ʎןɹnɔ
Crow's Avatar
Join Date: Dec 2006
Location: Germany
Posts: 5,153
Crow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond repute
Quote:
Originally Posted by Televangelist View Post
Ooh, nice!


So, just so I'm clear:

1. players.size refers to the number of players in the level, not the overall server?

2. The larger plan I have for the 'adventuring time limit' that can be expanded via power-ups (in the same way your heart meter, say, can be expanded in a Zelda game over time) is feasible as well?

Thanks!
There's players and allplayers. The first always refers to the players in the level the code is executed in. The latter refers to all players on the server. Also, your "larger plan" should be possible as well. I suggest you store the time it can be extended in some clientr.variables (like Tricxta said), then just wait the specific time when all players left until you reset your stuff.
Reply With Quote
  #6  
Old 08-23-2011, 09:50 PM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
Quote:
Originally Posted by Crow View Post
There's players and allplayers. The first always refers to the players in the level the code is executed in. The latter refers to all players on the server.
To clarify, allplayers is an array of player objects (TServerPlayer) for every player online.

players is an array of every player in the current level (on GMAPs, every player within roughly a one-level radius).

When you're doing players.size(), it's just returning the number of items in the array.
__________________
Reply With Quote
  #7  
Old 08-23-2011, 11:54 PM
Televangelist Televangelist is offline
Registered User
Join Date: Aug 2011
Posts: 21
Televangelist is on a distinguished road
Very helpful, thanks!
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 09:17 PM.


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