A couple of question for a mini-variant I'm making

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • TJS
    Swordsman
    • May 2008
    • 473

    A couple of question for a mini-variant I'm making

    I asked some of these in another thread, but it's probably better in here. Sorry for all the questions, as I'm quite new to the codebase.

    How do you cast clairvoyance each turn for the player?
    I know it's in the form: cast_priest_spell(index, dir); but I'm unsure what variables to put in it. Also where is the code for the start of the players turn?

    How can you put the probability of an object appearing to zero? Also is it possible to ensure that a base object type always has the same to-hit and to-damage values rather than 0,0 ? Also is it possible to limit when magical types appear for an object (eg. never any magical daggers if you want) ?

    Also is it possible to have objects automatically identified? The EASY_KNOW flag seems to still require trying on or consuming before you know what they are for a number of object types (eg. mushrooms).

    Finally I think I heard that normal monster types can somtimes have 10% extra speed. Is there a way to stop this happening?
  • Derakon
    Prophet
    • Dec 2009
    • 9022

    #2
    You can prevent items from being allocated by removing any A: lines from their entry in object.txt. For example, the Dagger entry says
    Code:
    A:20:0 to 100
    . This means that the item's commonness is 20 and it can be generated on any level from 0 to 100. If you remove the line (or set the 20 to 0 instead) then the item cannot be generated. Some items have multiple allocation lines; you'll have to remove them all.

    You can modify the base bonuses of the item in object.txt as well. The documentation at the start of the file describes all the entries; the ones you want are in the P: line. I don't believe it's currently possible to mark an item as ineligible for enchantment.

    I think that if you want to identify items on pickup, you should modify py_pickup_aux to call object_notice_everything(o_ptr) -- probably the best place to do this is right after the call to object_sense_artifact.

    Instead of casting Clairvoyance, call wiz_light(TRUE). Do this in dungeon.c in the block where it says "Handle actual user input"; probably right at the start of the "do" block.

    I don't know where the monster speed modification is done.

    Comment

    • fizzix
      Prophet
      • Aug 2009
      • 3025

      #3
      For the monster speed, comment out the lines for the small racial variety in monster/mon-make.c

      Code:
      	/* Extract the monster base speed */
      	n_ptr->mspeed = r_ptr->speed;
      
      	/* Hack -- small racial variety */
      	if (!rf_has(r_ptr->flags, RF_UNIQUE)) {
      		/* Allow some small variation per monster */
      		i = extract_energy[r_ptr->speed] / 10;
      		if (i) n_ptr->mspeed += rand_spread(0, i);
      	}

      Comment

      • TJS
        Swordsman
        • May 2008
        • 473

        #4
        Thanks a lot for the help. I'm starting to get my head around the code.

        Something I can't find is where the spells/prayers are defined for each book. Is there a table somewhere that I'm missing?

        Comment

        • fizzix
          Prophet
          • Aug 2009
          • 3025

          #5
          Originally posted by TJS
          Thanks a lot for the help. I'm starting to get my head around the code.

          Something I can't find is where the spells/prayers are defined for each book. Is there a table somewhere that I'm missing?
          In spell.txt there is a list of spells, the arguments for the spell includes what book they're in and what order they are in that book. The mana cost, level and failure rate are class dependent, so that stuff is in p_class.txt, another edit file.

          the file x-spell.c defines the effect produced by casting the spell.

          grep is your friend, it's generally how I find anything in the code. (if you're on windows, there's a freeware program called windows grep that has a reasonable nice gui interface and supports recursive searching as well as showing you several lines surrounding each found term.)

          Comment

          • TJS
            Swordsman
            • May 2008
            • 473

            #6
            Originally posted by fizzix
            In spell.txt there is a list of spells, the arguments for the spell includes what book they're in and what order they are in that book. The mana cost, level and failure rate are class dependent, so that stuff is in p_class.txt, another edit file.

            the file x-spell.c defines the effect produced by casting the spell.

            grep is your friend, it's generally how I find anything in the code. (if you're on windows, there's a freeware program called windows grep that has a reasonable nice gui interface and supports recursive searching as well as showing you several lines surrounding each found term.)
            Thanks for the help again - I'll also give grep a bash as well.

            Next question. How do you define what graphics a monster uses? It seems dependent on the number after N:

            Comment

            • Mikko Lehtinen
              Veteran
              • Sep 2010
              • 1246

              #7
              Originally posted by TJS
              Next question. How do you define what graphics a monster uses? It seems dependent on the number after N:
              You can just try it on a townsperson, and check by playing if you got it right.

              There might be a helpful guide in the beginning of the monster.txt file?

              Comment

              • Nomad
                Knight
                • Sep 2010
                • 958

                #8
                Originally posted by TJS
                Next question. How do you define what graphics a monster uses? It seems dependent on the number after N:
                The graphics are set individually for each tile set using pref files. Each set has a 'graf-xxx.prf' file that assigns most of the graphics, plus two supplementary files, 'flvr-xxx.prf' to set tiles for flavoured objects and 'xtra-xxx.prf' to set player tiles. The files with 'xxx' in the name define graphics for the classic 8x8 tile set; "graf-new.prf" is the 16x16 Adam Bolt set, 'dvg' is the 32x32 David Gervais tiles, 'nmd' is my 8x16 tiles, and 'shb' is Shockbolt's 64x64 tiles.

                You'll find the entries for monsters in the second half of the 'graf-xxx.prf' file, where they're all in this sort of format:

                Code:
                # farmer maggot
                R:4:0xA7:0x8C
                # lines are comments

                The number after R is the serial number, matching the one specified in the 'N' line in monster.txt. The two hex numbers are coordinates in Y:X format, referring to a position on the tilesheet (those are saved as png files in the "xtra/graf" folder). Numbering starts with 0x80:0x80 as the top left square (so the next one along would be 0x80:0x81, the one directly below 0x81:0x80, etc.). If you want to change a graphic, you've got to alter to coordinates to point to a different square on the tilesheet. A bit fiddly, I'm afraid.

                Comment

                • TJS
                  Swordsman
                  • May 2008
                  • 473

                  #9
                  Originally posted by Nomad
                  The number after R is the serial number, matching the one specified in the 'N' line in monster.txt. The two hex numbers are coordinates in Y:X format, referring to a position on the tilesheet (those are saved as png files in the "xtra/graf" folder). Numbering starts with 0x80:0x80 as the top left square (so the next one along would be 0x80:0x81, the one directly below 0x81:0x80, etc.). If you want to change a graphic, you've got to alter to coordinates to point to a different square on the tilesheet. A bit fiddly, I'm afraid.
                  Great thanks, I feel slightly better about not figuring out how it works now!

                  Is there a similar file for specifying which egos apply to which types of equipment? I can't work out what the first number after X is for. I have a similar question for artifacts. Also is it possible to add an activation to egos? I want to add temporary resist fire to an ego of flame.

                  Also how does rarity and commonness work? I guess with commonness there is a range of levels where an item can appear, but what is the first number after C mean? How is it different to rarity?

                  Sorry for all the questions!

                  Comment

                  Working...
                  😀
                  😂
                  🥰
                  😘
                  🤢
                  😎
                  😞
                  😡
                  👍
                  👎