Would it be possible to have a flag or several flags
setting the way collision with the empty party work ?
I like the way monsters are killed in csbwin.
Empty party not fragging monster
Moderator: Sophia
Forum rules
Please read the Forum rules and policies before posting.
Please read the Forum rules and policies before posting.
- Sophia
- Concise and Honest
- Posts: 4239
- Joined: Thu Sep 12, 2002 9:50 pm
- Location: Nowhere in particular
- Contact:
Re: Empty party not fragging monster
The engine already automatically kills monsters if they happen to occupy the same space as the party.
The only thing we need to do is change the collision detection for monsters to allow the party to move into their spaces.
Add this to your startup.lua (or whatever)
Then, place this at the bottom of your dungeon's objects.lua to make the monsters use the new collision function:
If you've written a fancier monster collision function already, you'll need to tweak the one I gave you, but you surely get the idea.
The only thing we need to do is change the collision detection for monsters to allow the party to move into their spaces.
Add this to your startup.lua (or whatever)
Code: Select all
function monster_frag_col(self, id, what)
-- No colliding inst means it's the party
if (not what) then
local empty = true
for ppos=0,3 do
if (dsb_ppos_char(ppos)) then
empty = false
end
end
if (empty) then
return false
end
end
-- Otherwise, handle things normally
if (self.nonmat) then
return nonmat_col(self, id, what)
end
return true
end
Code: Select all
for o in pairs(obj) do
local arch = obj[o]
if (arch.type == "MONSTER") then
arch.col = monster_frag_col
end
end