

For passive wandering monsters, I think it would work to spawn a new critter on their death, so if the party kills them by walking into them, a new one is generated behind the party. Might work, I'll test it out.
Moderator: Sophia
It seems like the easiest way to handle this would be to treat the square as a wall but tell not actually draw a wall. I'll figure out the best way to make that approach work.Gambit37 wrote:Is there a way of preventing items being placed on tiles containing a pillar? With large pillars, it looks really weird that items sit on top of them when really there wouldn't be enough room.
Ceiling first, then the floor.Gambit37 wrote:For wallsets, which is drawn first: the ceiling or the floor?
Code: Select all
dsb_export("snp_data")
snp_data = {
sound_feet = 0,
sound_ambient = 0
}
Code: Select all
snp_data = {
sound_feet = snd.feet_on_stone
sound_ambient = snd.ambient_wind
}
Code: Select all
PROGRAM CRASH!
Location: 10 10 19
Reason: FMOD error 36
An invalid parameter was passed to this function.
Stack Dump:
DSBmain
DSBgameloop
run_timers
lua.dsb_3dsound
play_3dsound
Code: Select all
snd.feet_stone = { } -- Declare it as a table
for num=1,4 do
snd.feet_stone[num] = dsb_get_sound("FEET_ROCK" .. num, path .. "FTROC_P" .. num .. ".wav")
end
function snd_footsteps(sound)
local lev, x, y, face = dsb_party_coords()
dsb_delay_func(1, function() dsb_3dsound(sound[dsb_rand(1, 4)], lev, x, y) end)
end
function h_party_move(have_party, delay)
snd_footsteps(snp_data.sound_feet)
return delay
end
Code: Select all
snp_data.sound_feet = "feet_on_stone"
Code: Select all
function snd_footsteps(sound_name)
local sound = snd[sound_name]
local lev, x, y, face = dsb_party_coords()
dsb_delay_func(1, function() dsb_3dsound(sound[dsb_rand(1, 4)], lev, x, y) end)
end
Code: Select all
function expire_after_delay(arch, id)
local exp_delay = arch.expire_delay
if (exvar[id] and exvar[id].expire_delay) then
exp_delay = exvar[id].expire_delay
end
dsb_msg(exp_delay, id, M_EXPIRE, 0)
end
Code: Select all
-- instances of my_obj will receive an expire message after 20 ticks
obj.my_obj.on_init = expire_after_delay
obj.my_obj.expire_delay = 20
obj.my_obj.on_expire = do_something_else
Code: Select all
stat = {STAT_DEX, STAT_WIS, STAT_STR},
stat_up = {10,20,30}
Code: Select all
(arch definition)
on_move = handle_move
(end arch definition)
function handle_move(arch,id,group_leader)
monster_step(arch, id, group_leader)
... more code ....
end
Yes, that is perfectly fine.Gambit37 wrote:How do I add extra stuff to functions attached to a monster, such as on_die=setup_food_drop or on_move=monster_step?
Is it simply ok to move that function call into my custom function and call that instead
Yes, or write your own with a wrapper like you did there.Gambit37 wrote:What if I wanted to modify *every* monsters on_move code so that every monster has something extra happen when they move? Do I just copy the function from base code and modify it?
Code: Select all
orig_monster_step = monster_step
function monster_step(self, id, group_leader)
-- Your code here
orig_monster_step(self, id, group_leader)
-- Put more code here
end
The cleanest way is probably to write your own h_monster_died. Take a look at base/hooks.lua.Gambit37 wrote:Also, how would I add extra features to every monster's death -- would I need to copy all those setup_drop functions and add my features in there or is there a cleaner way?
The timer counts ticks, not frames or anything like that. So you'll have to set it to a high enough number depending on how many ticks each frame of your animation lasts.Gambit37 wrote:Finally, I noticed the animation_timer in ESB. How does this work, and can I set it in code? For example, is it something I can set when a monster spawns to make sure it's timers dont't match other critters?
It's just dsb_set_flyreps(id, repetitions), where id must be an instance that is currently flying through the air. It will then execute its flying code repetitions times every time it updates. The default value is 1, of course, but setting it to a higher value will make fast or "instant hit" missiles.Gambit37 wrote:Also, you previously mentioned changing the speed of spells and missiles using dsb_set_flyreps(). It's listed in the Wiki, but with no details, and I can't find an example anywhere in the base code -- could you provide some info on how to do this and I'll update the Wiki?
That would be really useful. Otherwise, I imagine the best way of using it would be to call dsb_set_flyreps() through an arch property like on_spawn?I was going to add a flyreps property to object archs (or maybe attack methods?) to make this easier to invoke as part of the base code