DSB and CSB finalization

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.
Post Reply
User avatar
Joramun
Mon Master
Posts: 925
Joined: Thu May 25, 2006 7:05 pm
Location: The Universe

DSB and CSB finalization

Post by Joramun »

DM :
The ending was already in, in the fuse method !
Sophia, can you add a call to dsb_endgame() after the end of the fuse animation in the base code ?

CSB :
I'll add the endgame_pad functionality...
It will actually just be a trigger with :
exvar[trig].func = dsb_delay_func( 100,dsb_endgame() )

I don't see the point in adding the corresponding archtype or modifying RTSB just for that feature though.
If someone ask for it, I'll modify RTSB, but not just for me...
What Is Your Quest ?
User avatar
linflas
My other avatar is gay
Posts: 2445
Joined: Tue Nov 04, 2003 9:58 pm
Location: Lille, France
Contact:

Re: DSB and CSB finalization

Post by linflas »

Joramund wrote:DM :
The ending was already in, in the fuse method !
Sophia, can you add a call to dsb_endgame() after the end of the fuse animation in the base code ?
if that is done in the base code, then fusing some lord chaos in a custom dungeon will mean end of game all the time ! and if you want to have *something* after lord chaos fusing ?
User avatar
Joramun
Mon Master
Posts: 925
Joined: Thu May 25, 2006 7:05 pm
Location: The Universe

Post by Joramun »

:cry: Don't be mad at me :cry:

Ok, then, I need to find a work around... creating a whole new lordchaos seems a bit of overdoing it, though.

Maybe : just add an exvar "endboss", and check for the exvar to be true in the fuse method...

That makes me think about something :
Is it possible to define "generic hooks" ?
For example, when a system hook like "on_die" is called,
To have in startup.lua something like :
global_hooks.on_die=func(id,arch)
And the function to be called everytime such a hook is called, whatever the archetype...
If I'm not making any sense or if it has some consequences I do not foresee, just stop me.
What Is Your Quest ?
User avatar
Joramun
Mon Master
Posts: 925
Joined: Thu May 25, 2006 7:05 pm
Location: The Universe

Re: DSB and CSB finalization

Post by Joramun »

Ok I had a bug, so I changed the line into that :
Joramund wrote:DM :
exvar[trig].func = dsb_game_end
First : because with parenthesis, it results in immediate execution of the function, and the exvar is just set to the return value of dsb_game_end()

Second : I could have done :

exvar[trig] = { func= dsb_delay_func , func_data = { 100, dsb_game_end } }

But I wasn't sure it would work anyway...
What Is Your Quest ?
User avatar
Sophia
Concise and Honest
Posts: 4240
Joined: Thu Sep 12, 2002 9:50 pm
Location: Nowhere in particular
Contact:

Post by Sophia »

Most of the role of these "generic" functions you mention is carried out by various sys_ functions. For example, when any monster dies, sys_kill_monster is called.

Or is that not what you meant?

Anyway, Linflas is right, adding the endgame right into the fuse animation seems to restrict flexibility. This is why I just added the function call for the time being, so we could figure out the best way to actually use it in practice.
User avatar
Joramun
Mon Master
Posts: 925
Joined: Thu May 25, 2006 7:05 pm
Location: The Universe

Post by Joramun »

About CSB : well, the 'func' exvar works fine.

About DM :
I need to find a way to throw the end of the game once lordchaos is dead.

Generic functions :
I'm not sure we're talking exactly about the same thing :
At least two functions are called when a monster dies :
- sys_kill_monster (for all monster archtypes)
- on_die (for specified monster archtypez)
What I would have, is at least one or two other ways to call functions when a given monster dies :
- a hook for a function defined for a specified monster instance
- a hook for a function like sys_kill_monster, but not meant to override it, just to do additional stuff.
(This reasoning can apply to any archtype and event in the game, not just a monster death)
What Is Your Quest ?
Remy
Craftsman
Posts: 111
Joined: Wed Sep 05, 2007 5:24 pm
Contact:

Post by Remy »

- a hook for a function like sys_kill_monster, but not meant to override it, just to do additional stuff.
You know, there's nothing wrong with overriding the base functions. The easy way to override and still get all the old functionality is to assign the old function to a variable before creating your new override.
For example, this code will override sys_kill_monster without having to rewrite everything the old function did.

Code: Select all

old_kill_monster = sys_kill_monster   --set old sys_func to variable
function sys_kill_monster(id)
     old_kill_monster(id)     --call old sys_func
     -- Insert your code here ---  
     -- For example: 
     -- dsb_write(debug_color, "DIE MONSTER DIE!")
end
Just Copy/Paste that into your startup.lua, replace the comments with your code, and bingo.
User avatar
Parallax
DMwiki contributor
Posts: 424
Joined: Mon Aug 28, 2006 7:56 pm
Location: Back in New Jersey

Post by Parallax »

If you are looking for just one particular instance of a certain archetype to die, you can either:
- Make that monster a different archetype, that is just like the original archetype, but with its own on_die event OR
- Preface the on_die function with
if id=Special_Monster_735_Mr_Snowflake then
and handle your special case from there.
User avatar
Joramun
Mon Master
Posts: 925
Joined: Thu May 25, 2006 7:05 pm
Location: The Universe

Post by Joramun »

Hmm, I thought those solutions, but I was looking for a more standard and innocuous way to do that...
What Is Your Quest ?
Post Reply