Manipulating Time.

Error message

  • Notice: Trying to access array offset on value of type int in element_children() (line 6595 of /var/www/pied-piper.ermarian.net/includes/common.inc).
  • Notice: Trying to access array offset on value of type int in element_children() (line 6595 of /var/www/pied-piper.ermarian.net/includes/common.inc).
  • Notice: Trying to access array offset on value of type int in element_children() (line 6595 of /var/www/pied-piper.ermarian.net/includes/common.inc).
  • Notice: Trying to access array offset on value of type int in element_children() (line 6595 of /var/www/pied-piper.ermarian.net/includes/common.inc).
  • Deprecated function: implode(): Passing glue string after array is deprecated. Swap the parameters in drupal_get_feeds() (line 394 of /var/www/pied-piper.ermarian.net/includes/common.inc).
AuthorTopic: Manipulating Time.
Shaper
Member # 3442
Profile Homepage #0
I have a problem. The plot of my scenario (which is coming on well btw) demands that the game is dark. Basically, the sun has been shrouded so that the baddie can get his minions up onto the surface.

Now, in order to achieve this, I used:

set_ticks_forward(-1)

as is done in Babysitting. This worked, in that it was always evening. However, I soon found a problem.

Should the player use a special ability, they would never be able to use it again. This was bad, but workable. I could say that the evil magic blocking the sun stops their skills recharging.

Then, though, another problem emerged. My scenario needed the party to have a special item to finish it. Since this item was only obtainable after baddies attacked a fort ON DAY 3, it couldn't be finished. Oops.

So, using a timer in the scenario Start_state, I tried to get a variable to count up to 5000, where it would set_ticks_forward(5000) (a day), and reset the timer. At first, the thing skipped a day each turn, and then nothing at all.

I've also tried using two SDFs to act as a counter, setting the clock forward after both equalled a certain number. No luck.

It's vital that the action takes place in the dark, so any ideas? If not, I'll have to scrap the thing, something I'm not overly keen about.

[ Tuesday, August 10, 2004 07:23: Message edited by: SupaNik ]

--------------------
And when you want to Live
How do you start?
Where do you go?
Who do you need to know?

Posts: 2864 | Registered: Monday, September 8 2003 07:00
Shaper
Member # 22
Profile #1
Might want to post the script - I would imagine there's something wrong with your coding.
Posts: 2862 | Registered: Tuesday, October 2 2001 07:00
Off With Their Heads
Member # 4045
Profile Homepage #2
You could tick off the box that it's taking place in the caves, which are dark, and put surface terrain anyway. I think this would accomplish the same thing, although I haven't tried it.

--------------------
Arancaytar: Every time you ask people to compare TM and Kel, you endanger the poor, fluffy kittens.
Smoo: Get ready to face the walls!
Ephesos: In conclusion, yarr.

Kelandon's Pink and Pretty Page!!: the authorized location for all things by me
The Archive of all released BoE scenarios ever
Posts: 7968 | Registered: Saturday, February 28 2004 08:00
Warrior
Member # 4202
Profile Homepage #3
Outdoors, you'd get the wrong kind of walls. Also, the background sounds would be wrong.

[ Tuesday, August 10, 2004 12:22: Message edited by: Isaac ]

--------------------
Creator of the 3D Blades of Avernum Editor for Mac. Get it at Ingenious Isaac's Illusion, my web page. Better yet, get Battle for Wesnoth, a wonderful free TBS game.
Posts: 192 | Registered: Sunday, April 4 2004 08:00
Infiltrator
Member # 148
Profile #4
The caves aren't dark. They have perpetual lighting. True, it isn't as bright as the surface, but by no means is it dark.

--------------------
My ego is bigger than yours.
Posts: 480 | Registered: Thursday, October 11 2001 07:00
Off With Their Heads
Member # 4045
Profile Homepage #5
Er, dark in the sense of night dark, not dark in the sense of making town dark so you need to cast the Light spell in order to see more than a square away dark.

It's annoying that we can't mess with outdoor terrain details nearly as much as we can with town details. I hadn't noticed that (because I've hardly touched outdoor terrains yet).

--------------------
Arancaytar: Every time you ask people to compare TM and Kel, you endanger the poor, fluffy kittens.
Smoo: Get ready to face the walls!
Ephesos: In conclusion, yarr.

Kelandon's Pink and Pretty Page!!: the authorized location for all things by me
The Archive of all released BoE scenarios ever
Posts: 7968 | Registered: Saturday, February 28 2004 08:00
Agent
Member # 2820
Profile #6
The outdoors are very rigid compared to Towns, I'm afraid.

What you are proposing seems like a good idea, but there is probably some error in your implementation. You should also realize the problem this would cause with monsters scripts before you get too wrapped up in this.

[ Tuesday, August 10, 2004 16:35: Message edited by: Garrison ]

--------------------
Thuryl: I mean, most of us don't go around consuming our own bodily fluids, no matter how delicious they are.
====
Alorael: War and violence would end if we all had each other's babies!
====
Drakefyre: Those are hideous mangos.
Posts: 1415 | Registered: Thursday, March 27 2003 08:00
The Establishment
Member # 6
Profile #7
The abilities I am not sure. But you could track time artificially using flags by just incrementing them all the time. Three flags will allow you to track for 3125 days, ample time to finish the scenario.

--------------------
Your flower power is no match for my glower power!
Posts: 3726 | Registered: Tuesday, September 18 2001 07:00
Infiltrator
Member # 148
Profile #8
... How do 3 flags give you 3125 days?

--------------------
My ego is bigger than yours.
Posts: 480 | Registered: Thursday, October 11 2001 07:00
Off With Their Heads
Member # 4045
Profile Homepage #9
I was thinking you could use flags as digits in a base-256 system (ie increment a flag until it got to 255, then increment the other flag by one and reset the first flag to 0), which would get you something like 64 million ticks with two flags. How *i came up with 3125, I don't know, though.

EDIT: Ach, too many zeros. Keep's right: 2^16 is about 64 thousand, not million.

[ Tuesday, August 10, 2004 16:42: Message edited by: Kelandon ]

--------------------
Arancaytar: Every time you ask people to compare TM and Kel, you endanger the poor, fluffy kittens.
Smoo: Get ready to face the walls!
Ephesos: In conclusion, yarr.

Kelandon's Pink and Pretty Page!!: the authorized location for all things by me
The Archive of all released BoE scenarios ever
Posts: 7968 | Registered: Saturday, February 28 2004 08:00
Agent
Member # 2820
Profile #10
64 million with 2 flags??? More like around 65000. But 3 flags gives you around 16 million (the average amount of colors a modern monitor can display), and that divided by 5000 yields about 3300 days, I think.

--------------------
Thuryl: I mean, most of us don't go around consuming our own bodily fluids, no matter how delicious they are.
====
Alorael: War and violence would end if we all had each other's babies!
====
Drakefyre: Those are hideous mangos.
Posts: 1415 | Registered: Thursday, March 27 2003 08:00
The Establishment
Member # 6
Profile #11
Duh, for some reason I used 250 as the value for a flag. Either way, you get over 3000 days.

--------------------
Your flower power is no match for my glower power!
Posts: 3726 | Registered: Tuesday, September 18 2001 07:00
Shaper
Member # 3442
Profile Homepage #12
quote:
Originally written by Garrison:

The outdoors are very rigid compared to Towns, I'm afraid.

What you are proposing seems like a good idea, but there is probably some error in your implementation. You should also realize the problem this would cause with monsters scripts before you get too wrapped up in this.

Errr... problems with monster scripts? What do you mean?

And I tried the SDF trick, but no luck. Does
(set_ticks_forward(-1))
cease all ticks, effectively stopping the timer?

The way I implemented the sdf counter was to use (inc_flag(0,1,1))
in the scenario files start_state. Then, I stuck in a
if(get_flag(0,1) == 255)
{ inc_flag(0,2,1);
}

Finally, I used a
(if(get_flag(0,1) == 1) && if(get_flag(0,2) == 250) {

set_ticks_forward(5000) (i.e. a day).

But no cigar.

I'd love to post the script, but it's not on this computer, so I can't. If all else fails though, it looks like I'll have to adapt the plot so the darkness is more like that in LotR: The Return of the King film, in that day exists, it's just slightly darker. It's all I can do.

--------------------
And when you want to Live
How do you start?
Where do you go?
Who do you need to know?

Posts: 2864 | Registered: Monday, September 8 2003 07:00
Agent
Member # 2820
Profile #13
Don't forget that many things like traps and monster scripts rely on the ticks to time their events. You'll need to refer all of these scripts to the SDFs you plan to use. A time consuming task, but if you need to do it for you scenario, go ahead.

--------------------
Thuryl: I mean, most of us don't go around consuming our own bodily fluids, no matter how delicious they are.
====
Alorael: War and violence would end if we all had each other's babies!
====
Drakefyre: Those are hideous mangos.
Posts: 1415 | Registered: Thursday, March 27 2003 08:00