How to... ?

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.
User avatar
Sophia
Concise and Honest
Posts: 4306
Joined: Thu Sep 12, 2002 9:50 pm
Location: Nowhere in particular
Contact:

Re: How to... ?

Post by Sophia »

Joramun wrote:I'm using the fixed dsb0.46 exe
Apparently the fix needed it a fix. :D It should work now.
Mon Ful Ir wrote:It turns all the torches in the dungeon into soaked torches. How can I restrict it just to torches the party is carrying or has in its inventory?

Code: Select all

for id in dsb_insts() do
   local lev = dsb_get_coords(id)
   if (lev == CHARACTER or lev == MOUSE_HAND) then
      local idarch = dsb_find_arch(id)
      if (idarch.class == "TORCH") then
         dsb_swap(id, "torch_soaked")
      end
   end
end
In DSB, object instances that aren't in the dungeon are assigned a negative level with a special meaning: IN_OBJ for items inside of things, CHARACTER for inventory items, MOUSE_HAND for whatever is in the mouse hand, and LIMBO for stuff that is just floating around in space. This means that the way this code is currently implemented, torches inside of containers that the party is carrying still won't get soaked, because they are IN_OBJ and not in the inventory of a CHARACTER. However, I see this as an advantage. :)
Mon Ful Ir wrote:I'm afraid there's something wrong with my altar of depetrifaction and I can't tell what it is. :\ Can you tell why it doesn't bring a petrified character back to life?
I can't tell either, because it seems like an exact copy of a vi alcove. Is there some reason you've copied everything, instead of just using clone_arch? I added the revive_class property to allow easier cloning of the alcove. Try replacing all of your alcove code with this; it's simpler and might get rid of any bugs introduced through mistakes in copying/pasting/editing:

Code: Select all

obj.alcove_petrif = clone_arch(obj.alcove_vi, {
   revive_class = "PETRIF"
} )
Mon Ful Ir
Adept
Posts: 221
Joined: Sat Jan 07, 2006 1:54 am
Location: Britain

Re: How to... ?

Post by Mon Ful Ir »

Fantastic! Thank you very much, Sophia, that's fully solved both code issues.
Mon Ful Ir
Adept
Posts: 221
Joined: Sat Jan 07, 2006 1:54 am
Location: Britain

Re: How to... ?

Post by Mon Ful Ir »

(removed -- please use a later file version)

Changelog:
* Underwater code: Torches in the party's hands and inventory are now soaked by going underwater.
* Petrifaction code: Cockatrices and basilisks now petrify characters by touch.
* Altar of depetrifaction: This now returns a petrified character to life.
* New monster: Wyvern. (Not yet added to sample dungeon, but available to add.)
* New thing: Weapon: Trident.
* New thing: Weapon: Halberd.
* New special attack: Shadows now drain strength.
* Various code changes to monsters (ongoing project).
Last edited by Mon Ful Ir on Sun Dec 12, 2010 12:12 am, edited 1 time in total.
User avatar
Sophia
Concise and Honest
Posts: 4306
Joined: Thu Sep 12, 2002 9:50 pm
Location: Nowhere in particular
Contact:

Re: How to... ?

Post by Sophia »

I like what you've done. It's a good showcase of some of the new features of DSB.

If I can offer some minor criticism, not all of the graphics mesh together. For example, the art styles don't all line up. There are also some visual oddities like the skeleton side image really should be smaller than the front view, because it looks odd as-is. These are not huge things though. An underwater bitmap with some nearly-transparent blue might look better, but if you don't know how to create bitmaps with alpha I can understand that you'd not be able to do this. :)
User avatar
Sophia
Concise and Honest
Posts: 4306
Joined: Thu Sep 12, 2002 9:50 pm
Location: Nowhere in particular
Contact:

Re: How to... ?

Post by Sophia »

While looking around at some other code, I came across an explanation of how Quake 1 did its "underwater distortion" effect. So, of course I couldn't resist messing around with some more stuff and adapting this for DSB.

If you want to enhance the underwater effect a bit, grab this new version of DSB.exe, and then modify your sys_enter_level as follows:

Code: Select all

function sys_enter_level(level)
   if (level == 1) then
      dsb_set_condition(PARTY, C_UNDERWATER, 10)
      dsb_viewport_distort(DISTORTION_UNDERWATER) -- New Line
      g_water_channel = dsb_sound(snd.water, true)
      for id in dsb_insts() do
         local lev = dsb_get_coords(id)
         if (lev == CHARACTER or lev == MOUSE_HAND) then
            local idarch = dsb_find_arch(id)
            if (idarch.class == "TORCH") then
                 dsb_swap(id, "torch_soaked")
            end
         end
      end
   else
      dsb_set_condition(PARTY, C_UNDERWATER, 0)
      dsb_viewport_distort(DISTORTION_NONE) -- New Line
      if (g_water_channel) then
         dsb_stopsound(g_water_channel)
         g_water_channel = nil
      end
   end
end
These constants will be defined in the next version of base code, but since they're not, add the following to startup.lua:

Code: Select all

DISTORTION_NONE = 0
DISTORTION_UNDERWATER = 1
Now it really looks underwater. :D
User avatar
Gambit37
Should eat more pies
Posts: 13768
Joined: Wed May 31, 2000 1:57 pm
Location: Location, Location
Contact:

Re: How to... ?

Post by Gambit37 »

See, things like this are the convincers to switch to DSB :-) I love me some visual candy :)
Mon Ful Ir
Adept
Posts: 221
Joined: Sat Jan 07, 2006 1:54 am
Location: Britain

Re: How to... ?

Post by Mon Ful Ir »

Sophia wrote:I like what you've done. It's a good showcase of some of the new features of DSB.
What I've done? You've done an awful lot of it!
Sophia wrote:If I can offer some minor criticism, not all of the graphics mesh together. For example, the art styles don't all line up. There are also some visual oddities like the skeleton side image really should be smaller than the front view, because it looks odd as-is.
Yeah, that's absolutely fair and true. I've been doing this quickly, and the graphics are adapted from various different games, each of which was visually a bit different. I've shrunk the skeleton side view for the next release, but it's not going to be 100% perfect, and some re-users might want to leave out certain aspects of the library, or re-draw some things.

There's a benefit of the "open-source" type approach I'm using, though. I hope that if re-users of this material improve any aspect of it, they will be willing to share their improved versions with the community!

Thank you for the improved underwater graphics code. It certainly looks good. :)

I think that at the moment, the thing we most need for this package is the "water breathing" effect. Any advice on how to achieve it?
User avatar
Gambit37
Should eat more pies
Posts: 13768
Joined: Wed May 31, 2000 1:57 pm
Location: Location, Location
Contact:

Re: How to... ?

Post by Gambit37 »

In one of the experiments I did for different magic runes, I used letters to spell out 3 letter spells (similar to "Sorcery!"). "GIL" would have been a spell to allow the party to breathe underwater :-) I never did get the mechanics in RTC right though...
Mon Ful Ir
Adept
Posts: 221
Joined: Sat Jan 07, 2006 1:54 am
Location: Britain

Re: How to... ?

Post by Mon Ful Ir »

mfi_dungeon 10.12.10

Changelog
* Various code changes to monsters (ongoing project).
* Introduced visual distortion while underwater.
* Wight graphics seem to have disappeared in a recent update; fixed now.
* Several new monsters now drop appropriate items on death.
* Several monsters have new sounds.
* New monster: Carrion crawler (with paralyzing attack).
* New thing: Hat. (A wizard's pointy hat with a small WIS boost.)
* New things: 13 different kinds of book. With a little code, these can enable new spells or effects, contain clues, hints or backstory, etc.
* Art style tweaks to beholder, mind flayer, xorn, kobold and gnoll.
User avatar
Sophia
Concise and Honest
Posts: 4306
Joined: Thu Sep 12, 2002 9:50 pm
Location: Nowhere in particular
Contact:

Re: How to... ?

Post by Sophia »

Mon Ful Ir wrote:You've done an awful lot of it!
Well, I'm glad to help. :D
Mon Ful Ir wrote:I think that at the moment, the thing we most need for this package is the "water breathing" effect. Any advice on how to achieve it?
This will require some hefty rewriting of the "underwater" code, I think. Instead of tracking a "strength" value for the party as a whole (which denotes the full party's air supply) we can use a ch_exvar associated with each character. We'll initialize it by adding a go_underwater function that takes a true/false parameter that controls whether we're surfacing or diving. This call can replace the initialization of the condition and the viewport stuff in sys_enter_level:

Code: Select all

function go_underwater(under)
   -- Set up the condition and distortion
   local cond_val = 0
   local distort_val = 0
   if (under) then
      cond_val = 1
      distort_val = DISTORTION_UNDERWATER
   end
   dsb_set_condition(PARTY, C_UNDERWATER, cond_val)
   dsb_viewport_distort(distort_val) 
 
   -- Trigger the underwater sound
   if (under) then
      g_water_channel = dsb_sound(snd.water, true)
   else
      if (g_water_channel) then
         dsb_stopsound(g_water_channel)
         g_water_channel = nil
      end
   end

   -- Give everyone an air supply
   for ppos=0,3 do
      local char = dsb_ppos_char(ppos)
      if (valid_and_alive(char)) then
         use_ch_exvar(char)
         ch_exvar[char].air_supply = 20
      end
   end
end

Code: Select all

function sys_enter_level(level)
   if (level == 1) then
      go_underwater(true)
      for id in dsb_insts() do
         local lev = dsb_get_coords(id)
         if (lev == CHARACTER or lev == MOUSE_HAND) then
            local idarch = dsb_find_arch(id)
            if (idarch.class == "TORCH") then
                 dsb_swap(id, "torch_soaked")
            end
         end
      end
   else
      go_underwater(false)
   end
end
Here's the new underwater_air_func. Note that we don't care about strength any more (and just return it as-is) because individual party members have their own air_supply value.

Code: Select all

function underwater_air_func(strength)
   for ppos=0,3 do
      local char = dsb_ppos_char(ppos)
      if (valid_and_alive(char)) then
         local air_supply = ch_exvar[char].air_supply - 1
         if (air_supply == 0) then
            dsb_write(system_color, dsb_get_charname(char) .. " HAS DROWNED!")
            dsb_set_bar(char, HEALTH, 0)
         else
            ch_exvar[char].air_supply = air_supply
         end
      end
   end
   return strength
end
Now we can add a C_WATERBREATHING condition, that is set when the proper spell is cast, potion is drunk, or whatever else. It simply maximizes their air supply and then reduces its strength by one.

Code: Select all

function waterbreathing_func(who, strength)
   use_ch_exvar(who)
   ch_exvar[who].air_supply = 20
   return strength - 1
end
C_WATERBREATHING = dsb_add_condition(INDIVIDUAL, nil, nil, 5, waterbreathing_func)
I'm not at my development PC at the moment so I can't test this code. I hope it works. :) Even if not, it should be a good start...
Mon Ful Ir
Adept
Posts: 221
Joined: Sat Jan 07, 2006 1:54 am
Location: Britain

Re: How to... ?

Post by Mon Ful Ir »

Woohoo, post #100!

So as to test this, I decided to set up C_WATERBREATHING as a method on the trident. So I wrote into attacks.lua:

Code: Select all

method_info.WATERBREATHING = {
	    xp_class = CLASS_PRIEST,
	    xp_sub = SKILL_SHIELDS,
	    xp_get = 35,
	    idleness = 10,
	    stamina_used = 2,
            shield_type = C_WATERBREATHING
}
And I amended the trident in objects.lua to read:

Code: Select all

obj.trident = {
    name="TRIDENT",
    type="THING",
    class="WEAPON",
    mass=39,
    icon=gfx.thing_icon_trident,
    dungeon=gfx.thing_dungeon_trident,
	flying_away=gfx.thing_dungeon_trident,
	flying_toward=gfx.thing_dungeon_trident,
	flying_side=gfx.thing_dungeon_trident,
	methods = {
	    { "JAB", 0, CLASS_FIGHTER, method_physattack },
	    { "THRUST", 5, { CLASS_FIGHTER, SKILL_STABBING }, method_physattack },
	    ( "WATERBREATHING", 3, { CLASS_PRIEST, SKILL_SHIELDS }, method_shield }
	},
	base_range=10,
	base_tpower=50,
	impact=28,
	fit_sheath=true
}
Unfortunately it returns me a FATAL LUA ERROR: attacks.lua:120: unexpected symbol near '='

Somehow I've got the syntax wrong but I'm afraid I can't see why? Line 120 is the very first one of the first piece of code (the one that reads "method_info.WATERBREATHING = {")
User avatar
Sophia
Concise and Honest
Posts: 4306
Joined: Thu Sep 12, 2002 9:50 pm
Location: Nowhere in particular
Contact:

Re: How to... ?

Post by Sophia »

Mon Ful Ir wrote:Somehow I've got the syntax wrong but I'm afraid I can't see why? Line 120 is the very first one of the first piece of code (the one that reads "method_info.WATERBREATHING = {")
Sometimes glitches like this happen because of something on the previous line. Maybe if you could paste a little context from what is immediately before that in the file (like from about line 115 or so) I can help, because the code looks fine to me from that point onward, too.

As an aside, you don't need to specify any flying_* bitmaps if they're the same as the default dungeon one. DSB will automatically use the standard dungeon bitmap you don't specify anything for flying.

The shield code contains lots of oddities (such as spawning shield_controllers) that might make it a little overkill just for setting C_WATERBREATHING. It's good for a test, though. For a potion, you could also look into writing a potion_effect function.
Mon Ful Ir
Adept
Posts: 221
Joined: Sat Jan 07, 2006 1:54 am
Location: Britain

Re: How to... ?

Post by Mon Ful Ir »

Ah! Yes, that was the problem: I had an errant comma on the previous line. Fixed now, thank you.

I changed the shielding code to CLASS_WIZARD, SKILL_AIR, method_light (which is convenient because it stops you having to cast all those light spells before venturing underwater), and it seems to work.

However, I'm afraid I've discovered two whole new problems.

First, after we wrote the petrifaction code, I'd failed to test what happens when someone dies for reasons not related to petrifaction. What happens is a FATAL LUA ERROR: Lua Function sys_character_die: mfi_dungeon/attacks.lua:14: attempt to call global 'dsb_set_topimages' (a nil value)

This is the code at the start of attacks.lua with the problem line indicated:

Code: Select all

--Miscellaneous functions and conditions.  These are called by individual monster special attacks
function sys_character_die(ppos, who, mouse_drop)
   
   drop_all_items_and_magicshields(ppos, who, mouse_drop)
   
   local death_object
   use_ch_exvar(who)
   if (ch_exvar[who].petrified) then
      death_object = "petrified"
      dsb_replace_topimages(who, nil, nil, "top_dead_petrified")
      ch_exvar[who].petrified = nil
   else
      death_object = "bones"
      dsb_set_topimages(who, nil, nil, 0) <---- This line is the one with the problem
   end

   local lev, xc, yc = dsb_party_coords()
   local tile_pos = dsb_ppos_tile(ppos)
   local dead_id = dsb_spawn(death_object, lev, xc, yc, tile_pos)
   exvar[dead_id] = { owner = who }

end


I've also discovered that shortly after entering the water with water breathing up, the character dies with no warning.

The code that I've written for this currently reads:-

Code: Select all

method_info.WATERBREATHE = {
	    xp_class = CLASS_WIZARD,
	    xp_sub = SKILL_AIR,
	    xp_get = 35,
	    idleness = 10,
	    stamina_used = 2
}
and

Code: Select all

obj.trident = {
    name="TRIDENT",
    type="THING",
    class="WEAPON",
    mass=39,
    icon=gfx.thing_icon_trident,
    dungeon=gfx.thing_dungeon_trident,
	methods = {
	    { "JAB", 0, CLASS_FIGHTER, method_physattack },
	    { "THRUST", 5, { CLASS_FIGHTER, SKILL_STABBING }, method_physattack },
	    { "WATERBREATHE", 3, { CLASS_WIZARD, SKILL_AIR }, method_light }
	},
	spell_power=140,
	light_power=60,
	light_fade=2,
	light_fade_time=2500,
	base_range=10,
	base_tpower=50,
	impact=28,
	fit_sheath=true
}
(I changed it from WATERBREATHING to WATERBREATHE so it would fit in the "methods" box when displayed in DSB--otherwise we had a method called WATERBREATHI which wasn't ideal...)

Is the light_fade parameter the one that's causing a problem?
User avatar
Sophia
Concise and Honest
Posts: 4306
Joined: Thu Sep 12, 2002 9:50 pm
Location: Nowhere in particular
Contact:

Re: How to... ?

Post by Sophia »

Mon Ful Ir wrote:dsb_set_topimages(who, nil, nil, 0) <---- This line is the one with the problem
You actually found and pointed out this bug before. ;) I had quickly written the sample code and mistakenly used the word "set" instead of the correct name dsb_replace_topimages. So change the function call to dsb_replace_topimages and it will work fine.
Mon Ful Ir wrote:Is the light_fade parameter the one that's causing a problem?
What is causing the problem is that you're now casting light spells, and absolutely nothing in the code that is being executed actually asserts C_WATERBREATHING. ;)

Here's a simple method_waterbreathe that you can invoke from the methods table that should work. It also serves as a useful bare-bones attack method in case you want to write your own. It simply finds the archetype it was invoked from, looks up the method's properties in method_info via lookup_method_info, sets C_WATERBREATHING (I use a static value of 20, but feel free to mess with this) and finally calls method_finish to give xp and such things.

Code: Select all

function method_waterbreathe(name, ppos, who, what)
    local arch = dsb_find_arch(what)
    local m = lookup_method_info(name, arch)
    if (not m) then return end
        
    dsb_set_condition(who, C_WATERBREATHING, 20)
    
    method_finish(m, ppos, who, what)
end
Mon Ful Ir
Adept
Posts: 221
Joined: Sat Jan 07, 2006 1:54 am
Location: Britain

Re: How to... ?

Post by Mon Ful Ir »

Bah :( Still crashing, sorry. When I invoke waterbreathe:

FATAL LUA ERROR: Lua Function WATERBREATHE: base/xp.lua:49: attempt to compare number with nil

I haven't altered xp.lua.
User avatar
Sophia
Concise and Honest
Posts: 4306
Joined: Thu Sep 12, 2002 9:50 pm
Location: Nowhere in particular
Contact:

Re: How to... ?

Post by Sophia »

From what I can tell, that error would be caused if xp_sub isn't set, so make sure that it is. :)
Failing that, could you upload your code again? I'll take a look...
Mon Ful Ir
Adept
Posts: 221
Joined: Sat Jan 07, 2006 1:54 am
Location: Britain

Re: How to... ?

Post by Mon Ful Ir »

Aha! That's fixed it. :) Thank you Sophia -- I had failed to set xp_sub.

mfi_dungeon 11.12.10

Changelog:
* Various code changes to monsters (ongoing project)
* New underwater monster: Chaos crab.
* New underwater graphic overlay (and thank you to Joramun for drawing it).
* New thing: Eyeball. (Beholders now drop eyeballs.)
* New things: Four variant gemstones (ruby, sapphire, emerald, tourmaline for red, blue, green, yellow).
* Trident now has an effect, which provides short-duration water breathing.

Sophia, I'm a bit worried about the water breathing effect which I think needs some more testing. I'm concerned that it uses the parameter air_supply which is also used for surviving underwater without the water breathing effect. Does that mean that if I run water breathing a few times, then if the water breathing expires while the character's still underwater, the character will die instantly? That's not ideal.

I think the two parameters should be separated, so that characters can still hold their breath briefly once the water breathing is out. I also think the water breathing effect needs a graphic around the affected party member, like the dotted line to indicate a fireshield. Alternatively we could have an additional viewscreen overlay for each character affected by water breathing, which would display a little "water breathing working" message (perhaps under the character's name). Or something. I just think the player should be able to see which characters have water breathing up and which don't.
Mon Ful Ir
Adept
Posts: 221
Joined: Sat Jan 07, 2006 1:54 am
Location: Britain

Re: How to... ?

Post by Mon Ful Ir »

mfi_dungeon 12.12.10

Changelog:
* Various code changes to monsters (ongoing project).
* New container: Bag.
* New thing: Razor (high-end ninja weapon).
* New thing: Dwarf axe (mid-to-high end fighter weapon).
* New thing: Decapitator (high-end fighter axe).
* New thing: Pernach (high-end fighter mace).
* New armour set: Armour of Night (high end armour).
* New underwater monster: Mudman.
* Underwater code tweak: Each character's air supply is now displayed and updated onscreen.

Probably the last in the series of "fast" updates because I'm back to work tomorrow. I'll continue to update the file but it'll be much slower!
User avatar
Sophia
Concise and Honest
Posts: 4306
Joined: Thu Sep 12, 2002 9:50 pm
Location: Nowhere in particular
Contact:

Re: How to... ?

Post by Sophia »

Mon Ful Ir wrote:Sophia, I'm a bit worried about the water breathing effect which I think needs some more testing. I'm concerned that it uses the parameter air_supply which is also used for surviving underwater without the water breathing effect. Does that mean that if I run water breathing a few times, then if the water breathing expires while the character's still underwater, the character will die instantly? That's not ideal.
It sets air_supply to its maximal value every time it ticks. This means that it actually does what you want-- water breathing keeps the characters' air supply maximized until it expires, at which time they start counting down normally, just like if they were holding their breath.
Mon Ful Ir
Adept
Posts: 221
Joined: Sat Jan 07, 2006 1:54 am
Location: Britain

Re: How to... ?

Post by Mon Ful Ir »

mfi_dungeon 18.12.10

Changes to the monster code, is all there is to this revision.
User avatar
Gambit37
Should eat more pies
Posts: 13768
Joined: Wed May 31, 2000 1:57 pm
Location: Location, Location
Contact:

Re: How to... ?

Post by Gambit37 »

Back on page one, Sophia walked us through a lot of DSB code. I don't understand this bit:
Sophia wrote:Now, let's block magic. Many of the effects you want are best achieved by overriding some of the sys_* functions. For example, blocking magic would be best accomplished by writing a new sys_forbid_magic that overrides the base (empty) one, and provides some situations under which magic is forbidden, like paralysis.

Code: Select all

function sys_forbid_magic(ppos, who)
   local paralyzed = dsb_get_condition(who, C_PARALYSIS)
   if (paralyzed) then
      return true
   end
   return false
end
This checks the paralyzed state for the character attempting to use magic, and if the condition is active, forbids magic.
How does this "forbid magic"? All I can see is it returns TRUE or FALSE. How is the forbidding of magic actually handled, and where?
User avatar
Joramun
Mon Master
Posts: 927
Joined: Thu May 25, 2006 7:05 pm
Location: The Universe

Re: How to... ?

Post by Joramun »

The sys_* functions are called by the DSB engine itself, so it's a bit of a "black box".

(think of them as the reverse of dsb_* functions: the dsb_* function are called by the Lua SCRIPT to ask information/modify the system.)

This one is probably called when displaying/handling the magic system, and obviously a "true" means that the engine will stop "playing" magic.
What Is Your Quest ?
User avatar
Sophia
Concise and Honest
Posts: 4306
Joined: Thu Sep 12, 2002 9:50 pm
Location: Nowhere in particular
Contact:

Re: How to... ?

Post by Sophia »

Right. Returning true from sys_forbid_magic forbids magic because the function's return is essentially the answer to the question, "Should I forbid magic?"
Mon Ful Ir
Adept
Posts: 221
Joined: Sat Jan 07, 2006 1:54 am
Location: Britain

Re: How to... ?

Post by Mon Ful Ir »

In terms of what the player sees, the spell runes become un-clickable.
User avatar
Gambit37
Should eat more pies
Posts: 13768
Joined: Wed May 31, 2000 1:57 pm
Location: Location, Location
Contact:

Re: How to... ?

Post by Gambit37 »

So the action of forbiiding magic is handled by the hardcoded engine? Still trying get my head around what's hardcoded and what is done in the base Lua files.
(I'm clearly learning. I now know that it's Lua and not LUA ;) )
User avatar
Sophia
Concise and Honest
Posts: 4306
Joined: Thu Sep 12, 2002 9:50 pm
Location: Nowhere in particular
Contact:

Re: How to... ?

Post by Sophia »

Gambit37 wrote:Still trying get my head around what's hardcoded and what is done in the base Lua files.
Yes, and unfortunately it's often not clear where the proper hook for something is. Browsing base/system.lua and base/hooks.lua is a good start. :D
LordGarth
Apprentice
Posts: 41
Joined: Thu Jan 27, 2011 6:21 pm

Re: How to... ?

Post by LordGarth »

Hello all,

I am trying to make new monsters. I make the new graphics off of existing ones. For example I am making a black dragon off of the red dragon graphics. I add the object and graphics code but when I launch the dsb, it says it cant find bitmap. The monster is there in the dungeon but has no graphic. I save the new graphic to the editor folder where all the other ones are. But dsb does not go and get it. I have added the code in graphics.

gfx.bdragon_front = dsb_get_bitmap("BDRAGON_FRONT")
gfx.bdragon_front.y_off = 16
gfx.bdragon_side = dsb_get_bitmap("BDRAGON_SIDE")
gfx.bdragon_side.y_off = 16
gfx.bdragon_back = dsb_get_bitmap("BDRAGON_BACK")
gfx.bdragon_back.y_off = 16
gfx.bdragon_attack = dsb_get_bitmap("BDRAGON_ATTACK")
gfx.bdragon_attack.y_off = 16

If anyone wants to make an invisible monster. Add it in the objects file but dont put any code in the graphics file. hahhahahah.

Not good to have an invisible black dragon running around.

Please advise

Thx,

Lordgarth
User avatar
Sophia
Concise and Honest
Posts: 4306
Joined: Thu Sep 12, 2002 9:50 pm
Location: Nowhere in particular
Contact:

Re: How to... ?

Post by Sophia »

LordGarth wrote:I save the new graphic to the editor folder where all the other ones are. But dsb does not go and get it. I have added the code in graphics.
All custom files go in the same folder as the custom dungeon that uses them. For example, if your dungeon is stored in C:\dsb\mydungeon then you should place bdragon_front.bmp (or whatever the extension is) at the location C:\dsb\mydungeon\bdragon_front.bmp in order to make the command work as written.

I should also point out, since you said "have added the code in graphics," that you should make sure that you're adding code to your own custom dungeon's files, rather than modifying anything found in base/.
LordGarth
Apprentice
Posts: 41
Joined: Thu Jan 27, 2011 6:21 pm

Re: How to... ?

Post by LordGarth »

Hello,

putting the pics in the folder where the play dungeon file is worked. Now I can make any monster or weapon I want. MUAHAHAHAHAHHAHAHAHAHAH.

LordGarth
Mon Ful Ir
Adept
Posts: 221
Joined: Sat Jan 07, 2006 1:54 am
Location: Britain

Re: How to... ?

Post by Mon Ful Ir »

Hi LordGarth

If you make any new monster graphics, why not share them with the community? You can make a downloadable add-on for dsb.

All the best

MFI
Post Reply