Page 1 of 1
DSB and CSB finalization
Posted: Wed Oct 31, 2007 11:20 am
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...
Re: DSB and CSB finalization
Posted: Wed Oct 31, 2007 11:26 am
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 ?
Posted: Wed Oct 31, 2007 12:20 pm
by Joramun

Don't be mad at me
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.
Re: DSB and CSB finalization
Posted: Wed Oct 31, 2007 4:08 pm
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...
Posted: Wed Oct 31, 2007 5:42 pm
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.
Posted: Wed Oct 31, 2007 6:00 pm
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)
Posted: Wed Oct 31, 2007 7:13 pm
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.
Posted: Wed Oct 31, 2007 7:15 pm
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.
Posted: Wed Oct 31, 2007 7:41 pm
by Joramun
Hmm, I thought those solutions, but I was looking for a more standard and innocuous way to do that...