Castle Paradox Forum Index Castle Paradox

 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 Gamelist   Review List   Song List   All Journals   Site Stats   Search Gamelist   IRC Chat Room

Ok, stupid thing...
Goto page 1, 2  Next
 
Post new topic   Reply to topic    Castle Paradox Forum Index -> HELP!
View previous topic :: View next topic  
Author Message
October's Cry




Joined: 06 Jan 2007
Posts: 16

PostPosted: Wed Jan 10, 2007 9:43 pm    Post subject: Ok, stupid thing... Reply with quote

I'm trying to set up a script that will create a day to night effect, where every 10 to 15 minutes, it gets brighter, then darker again as it aproaches night, and have this script run throughout the game, battles and on each map. Is there a simple way to do this, i know that there is a example on moogles site, but, i can't get it to work....

AND, another thing, i am also setting up a evil/good script where what you do will increase your evilness or good quality by 1, and your overall is one -- the other, therefore making you either good bad, or grey. I tried some things, but, i can't display the overall evilness.... i know it may sound confusing, but, i want it so that if you're good, good people will respond to you better, and bad.... bad people.... thus, during it your character will morph into a demon or angel....
_________________
check out my bands at....

Doom Metal at www.soundclick.com/octoberscry

Progressive metal at www.soundclick.com/outercharm

You know you want to..... i'll be redoing october's cry songs soon.
Back to top
View user's profile Send private message Send e-mail
TwinHamster
♫ Furious souls, burn eternally! ♫




Joined: 07 Mar 2004
Posts: 1352

PostPosted: Thu Jan 11, 2007 11:15 am    Post subject: Reply with quote

I believe the Moglery has an example of the day/night script.

Well...If there's only one value for good or evil, you could simply use a tag.
So if tag (moral) is true, then you're good. If it's false, then you're bad.

I've been wanting to implement a system where you could be extremely bad, moderately bad, neutral, moderately good, or extremely good.

To use a system like this, you would use a 'global variable'.
So, let's say neutral was equal to 50, extremely bad is between 0 and 30, and extremely good is between 70 and 100. The people reaction scripts would pretty much be something like:
Code:
If(Moral>>50) #Meaning you're a good guy.
then(
#Guy says "I like the fact that you're good. Nice job!"
  if(Moral>>70) #If you're on the path of extreme goodness.
  then(
  #Guy says" You know what? I like you so much, I'll give you an item!"
)

else(
  if(Moral<=50) #Doesn't matter what level of bad you are.
  then(
  #Guy says"You suck!"
  )
)
Back to top
View user's profile Send private message Send e-mail AIM Address
Moogle1
Scourge of the Seas
Halloween 2006 Creativity Winner
Halloween 2006 Creativity Winner



Joined: 15 Jul 2004
Posts: 3377
Location: Seattle, WA

PostPosted: Fri Jan 12, 2007 12:18 am    Post subject: Reply with quote

Oh yeah... everyone has always complained that the day/night script doesn't work. What's the error it gives? Maybe I should take a look at the script myself. I'll probably do that tomorrow from work rather than tonight while I'm tired.
_________________
Back to top
View user's profile Send private message Visit poster's website AIM Address
October's Cry




Joined: 06 Jan 2007
Posts: 16

PostPosted: Fri Jan 12, 2007 5:26 pm    Post subject: day night script errors? Reply with quote

ok... i have to type all this again cause it didn't go the first time. first... it does not recognize "time off set" as a variable, constant or function. assuming you wanted it to be a variable i set it as one to rid that error message. then... it came up with the dofade,time script... which, it apparently has 1 arguement named, but none were defined. so, i set that to 1,0.... i know NOTHING about this stuff, so just bare with this a bit... ok... next, it compiled, BUT, time offset was never used... poped up as an error message....

Currious, i ran the script anyways.... in the game, it started dark.... a nice kind of morning dark... but, i was unsure how long it would take for it to brighten or darken... this ACTUALLY, only happens when another script was run as well, OR an error poped up from a script, (due to it not being there for purposes to test this one script only.... so... i changed the #'s, and still nothing... and i waited a good 4-5 minutes.... so, i'm assuming maybe the "time off set" not being returned or something might be a reason... as i said.... I KNOW NOT MUCH ABOUT THIS STUFF, so... just letting you know what i got... and thanx tons for actually taking time to look into it...
_________________
check out my bands at....

Doom Metal at www.soundclick.com/octoberscry

Progressive metal at www.soundclick.com/outercharm

You know you want to..... i'll be redoing october's cry songs soon.
Back to top
View user's profile Send private message Send e-mail
Moogle1
Scourge of the Seas
Halloween 2006 Creativity Winner
Halloween 2006 Creativity Winner



Joined: 15 Jul 2004
Posts: 3377
Location: Seattle, WA

PostPosted: Sat Jan 13, 2007 2:07 am    Post subject: Reply with quote

The script doesn't automatically cycle through the time of day. You need to do that yourself. If you don't want to do that, then the script is probably more useful for creating night scenes.

The intended usage is that you call the first script as the newgame plotscript, then the second script any time you want to set the time of day (with the hour of day, 0-23, as the argument). It is poorly documented and even more poorly written, but it sounds like you got it on its feet, which is good.
_________________
Back to top
View user's profile Send private message Visit poster's website AIM Address
October's Cry




Joined: 06 Jan 2007
Posts: 16

PostPosted: Sat Jan 13, 2007 7:20 am    Post subject: day night Reply with quote

would there be a way to make it so that it automatically would cycle through the time of day say like every 5 minutes being one hour? so that it will contuniously go no matter which map you are on so that it would be a little more consistant?
_________________
check out my bands at....

Doom Metal at www.soundclick.com/octoberscry

Progressive metal at www.soundclick.com/outercharm

You know you want to..... i'll be redoing october's cry songs soon.
Back to top
View user's profile Send private message Send e-mail
Moogle1
Scourge of the Seas
Halloween 2006 Creativity Winner
Halloween 2006 Creativity Winner



Joined: 15 Jul 2004
Posts: 3377
Location: Seattle, WA

PostPosted: Sat Jan 13, 2007 2:42 pm    Post subject: Reply with quote

Yeah. It'll be easier in the next release, when timers are implemented properly, but for the time being you could write a script like this:

Code:
script, cycle time, begin
 variable(time of day)
 time:=12 #let's start at noon
 while(1==1) do ( #loop infinitely
  dofade(time of day)
  wait(300) #wait some arbitrary amount of time
  time of day:=time of day+1
  if (time of day>>23) then (time of day:=0)
 )
end


If you want this effect to be continuous through the entire game, you could replace the last two lines of the startup script with the contents of this script.
_________________
Back to top
View user's profile Send private message Visit poster's website AIM Address
October's Cry




Joined: 06 Jan 2007
Posts: 16

PostPosted: Sat Jan 20, 2007 5:12 pm    Post subject: ok... one thing about the day night script Reply with quote

ok... with what i have, using moogles script with the few variations in intervals between hours, i have an issue with loading it... for some odd reason, on a new game, it will start at night, and when it is re-loaded, no matter what time it was, it would not be running.... as a matter of fact, it reverts to having absolutely no palette changes and won't fade. i have "startup" set for both the new game and load game in special plotscripts... any ideas?
_________________
check out my bands at....

Doom Metal at www.soundclick.com/octoberscry

Progressive metal at www.soundclick.com/outercharm

You know you want to..... i'll be redoing october's cry songs soon.
Back to top
View user's profile Send private message Send e-mail
Moogle1
Scourge of the Seas
Halloween 2006 Creativity Winner
Halloween 2006 Creativity Winner



Joined: 15 Jul 2004
Posts: 3377
Location: Seattle, WA

PostPosted: Sat Jan 20, 2007 6:28 pm    Post subject: Reply with quote

Can you post your "startup" script? I suspect you've put it in the run-once section of the script.
_________________
Back to top
View user's profile Send private message Visit poster's website AIM Address
October's Cry




Joined: 06 Jan 2007
Posts: 16

PostPosted: Sat Jan 20, 2007 7:05 pm    Post subject: startup script... Reply with quote

ok, it's kinda long, and some info is not necessary to have, so i cut out lots.... but, esentially, here it is...


Code:

#-----------------------------------------------------------------#

script,startup,begin

variable (timeoffset)
variable (time)

 if (readglobal(245)==0) then
 (
   setvariable(timeoffset,18)
   variable(ctr)
   for(ctr,0,255) do
   (
     writeglobal(pal+ctr*3,readcolor(ctr,color:red))
     writeglobal(pal+1+ctr*3,readcolor(ctr,color:green))
     writeglobal(pal+2+ctr*3,readcolor(ctr,color:blue))
   )
 )
variable(time of day)
   time:=12
      while(1==1) do
begin
 dofade(time of day)
  wait (800)
    time of day:=time of day+1
if (time of day>>23),
   then (time of day:=0)


if (evil<=-25) then  #this is all meant to change character appearance according to thier evilness....
  begin
    set hero picture(find hero(hero:Ponch),17,outside battle)

if (evil<=-75) then
  begin
    set hero picture(find hero(hero:Ponch),19,outside battle)

if (evil<=-99) then
  begin
    set hero picture(find hero(hero:Ponch),20,outside battle)

if (evil>=25) then
  begin
    set hero picture(find hero(hero:Ponch),46,outside battle)

if (evil>=50) then
  begin
    set hero picture(find hero(hero:Ponch),47,outside battle)

if (evil>=75) then
  begin
    set hero picture(find hero(hero:Ponch),48,outside battle)

if (evil>=99) then
  begin
    set hero picture(find hero(hero:Ponch),49,outside battle)
  )
else (
 
    set hero picture(find hero(hero:Ponch),0,outside battle)
  end
end #there is more end's in it... just cut out...


#-----------------------------------------------------------------#

#this is the dofade part, incase errors are found here...

script,dofade,time,begin
 variable(ratio_r)
 variable(ratio_g)
 variable(ratio_b)
 variable(ctr)
 if (time>>12) then (time:=24--time)
 if (time>>8) then
 (
   ratio_r:=100
   ratio_g:=100
   ratio_b:=100
 )
 if (time<<4) then
 (
   ratio_r:=25
   ratio_g:=30
   ratio_b:=35
 )
 if (time==4) then
 (
   ratio_r:=45
   ratio_g:=35
   ratio_b:=40
 )
 if (time==5) then
 (
   ratio_r:=60
   ratio_g:=50
   ratio_b:=45
 )
 if (time==6) then
 (
   ratio_r:=70
   ratio_g:=60
   ratio_b:=55
 )
 if (time==7) then
 (
   ratio_r:=90
   ratio_g:=80
   ratio_b:=70
 )
 if (time==8) then
 (
   ratio_r:=100
   ratio_g:=90
   ratio_b:=80
 )
if (time==9) then
 (
   ratio_r:=100
   ratio_g:=100
   ratio_b:=90
 )

 if (last_r<>ratio_r,or,last_g<>ratio_g,or,last_b<>ratio_b) then
 (
   for (ctr,0,255) do
   (
     writecolor(ctr,color:red,(readglobal(200+ctr*3)*ratio_r)/100)
     writecolor(ctr,color:green,(readglobal(201+ctr*3)*ratio_g)/100)
     writecolor(ctr,color:blue,(readglobal(202+ctr*3)*ratio_b)/100)
   )
 )
 last_r:=ratio_r
 last_g:=ratio_g
 last_b:=ratio_b
 updatepalette
end

_________________
check out my bands at....

Doom Metal at www.soundclick.com/octoberscry

Progressive metal at www.soundclick.com/outercharm

You know you want to..... i'll be redoing october's cry songs soon.
Back to top
View user's profile Send private message Send e-mail
Moogle1
Scourge of the Seas
Halloween 2006 Creativity Winner
Halloween 2006 Creativity Winner



Joined: 15 Jul 2004
Posts: 3377
Location: Seattle, WA

PostPosted: Sat Jan 20, 2007 11:18 pm    Post subject: Reply with quote

Okay... as far as I can tell you haven't changed dofade. Here are some comments on the script in general:

- Your "evil" routine really clutters up the startup script. This is inconsequential, but it would look a lot nicer if you made a separate script for it.
- More importantly, time of day should be a global variable unless the time of day is supposed to reset to noon every time the player loads.
- I'm not sure why it starts at night on a new game, but the reason why you don't see any pallete changes on a loaded game is that it starts at noon (see previous bullet point). 800 ticks is over a minute and you won't notice any palette changes before about 4:00 game time.
- What in the world is timeoffset supposed to be? I realize I put that in there myself but for the life of me I can't imagine what it would do. You can delete all references to timeoffset.

Other than that, double-check that you're using the same script for load game and start game. I'm confused as to why a new game starts at night.

To test that loadgame and newgame are running, you might try changing "wait(800)" to something really low, like "wait(10)", and seeing if that causes the palette to cycle pretty quickly. A full day should happen in about thirty seconds with that wait.
_________________
Back to top
View user's profile Send private message Visit poster's website AIM Address
October's Cry




Joined: 06 Jan 2007
Posts: 16

PostPosted: Sun Jan 21, 2007 7:42 am    Post subject: starting to work... Reply with quote

ok... it's starting to work a little more... the game will start palette changes on load... BUT, for some odd reason it still always starts at noon on loads...

i even tried erasing the initial:
time of day:=12

just incase it reset it.... but it still resets too noon every load...
thanx

WHOAH!!! Serrious issue..... just tested it out, and for some reason, after load, it starts at noon, then resets to time it should have been.... THEN, it goes back to load screen.... EEP!

here...

Code:

#-----------------------------------------------------------------#

script,startup,begin

 if (readglobal(245)==0) then
 (

   variable(ctr)
   for(ctr,0,255) do
   (
     writeglobal(pal+ctr*3,readcolor(ctr,color:red))
     writeglobal(pal+1+ctr*3,readcolor(ctr,color:green))
     writeglobal(pal+2+ctr*3,readcolor(ctr,color:blue))
   )
 )

      while(1==1) do
begin
 dofade(time of day)
  wait (10)
    time of day:=time of day+1
if (time of day>>23),
   then (time of day:=0)
end




oh, i had some dumb death script set to each stepp.... duh
_________________
check out my bands at....

Doom Metal at www.soundclick.com/octoberscry

Progressive metal at www.soundclick.com/outercharm

You know you want to..... i'll be redoing october's cry songs soon.
Back to top
View user's profile Send private message Send e-mail
Moogle1
Scourge of the Seas
Halloween 2006 Creativity Winner
Halloween 2006 Creativity Winner



Joined: 15 Jul 2004
Posts: 3377
Location: Seattle, WA

PostPosted: Sun Jan 21, 2007 9:19 am    Post subject: Re: starting to work... Reply with quote

October's Cry wrote:
oh, i had some dumb death script set to each stepp.... duh


Um... okay, does it work when you don't die every time you take a step?

If you want to set an initial time of day only for newgame, you can do that before the line that says variable(ctr). Add a line that says "timeofday:=12" or whatever.

As far as it starting at "noon," there is no way to prevent that, since the engine will always load the default palette at first. It will flash noon before it changes to your timeofday. You can either ignore this or design your game in a way that loaded games start between 10:00am and 2:00pm, which all share the same palette as noon. Personally, I just wouldn't worry about it.

Other than that, set the wait(10) to something more reasonable and everything should be in order. Let me know if you have any other issues with this.
_________________
Back to top
View user's profile Send private message Visit poster's website AIM Address
msw188




Joined: 02 Jul 2003
Posts: 1041

PostPosted: Sun Jan 21, 2007 10:14 am    Post subject: Reply with quote

Are you allowing the player to save anywhere, or only at special locations (save points)? If it is the latter, I believe that we can work around the noon-time start. It would be nice if there was an 'after-menu script' option in custom for different maps that would be called every time the player exits their main menu...
_________________
My first completed OHR game, Tales of the New World:
http://castleparadox.com/gamelist-display.php?game=161

This website link is for my funk/rock band, Euphonic Brew:
www.euphonicbrew.com
Back to top
View user's profile Send private message Visit poster's website
TMC
On the Verge of Insanity




Joined: 05 Apr 2003
Posts: 3240
Location: Matakana

PostPosted: Sun Jan 21, 2007 8:28 pm    Post subject: Re: starting to work... Reply with quote

Moogle1 wrote:

As far as it starting at "noon," there is no way to prevent that, since the engine will always load the default palette at first. It will flash noon before it changes to your timeofday. You can either ignore this or design your game in a way that loaded games start between 10:00am and 2:00pm, which all share the same palette as noon. Personally, I just wouldn't worry about it.


Sure about that? I thought the script starts executing the tick before the screen fades in from black, so palette changes are hidden.
_________________
"It is so great it is insanely great."
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic    Castle Paradox Forum Index -> HELP! All times are GMT - 8 Hours
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group