Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Ive Been Looking For The Scripting For the p2p servers (like server time) (https://forums.graalonline.com/forums/showthread.php?t=704)

Komieko 03-28-2001 10:50 AM

Well me and my friend KJL have started a great server but need to use the server time codeing to get some of our nocs to work right now i was wounding if mabe Stefan, And anyothers taht know it would help me out
-Thanks SLP Omega (PW Projects Team)

freddyfox 03-28-2001 11:09 PM

Uhh, I belive you talk to Stefan about making your server P2P. Although, P2P often reduces the number of people that play on your server drastically.

Fai 03-29-2001 12:48 AM

Well less people = good. If I had a server I wouldn't want more than 15 people on at a time.

grim_squeaker_x 03-29-2001 02:54 AM

Quote:

Originally posted by Fai
Well less people = good. If I had a server I wouldn't want more than 15 people on at a time.
Yup, I agree on that, plus less people means less lag and you actually know everybody who plays.

Mustang1988 03-29-2001 08:44 AM

bravo online... =p.. not OLD UGLY Bravo... the one that came back up... then became PW.. i used ta be GP Chief there and I knew EVERYONE because only about 20 people USED their accounts

Crono Illusion 03-30-2001 09:39 AM

Less people may be good, but decreasing players by going P2P has 2 possible effects.

A. You'll have less people, but still have a community of players.
B. You'll have no players, and your server will crumble.

Hopefully, effect A will be the effect going P2P will provide.

JoMomma 03-31-2001 01:23 AM

Ok I can help you with the server time issue...

Currently, ALL servers (this includes non-pay servers) and clients have a build-in variable called "timevar". Every 5 seconds, timevar is incremented by 1 by the server. This is also saved by the server so that outages won't reset it :P

On Graal 2001 this is how they have it setup:
30 ticks = 1 hour
720 = 1 day
17280 = 1 month
414720 = 1 year

Now if you're a good scripter and want to do stuff with division to get each part, you'd probably want to do something like:

NPC Code:
this.time = timevar;
this.year = int(this.year/414720);



BZZT! Won't work... Once it gets up to about 1 month, you start getting floating point errors with division. I recommend something like this:

NPC Code:
for (this.year=1;this.time<414720;this.year++) {
this.time -= 414720;
}



Do the same thing for month, day, etc etc... Of course something like HOUR would need you to start off at 0 and not 1, cause it's military time. Oh, and if someone like Kyle or Tyhm doesn't like this type of code, well... it's the best I could think of to get beyond the division problems.

You may wanna put the time up too. You'd use:
NPC Code:
showimg 200,state.png,x,y;
changeimgpart 200,x,y,width,height;
changeimgvis 200,4;



changeimgvis with a parameter of 4 lets you display stuff LOCALLY and in a fixed position. This way it can act like a status bar. Also more importantly: it makes the x/y PIXEL values, and not CELL values. So it's not 64x64 anymore with that, but it IS what you need.

This should be all ya need to know.

Grey_Mage 03-31-2001 11:50 PM

Example?
 
Could someone put an example of timevar and everything my head hurts TOO MANY NUMBERS...

grim_squeaker_x 04-01-2001 01:18 AM

Blah.
 
Timevar is an online variable which goes up with 1 every 5 seconds, it is counted globally.

Grey_Mage 04-01-2001 01:19 AM

...
 
I need an example... =( I am not to good at math.

JoMomma 04-01-2001 04:15 AM

I showed you examples... I put numbers that you can use for determining how many hours/days/etc have passed, and a general forumla for getting each part. Problem is you'll need to know SOME math to make such an NPC, since it's not exactly possible to do calculations without using math and all, and getting a useful number from "timevar" does require math.


All times are GMT +2. The time now is 04:52 PM.

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