Using an image as a sprite/item pickup

Archive of the old editing forum
Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. This forum is archived - please use this set of forums to ask new questions.
Locked
User avatar
Cjk10000
Posts: 98
Joined: Fri Jan 02, 2009 10:13 am

Using an image as a sprite/item pickup

Post by Cjk10000 »

Hey,
While it may be my first post, I've done lots of editing. I'm good at decorate, know how to use XWE well, and don't have a problem with imports.

My problem is:
1) I have an image. It is a small non-dynamic (It will remain in one state, much like a shotgun, how when on the ground it just rotates around you with one image). How do I import this into my wad? Do I just import the BMP image?

2) I want to make this item a pickup in game. How do I define this as a pickup? I desire it to be like a keycard but with no action. Would the fakeinventory class be appropriate? I'm using this as a counter (Ex: When player has picked up 3 [item], open door). I would like to be able to run an ACS script on it, much like you can when you pick up an item in game through thing action.

3) What code would I use to create this item? I don't need you guys to give me a full blown code, but I'm just looking for how to make the 'actor: define" stuff work. I know all about things like

Code: Select all

Actor Health : Inventory native
{
  Inventory.Amount 1
  Inventory.MaxAmount 0
  Inventory.PickupSound "misc/health_pkup"
}
That stuff I know how to do.
I just don't understand how to import and image and turn it into a properly working pickupable in-game sprite.

If you need more clarification I'll be glad to post it.
Thanks.
Gez
 
 
Posts: 17946
Joined: Fri Jul 06, 2007 3:22 pm

Re: Using an image as a sprite/item pickup

Post by Gez »

Cjk10000 wrote:Hey,
While it may be my first post, I've done lots of editing. I'm good at decorate, know how to use XWE well, and don't have a problem with imports.
Then I really don't understand what your problem is; because what you want is to import a picture with, presumably, XWE (I prefer SLumpEd by the way) and make DECORATE code... :?

First, the BMP format is evil and thus deliberately not recognized by ZDoom. Convert it to the Doom graphic format or to PNG. (Other formats are supported, but they're less common. But if you want to make it a DDS image, you can IIRC.) XWE (and SLumpEd) is able to convert BMPs and to import (as raw data) PNGs.

Second, the sprite itself isn't the item. The sprites are the states used by the item. So you create your item in DECORATE and then give it a Spawn: state with that sprite. For a sprite to work, it needs to have a 4-character name (like ITEM) followed by a frame letter (such as A) and a rotation index (0 for a sprite that covers all rotation, like pickups usually have). So the PNG or Doom graphics lump will be called something like ITEMA0. Then within your DECORATE actor you have this:

Code: Select all

  States
  {
    Spawn:
      ITEM A -1
      Loop
  }
It has to be within the rest of the actor declaration, for example:

Code: Select all

Actor Item : FakeInventory 1337
{
  Property
  OtherProperty
  +SOMEFLAG
  -SOMEOTHERFLAG
  States
  {
    Spawn:
      ITEM A -1
      Loop
  }
}
ITEM here refers to the name of the sprite, A to the frame letter, and -1 to the duration in which it remains in that frame (-1 is "forever"). The "Loop" that follows is never reached so I'm not sure it's really useful. When ZDoom sees this, it'll search the ITEMA* sprite that corresponds to the appropriate rotation, and 0 covers them all so it'll grab ITEMA0 and display it. Simple.
Locked

Return to “Editing (Archive)”