DoomRL > Modding

Changing the ammo system?

<< < (3/10) > >>

tehtmi:

--- Quote from: Autoquark on March 30, 2013, 10:02 ---I tried looking through the inventory like this:

--- End quote ---
The "return false" needs to be outside the loop for this to work as you intended.  You may also need to manually :destroy() the item when its ammo reaches 0, but I'm not 100% sure.

Autoquark:
Oops! Silly mistake. You were right about having to destroy the ammo item when it ran out, too. That works now, but I have some more questions:

1. I have a missile defined with the MF_RAY flag set, but the game seems to ignore that and still draws a bullet travelling across the screen. It works in console mode however - has the flag become deprecated since graphics were introduced?

2. Is there a list of sprites somewhere? I don't know the names of any of the missile sprites, so I've had to put in random sprites that I do know for now. Although I suppose there is something to be said for a shotgun that shoots shotguns...

3. I've been trying to change the missile property of a weapons using the OnFire hook, but I always get an error when I try to assign it - what should the assignment look like?

4. This is just out of interest, for now: I notice that calling Player:power_backpack() reshuffles the player's ammo stacks. Is there any way to do this without also turning the backpack on? It would be quite a handy feature.

tehtmi:

--- Quote from: Autoquark on March 30, 2013, 16:56 ---1. I have a missile defined with the MF_RAY flag set, but the game seems to ignore that and still draws a bullet travelling across the screen. It works in console mode however - has the flag become deprecated since graphics were introduced?

--- End quote ---
I wouldn't say it is deprecated, just not supported in graphics mode yet.


--- Quote ---2. Is there a list of sprites somewhere? I don't know the names of any of the missile sprites, so I've had to put in random sprites that I do know for now. Although I suppose there is something to be said for a shotgun that shoots shotguns...

--- End quote ---

Here's all the sprite constants that are declared; use them.  (Spoilered for length)
Spoiler (click to show/hide)core.declare( "SPRITE_PLAYER",          OBJECT_ROW_1 + 1 )
core.declare( "SPRITE_PLAYER_KNIFE",    OBJECT_ROW_1 + 2 )
core.declare( "SPRITE_PLAYER_CHAINSAW", OBJECT_ROW_1 + 3 )
core.declare( "SPRITE_PLAYER_PISTOL",   OBJECT_ROW_1 + 4 )
core.declare( "SPRITE_PLAYER_SHOTGUN",  OBJECT_ROW_1 + 5 )
core.declare( "SPRITE_PLAYER_CSHOTGUN", OBJECT_ROW_1 + 6 )
core.declare( "SPRITE_PLAYER_DSHOTGUN", OBJECT_ROW_1 + 7 )
core.declare( "SPRITE_PLAYER_CHAINGUN", OBJECT_ROW_1 + 8 )
core.declare( "SPRITE_PLAYER_BAZOOKA",  OBJECT_ROW_1 + 9 )
core.declare( "SPRITE_PLAYER_PLASMA",   OBJECT_ROW_1 + 10 )
core.declare( "SPRITE_PLAYER_BFG9000",  OBJECT_ROW_1 + 11 )
core.declare( "SPRITE_PLAYER_SPEAR",    OBJECT_ROW_1 + 12 )
--
core.declare( "SPRITE_PLAYER_STAFF",    OBJECT_ROW_1 + 14 )
core.declare( "SPRITE_PLAYER_CLEAVER",  OBJECT_ROW_1 + 15 )
core.declare( "SPRITE_PLAYER_DRAGON",   OBJECT_ROW_1 + 16 )

--
core.declare( "SPRITE_KNIFE",    OBJECT_ROW_2 + 2 )
core.declare( "SPRITE_CHAINSAW", OBJECT_ROW_2 + 3 )
core.declare( "SPRITE_PISTOL",   OBJECT_ROW_2 + 4 )
core.declare( "SPRITE_SHOTGUN",  OBJECT_ROW_2 + 5 )
core.declare( "SPRITE_CSHOTGUN", OBJECT_ROW_2 + 6 )
core.declare( "SPRITE_DSHOTGUN", OBJECT_ROW_2 + 7 )
core.declare( "SPRITE_CHAINGUN", OBJECT_ROW_2 + 8 )
core.declare( "SPRITE_BAZOOKA",  OBJECT_ROW_2 + 9 )
core.declare( "SPRITE_PLASMA",   OBJECT_ROW_2 + 10 )
core.declare( "SPRITE_BFG9000",  OBJECT_ROW_2 + 11 )
core.declare( "SPRITE_SPEAR",    OBJECT_ROW_2 + 12 )
core.declare( "SPRITE_BFG10K",   OBJECT_ROW_2 + 13 )
core.declare( "SPRITE_STAFF",    OBJECT_ROW_2 + 14 )
core.declare( "SPRITE_CLEAVER",  OBJECT_ROW_2 + 15 )
core.declare( "SPRITE_DRAGON",   OBJECT_ROW_2 + 16 )

core.declare( "SPRITE_ARMOR",    OBJECT_ROW_3 + 1 )
core.declare( "SPRITE_AARMOR",   OBJECT_ROW_3 + 2 )
core.declare( "SPRITE_SBOOTS",   OBJECT_ROW_3 + 3 )
core.declare( "SPRITE_BOOTS",    OBJECT_ROW_3 + 4 )
core.declare( "SPRITE_MOD",      OBJECT_ROW_3 + 5 )
core.declare( "SPRITE_SKULL",    OBJECT_ROW_3 + 6 )
core.declare( "SPRITE_AMMO",     OBJECT_ROW_3 + 7 )
core.declare( "SPRITE_PAMMO",    OBJECT_ROW_3 + 8 )
core.declare( "SPRITE_SHELL",    OBJECT_ROW_3 + 9 )
core.declare( "SPRITE_PSHELL",   OBJECT_ROW_3 + 10 )
core.declare( "SPRITE_ROCKET",   OBJECT_ROW_3 + 11 )
core.declare( "SPRITE_PROCKET",  OBJECT_ROW_3 + 12 )
core.declare( "SPRITE_CELL",     OBJECT_ROW_3 + 13 )
core.declare( "SPRITE_PCELL",    OBJECT_ROW_3 + 14 )
core.declare( "SPRITE_PHASE",    OBJECT_ROW_3 + 15 )
--

core.declare( "SPRITE_BACKPACK",   OBJECT_ROW_4 + 1 )
core.declare( "SPRITE_ENVIRO",     OBJECT_ROW_4 + 2 )
core.declare( "SPRITE_HGLOBE",     OBJECT_ROW_4 + 3 )
core.declare( "SPRITE_LHGLOBE",    OBJECT_ROW_4 + 4 )
core.declare( "SPRITE_SUPERCHARGE",OBJECT_ROW_4 + 5 )
core.declare( "SPRITE_INV",        OBJECT_ROW_4 + 6 )
core.declare( "SPRITE_MEGASPHERE", OBJECT_ROW_4 + 7 )
core.declare( "SPRITE_SHARD",      OBJECT_ROW_4 + 8 )
core.declare( "SPRITE_MEDPACK",    OBJECT_ROW_4 + 9 )
core.declare( "SPRITE_LMEDPACK",   OBJECT_ROW_4 + 10 )
core.declare( "SPRITE_BERSERK",    OBJECT_ROW_4 + 11 )
core.declare( "SPRITE_MAP",        OBJECT_ROW_4 + 12 )
core.declare( "SPRITE_TMAP",       OBJECT_ROW_4 + 13 )
core.declare( "SPRITE_SCHEMATIC",  OBJECT_ROW_4 + 14 )
core.declare( "SPRITE_LIGHTAMP",   OBJECT_ROW_4 + 15 )
core.declare( "SPRITE_NUKE",       OBJECT_ROW_4 + 16 )

core.declare( "SPRITE_FORMER",    OBJECT_ROW_5 + 1 )
core.declare( "SPRITE_SERGEANT",  OBJECT_ROW_5 + 2 )
core.declare( "SPRITE_CAPTAIN",   OBJECT_ROW_5 + 3 )
core.declare( "SPRITE_COMMANDO",  OBJECT_ROW_5 + 4 )
core.declare( "SPRITE_IMP",       OBJECT_ROW_5 + 5 )
core.declare( "SPRITE_DEMON",     OBJECT_ROW_5 + 6 )
core.declare( "SPRITE_LOSTSOUL",  OBJECT_ROW_5 + 7 )
core.declare( "SPRITE_CACODEMON", OBJECT_ROW_5 + 8 )
core.declare( "SPRITE_PAIN",      OBJECT_ROW_5 + 9 )
core.declare( "SPRITE_KNIGHT",    OBJECT_ROW_5 + 10 )
core.declare( "SPRITE_BARON",     OBJECT_ROW_5 + 11 )
core.declare( "SPRITE_ARACHNO",   OBJECT_ROW_5 + 12 )
core.declare( "SPRITE_ARCHVILE",  OBJECT_ROW_5 + 13 )
core.declare( "SPRITE_REVENANT",  OBJECT_ROW_5 + 14 )
core.declare( "SPRITE_MANCUBUS",  OBJECT_ROW_5 + 15 )
core.declare( "SPRITE_BRUISER",   OBJECT_ROW_5 + 16 )

core.declare( "SPRITE_AGONY",     OBJECT_ROW_6 + 9 )

core.declare( "SPRITE_MASTER",    OBJECT_ROW_7 + 1 )
core.declare( "SPRITE_LAVAELEM",  OBJECT_ROW_7 + 2 )
core.declare( "SPRITE_ANGEL",     OBJECT_ROW_7 + 3 )
core.declare( "SPRITE_SHAMBLER",  OBJECT_ROW_7 + 4 )
core.declare( "SPRITE_JC",        OBJECT_ROW_7 + 5 )
core.declare( "SPRITE_CYBERDEMON",OBJECT_ROW_7 + 6 )
core.declare( "SPRITE_MASTERMIND",OBJECT_ROW_7 + 10 )

core.declare( "SPRITE_LAVAINV"   ,OBJECT_ROW_8 + 2 )

core.declare( "SPRITE_DOOR",         OBJECT_ROW_14 + 1 )
core.declare( "SPRITE_OPENDOOR",     OBJECT_ROW_14 + 2 )
core.declare( "SPRITE_HELLDOOR",     OBJECT_ROW_14 + 3 )
core.declare( "SPRITE_HELLOPENDOOR", OBJECT_ROW_14 + 4 )
core.declare( "SPRITE_BARREL",       OBJECT_ROW_14 + 5 )
core.declare( "SPRITE_LAVABARREL",   OBJECT_ROW_14 + 6 )
core.declare( "SPRITE_ACIDBARREL",   OBJECT_ROW_14 + 7 )
--
--
core.declare( "SPRITE_TREE",         OBJECT_ROW_14 + 10 )

core.declare( "SPRITE_SHOT",         OBJECT_ROW_15 + 1 )
core.declare( "SPRITE_CSHOT",        OBJECT_ROW_15 + 2 )
core.declare( "SPRITE_BLAST",        OBJECT_ROW_15 + 3 )
core.declare( "SPRITE_ROCKETSHOT",   OBJECT_ROW_15 + 4 )
core.declare( "SPRITE_GRAYSTAIRS",   OBJECT_ROW_15 + 5 )
core.declare( "SPRITE_EXPLOSION",    OBJECT_ROW_15 + 6 )
core.declare( "SPRITE_PLASMASHOT",   OBJECT_ROW_15 + 7 )
core.declare( "SPRITE_BFGSHOT",      OBJECT_ROW_15 + 8 )
core.declare( "SPRITE_FIREBALL",     OBJECT_ROW_15 + 9 )
core.declare( "SPRITE_PLASMABALL",   OBJECT_ROW_15 + 10 )
core.declare( "SPRITE_ACIDSHOT",     OBJECT_ROW_15 + 11 )
--

core.declare( "SPRITE_ARROW",        OBJECT_ROW_16 + 1 )
core.declare( "SPRITE_SELECT",       OBJECT_ROW_16 + 2 )
core.declare( "SPRITE_MARK",         OBJECT_ROW_16 + 3 )
core.declare( "SPRITE_STAIRS",       OBJECT_ROW_16 + 4 )
core.declare( "SPRITE_REDSTAIRS",    OBJECT_ROW_16 + 5 )
core.declare( "SPRITE_PORTAL",       OBJECT_ROW_16 + 6 )
core.declare( "SPRITE_TELEPORT",     OBJECT_ROW_16 + 7 )
core.declare( "SPRITE_LEVER",        OBJECT_ROW_16 + 8 )
core.declare( "SPRITE_BLOOD",        OBJECT_ROW_16 + 9 )
core.declare( "SPRITE_BLOODPOOL",    OBJECT_ROW_16 + 10 )
core.declare( "SPRITE_CORPSE",       OBJECT_ROW_16 + 11 )
core.declare( "SPRITE_WALLBLOOD",    OBJECT_ROW_16 + 12 )
core.declare( "SPRITE_GRID",         OBJECT_ROW_16 + 13 )

--
core.declare( "SPRITE_FLOOR",     TERRAIN_ROW_1 + 1 )
core.declare( "SPRITE_CAVEFLOOR", TERRAIN_ROW_2 + 1 )
core.declare( "SPRITE_HELLFLOOR", TERRAIN_ROW_3 + 1 )

core.declare( "SPRITE_WALL",      TERRAIN_ROW_10 + 1 )
core.declare( "SPRITE_CAVEWALL",  TERRAIN_ROW_10 + 4 )
core.declare( "SPRITE_BRICKWALL", TERRAIN_ROW_10 + 7 )
core.declare( "SPRITE_TECHWALL",  TERRAIN_ROW_10 + 10 )
core.declare( "SPRITE_BOSSWALL",  TERRAIN_ROW_10 + 13 )

core.declare( "SPRITE_WATER",     TERRAIN_ROW_15 + 1 )
core.declare( "SPRITE_ACID",      TERRAIN_ROW_15 + 3 )
core.declare( "SPRITE_LAVA",      TERRAIN_ROW_15 + 5 )
core.declare( "SPRITE_BRIDGE",    TERRAIN_ROW_15 + 7 )
core.declare( "SPRITE_YBOX",      TERRAIN_ROW_15 + 8 )
core.declare( "SPRITE_WBOX",      TERRAIN_ROW_15 + 9 )

core.declare( "SPRITE_YBOXC",     TERRAIN_ROW_16 + 8 )
core.declare( "SPRITE_WBOXC",     TERRAIN_ROW_16 + 9 )
Alternatively, you could also just copy the values from things you know like beings.imp.sprite.


--- Quote ---3. I've been trying to change the missile property of a weapons using the OnFire hook, but I always get an error when I try to assign it - what should the assignment look like?

--- End quote ---
The value needs to be the number id of the missile.  Number ids are subject to change between versions, so you should translate from the string id e.g.

--- Code: ---  it.missile = missiles.mgun.nid
  -- or
  it.missile = missiles[string_id].nid

--- End code ---


--- Quote ---4. This is just out of interest, for now: I notice that calling Player:power_backpack() reshuffles the player's ammo stacks. Is there any way to do this without also turning the backpack on? It would be quite a handy feature.

--- End quote ---
Honestly, I suspect there are still bugs in power_backpack ;)  But no, I'm not aware of any other code that resorts the inventory like this; it is tied together with the backpack flag.

SPTX:
Speaking of sprite. Can I have the source code of the cyberdemon/spidermastermind?
I need to see how a sprite of a size bigger than one tile is handled. When I try to use them, they are cropped from their upper left corner to one tile.

tehtmi:

--- Quote from: SPTX on March 30, 2013, 17:29 ---I need to see how a sprite of a size bigger than one tile is handled. When I try to use them, they are cropped from their upper left corner to one tile.

--- End quote ---

Give a being (or item) the flag F_LARGE to allow for an oversized sprite.

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version