Author Topic: Time save  (Read 5650 times)

Agent 12

  • Zurvan Surfer (+2500)
  • *
  • Posts: 2572
    • View Profile
Time save
« Reply #15 on: November 19, 2005, 12:46:02 pm »
I think I'm gunna need more than 8....

2
2+4
2+4+8
2+8
4+8
2+4+8+10
2+10

see what I mean? I used to know the quick math formula to find out how many ways to take any amount of items out of 8 is but it seems like it's going to be ridiculously high.

--jp

JLukas

  • Fan Project Leader
  • Squaretable Knight (+400)
  • *
  • Posts: 426
    • View Profile
Time save
« Reply #16 on: November 19, 2005, 04:37:29 pm »
I'm trying to think this over, what are you trying to do specifically?  Can you give an example with only 2 chests to start, and then it can be exanded from there?

Something like this for example:

Crono walks into a room.  There are 3 treasure chests, and the player opens any they choose (or none at all).

Crono walks over and talks to a nearby NPC:

If 7F0054==0
.....NPC textbox: You didn't open any treasure chests.
.....Goto [offset]
NPC textbox: Let's see what treasure chests you've opened:
If 7F0054==02
.....NPC textbox: You opened chest 1!
If 7F0054==04
.....NPC textbox:  ...and you opened chest 2!
If 7F0054==08
.....NPC textbox: ..and you opened chest 3!

Agent 12

  • Zurvan Surfer (+2500)
  • *
  • Posts: 2572
    • View Profile
Time save
« Reply #17 on: November 19, 2005, 04:53:42 pm »
I see how that works for choosing one chest....it gets complicated when the player can pick and choose as many chest as they want...

Well what I need is a way to know when the room loads what chest had already been picked up, otherwise everytime they reload the location every chest will be closed and they can get infinite items

So there's 2 chest
Chest 1=2
chest 2=4

For me to check this in the Startup load it seems like I would have to do

if(7f0054==2)
  chest 2 was open
if(7f0054==4)
  chest 2 was opened
if(7f0050==6)
   chest 1 and 2 was opened

I see how this will work, it's just going to blow up exponentially with every chest I add because there's so many combinations

Like I think four chest will be:
1234
124
123
134
234
14
23
34
24
12
13
1
2
3
4

I'm just wondering if there's  cleaner way to do it.

--jp

JLukas

  • Fan Project Leader
  • Squaretable Knight (+400)
  • *
  • Posts: 426
    • View Profile
Time save
« Reply #18 on: November 19, 2005, 05:25:44 pm »
If all you need is a way to stop previously opened chests from being opened again, set the bit when the chest is opened, and have a startup command check if it is and drawstatus hide if it was already opened.

Perfect example in 014 Guardia Forest dead end, Object 12.  At offset 0608 you can see the game set the bit when the chest is opened.  In startup at offset 05FB it checks that bit, if it is set, the chest is simply not there (btw the 05FB is off by 100 in the 7F0xxx address, that's because of the event command 16 bug)

Agent 12

  • Zurvan Surfer (+2500)
  • *
  • Posts: 2572
    • View Profile
Time save
« Reply #19 on: November 19, 2005, 08:15:25 pm »
So every single chest has it's on memory address?  So it should be more like this

Chest 1=7F0054
Chest 2=7F0056

(chest 1 activate)
   set 7F0054

(chest 2 activate)
   set 7F0056

Startup load
  if(7f0054==1)
     hide chest


I guess maybe I was trying to be to efficient with memory...

--jp

JLukas

  • Fan Project Leader
  • Squaretable Knight (+400)
  • *
  • Posts: 426
    • View Profile
Time save
« Reply #20 on: November 19, 2005, 08:32:04 pm »
No, each chest has its own bit.  You can have up to 8 different chests in 1 memory address byte.

Example:

If you take a look at the Guardia Forest dead end Object 12 again, you see it uses bit 20 in 7F01D1

01
02
04
08
10
20 - used
40
80

You have 7 free bits for other chests.

Copy and paste entire Object 12 so you have a another copy.  Change the startup check and set bit commands in the new Object to use bit 40 instead.  Also change the X and Y coords so the chests aren't directly over each other.  You now have 2 chests that both disappear when opened (and don't appear on the map the next time you enter the area.

In other words, you can have 8 copies of that object with just different X Y coords, set and check bit commands to have 8 different chests, all of which are only able to be opened once.

JLukas

  • Fan Project Leader
  • Squaretable Knight (+400)
  • *
  • Posts: 426
    • View Profile
Time save
« Reply #21 on: November 19, 2005, 09:20:58 pm »
Example pic:



Chest on the left uses bit 10, chest on the right uses the original bit 20.

I open a chest, it disappears, and it's gone forever.  The other chest is not affected.

What if you only wanted the player to pick one of the two? (Ex:  the Nu in the Forest pyramid that makes you choose only one reward)

You give the chest the same set bit and bit check.  Once a chest is open, they're both gone the next time you enter the area (there's a little bit more involved, but that's the general idea)

Agent 12

  • Zurvan Surfer (+2500)
  • *
  • Posts: 2572
    • View Profile
Time save
« Reply #22 on: November 22, 2005, 03:32:18 am »
Sorry it took so long, but just so you know I was able to do it.

I didn't realize each memory address stored 8 bytes that why I was so confused.  Thanks for being so patient.

Here's the pseudocode for anyone interested in doing a chest

startup/idle

set Object Coord  //at chest area
if(MemorySpotOfChest && Bit)
  Copy Tiles from open chest on map (put in corner)
  remove this object

Activate

ExploreMode Off
Copy Tiles as before
7f0200==Index of Item
"you got {item}"
BitMath(MemorySpotOfChest, Bit, Set)
ExploreMode On


--jp