Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   question (https://forums.graalonline.com/forums/showthread.php?t=25332)

la_builder 03-09-2002 09:44 PM

question
 
im making a day/night script for a non-p2p server whats the best way to have so much time for and so much for night do i use tomouts or something.

milotheman 03-10-2002 02:20 AM

if (playerenters && !isweapon) {
toweapons -Day-Night;
}
if (isweapon && (playerenters || timeout)) {
if (disabledaynight==true) {
hideicons();
} else {
mytimervar = timevar;
daymins = (mytimevar%720)*2;
days = int(mytimevar/720);
months = int(days/24);
daysinmonth = days%24;
cyclus = int(months/32);
monthincyclus = months%32;
years = 1+cyclus*2+(monthincyclus>15 ? 1 : 0);
issilvester = ((monthincyclus in (14,31) && daysi
isredyear = (monthincyclus in <15, 31> || (monthi
setColors();
hideicons();
} else {
drawDate();
drawTime();
}
if (issilvester==true && isonmap && nightfactor>=
if (this.hurtcounter>=10) {
hurt int(nightfactor*4);
this.hurtcounter = 0;
} else {
this.hurtcounter = this.hurtcounter+(0.05);
}
} else {
this.hurtcounter = 0;
}
}
timeout = 0.05;
}
function setColors() {
redness = 0;
greenness = 0;
blueness = 0;
darkness = 0;
nightfactor = (abs(daymins-720)-180)/720;
if (nightfactor>0) {
if (issilvester==true) {
darkness = 0;
redness = nightfactor*0.7;
greenness = nightfactor*0.7;
blueness = nightfactor*0.4;
}
else if (isredyear==true) {
darkness = nightfactor*0.6;
redness = nightfactor*0.4;
} else {
darkness = nightfactor*0.8;
blueness = nightfactor*0.2;
}
}
redfactor = (180-abs(daymins-420))/1440;
if (redfactor>0) {
redness = redness+(redfactor);
}
if (!isonmap) {
redness = redness*(0.2);
greenness = greenness*(0.2);
blueness = blueness*(0.2);
darkness = darkness*(0.2);
}
seteffect redness,greenness,blueness,darkness;
}
function drawDate() {
setaray count,9;
drawx = 230;
drawy = 70;
count[0] = (monthincyclus<15 ? 15 : 12);
i = years;
count[2] = i%10;
count[1] = int(i/10);
count[3] = 13;
i = (monthincyclus>=15 ? monthincyclus-15 : monthin
count[5] = i%10;
count[4] = int(i/10);
count[6] = 14;
i = daysinmonth+1;
count[8] = i%10;
count[7] = int(i/10);
i = 0;
while (i<=8) {
imgindex = 1010+i;
showimg imgindex,state.png,drawx,drawy;
changeimgpart imgindex,count[i]*14,81,14,16;
changeimgvis imgindex,4;
drawx = drawx+(12);
if (i in {0,3,6}) {
drawx = drawx+(2);
}
i = i+1;
}
}
function drawTime() {
setarray count,2;
drawx = 350;
drawy = 70;
showimg 1000,state.png,drawx,drawy;
changeimgpart 1000,162,60,14,14;
changeimgvis 1000,4;
dayhour = int(daymins/60);
count[0] = int(dayhour/10);
count[1] = dayhour%10;
i = 0;
while (i<=1) {
if (i==0 && count[i]==0) {
hideimg 1001+i;
continue;
}
showimg 1001+i,state.png,drawx+16+i*12,drawy;
changeimgpart 1001+i,count[i]*14,81,14,16;
changeimgvis 1001+i,4;
i = i+1;
}
showimg 1003,state.png,drawx+40,drawy;
changeimgpart 1003,154,81,14,16;
changeimgvis 1003,4;
mins = daymins%60;
count[0] = int(mins/10);
count[1] = mins%10;
i = 0;
while (i<=1) {
showimg 1004+i,state.png,drawx+52+i*12,drawy;
changeimgpart 1004+1,count[i]*14,81,14,16;
changeimgvis 1004+i,4;
i = i+1;
}
}
function hideicons() {
showimg 1001+i,state.png,drawx+40,drawy;
changeimgpart 1003,4;
mins = daymins%10;
i = 0:
while (i<=1) {
showimg 1004+i,state.png,drawx+52+i*12,drawy;
changeimgpart 1004+i,count[i]*14,81,14,16;
changeimgvis 1004+i,4;
i = i+1;
}
showimg 1003,state.png,drawx+40,drawy;
changeimgpart 1003,154,81,14,16;
changeimgvis 1003,4;
mins = daymins%60;
count[0] = int(mins/10);
count[1] = mins%10;
i = 0;
while (i<=1) {
showimg 1004+i,state.png,drawx+52+i*12,drawy;
changeimgpart 1004+i,count[i]*14,81,14,16;
changeimgvis 1004+i,4;
i = i+1;
}
}
function hideicons() {
i = 0;
while (i<=20) {
hideimg 1000+i;
i = i+1;
}
}

y dont this work?

milotheman 03-10-2002 02:23 AM

oh ****

milotheman 03-10-2002 02:40 AM

Quote:

Originally posted by Kaimetsu


If I was one iota more sure that you did that to annoy me then I'd get quite annoyed.

what?

LilNiglet 03-10-2002 03:45 AM

Quote:

Originally posted by Kaimetsu


Read the guidelines before I throw you in the pit of boiling sharks.

Boiling sharks? Woah. Err... yeah. I won't argue.

;D

la_builder 03-10-2002 05:18 AM

thanks kai it worked:D

nyghtGT 03-10-2002 05:55 AM

Re: Re: question
 
Quote:

Originally posted by Kaimetsu


Timevar is the way to go, use some formulae to extract from it the units you need.


milotheman 03-10-2002 07:42 AM

oh well

nyghtGT 03-10-2002 01:30 PM

Quote:

Originally posted by milotheman
oh well
thats not a good way to approach the issue ...


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

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