dsb_party_coords() and sys_enter_level()...?

This forum is for the Lua scriptable clone of DM/CSB called Dungeon Strikes Back by Sophia. Use DSB to build your own highly customised games.

Moderator: Sophia

Forum rules
Please read the Forum rules and policies before posting. You may Image to help finance the hosting costs of this forum.
Post Reply
User avatar
Gambit37
Should eat more pies
Posts: 13769
Joined: Wed May 31, 2000 1:57 pm
Location: Location, Location
Contact:

dsb_party_coords() and sys_enter_level()...?

Post by Gambit37 »

This really simple function override does some very odd things:

Code: Select all

function sys_enter_level(level)
	local lev, px, py, pface = dsb_party_coords()
	dsb_write({222, 222, 222}, lev)
end
If I start on level 0, it writes 0.
When I go to level 1, it writes 0 again.
Returning to level 0, it writes 1.

I've tested this across multiple levels and it gets completely out of sync.

Why isn't dsb_party_coords() updating the current level correctly? Or am I doing something wrong?

(Also notice this when called in other functions, such as sys_game_load().)
User avatar
Sophia
Concise and Honest
Posts: 4306
Joined: Thu Sep 12, 2002 9:50 pm
Location: Nowhere in particular
Contact:

Re: dsb_party_coords() and sys_enter_level()...?

Post by Sophia »

The value of lev returned by dsb_party_coords is correct for that instant but seems strange, because sys_enter_level is called just before the party is actually moved into the new level. For the most part this isn't an issue because it takes the new level as a parameter, so you know what level the party is actually (about to be) on.
User avatar
Gambit37
Should eat more pies
Posts: 13769
Joined: Wed May 31, 2000 1:57 pm
Location: Location, Location
Contact:

Re: dsb_party_coords() and sys_enter_level()...?

Post by Gambit37 »

Ok, i tested the parameter and that does seem more reliable, so I'll use that instead. 🙂
Post Reply