How Do I create a thing/object?

Status
Not open for further replies.

Deadpool The Hedge..

Also known as "FearsomeFang"
I've been trying over and over again to make a object that is a scenery object and doesn't do anything. But I can't just figure it out with this new system to LUA and creating a object in general. Can someone explain to me step by step and show me a good example of how to make one, so I can make more later on. What I'm trying to make is a tree object.

My Tree SOC in the maincfg looks like this:

FREESLOT
MT_F001
Object F001

Thing 318
MAPTHINGNUM = 4016
SPAWNSTATE = 1792
SPAWNHEALTH = 1000
SEESTATE = 0
SEESOUND = 0
REACTIONTIME = 8
ATTACKSOUND = 0
PAINSTATE = 0
PAINCHANCE = 0
PAINSOUND = 0
MELEESTATE = 0
MISSILESTATE = 0
DEATHSTATE = 0
DEATHSOUND = 0
XDEATHSTATE = 0
SPEED = 0
RADIUS = 1048576
HEIGHT = 2097152
MASS = 100
DAMAGE = 0
ACTIVESOUND = 0
RAISESTATE = 0
FLAGS = MF_NOCLIP|MF_SCENERY

FRAME 1792
SPRITENUMBER = 243
SPRITESUBNUMBER = 0
DURATION = -1
NEXT = 1
ACTION None
VAR1 = 0
VAR2 = 0

I also tryed the LUA version
//freeslots
freeslot(
"SPR_F001",
"MT_F001",
"S_F001"
)

//things
mobjinfo[MT_F001] = {
doomednum = 4016,
spawnstate = S_F001,
flags = MF_SCENERY,
}

//states yo
states[S_F001] = {SPR_F001,0}
None of these work

and the sprite of the tree itself is
F001A0
Which is between the S_START and the S_END.
So it's like this

S_START
F001A0
S_END

I also don't want link's to the wiki I tryed reading most of all the wiki pages but it still doesn't help me. I also read similar topic's like this and doesn't help...
 
Last edited:
You don't need to call it MT_F001, you can call it anything you want.
You also don't need to call the sprite F001, call it any four letter name you want, also add it to the freeslot.

so you want to have

FREESLOT
MT_TREE <- example name
SPR_TREE <- again, example name, make sure you define sprites too
S_TREE

When you're defining the Thing, you should use the same name you put in the FREESLOT part.

Thing MT_TREE
MAPTHINGNUM = 4016
SPAWNSTATE = ...
.
.
.

etc.

and then replace your spawnstate with the new custom state

SPAWNSTATE = S_TREE

FRAME S_TREE
SPRITENAME = TREE
SPRITEFRAME = A <- the A in TREEA0 (old F001A0)
DURATION = -1
NEXT = S_TREE
ACTION None
VAR1 = 0
VAR2 = 0
 
Last edited:
For the record, your Lua version is almost correct, the only problem is that the state definition is incomplete. You can't leave out parameters in the shorthand state definition you're using, so it would have to look something like this:

states[S_F001] = {SPR_F001 , 0, -1, None, 0, 0, S_F001}
 
For some reason when I went to create a new scenery thing/object with animation, it doesn't seem to work...

FREESLOT
MT_SPAK
SPR_SPAK
S_SPAK

Thing MT_SPAK
MAPTHINGNUM = 4020
SPAWNSTATE = S_SPAK
SPAWNHEALTH = 1000
SEESTATE = 0
SEESOUND = 0
REACTIONTIME = 8
ATTACKSOUND = 0
PAINSTATE = 0
PAINCHANCE = 0
PAINSOUND = 0
MELEESTATE = 0
MISSILESTATE = 0
DEATHSTATE = 0
DEATHSOUND = 0
XDEATHSTATE = 0
SPEED = 0
RADIUS = 1048576
HEIGHT = 2097152
MASS = 100
DAMAGE = 0
ACTIVESOUND = 0
RAISESTATE = 0
FLAGS = MF_NOCLIP|MF_SCENERY

STATE S_SPAK
SPRITENAME = SPAK
SPRITEFRAME = A
DURATION = 1
NEXT = S_SPAKB0
ACTION = None
VAR1 = 0
VAR2 = 0

State S_SPAK
SPRITENAME = SPAK
SPRITEFRAME = B
DURATION = 1
NEXT = S_SPAKC0
ACTION = None
VAR1 = 0
VAR2 = 0

State S_SPAK
SPRITENAME = SPAK
SPRITEFRAME = C
DURATION = 1
NEXT = S_SPAKD0
ACTION = None
VAR1 = 0
VAR2 = 0

State S_SPAK
SPRITENAME = SPAK
SPRITEFRAME = D
DURATION = 1
NEXT = S_SPAKE0
ACTION = None
VAR1 = 0
VAR2 = 0

State S_SPAK
SPRITENAME = SPAK
SPRITEFRAME = E
DURATION = 1
NEXT = S_SPAKA0
ACTION = None
VAR1 = 0
VAR2 = 0

And this is the log when I load it into srb2.
Command line arguments: '"F:\Games\Srb2win\Srb2 2.1\srb2win 2.10.exe" '
I_StartupSystem() ...
Setting up SRB2...
M_StartupLocale...
Z_Init(): Init zone memory allocation daemon.
System memory: 1278MB - Free: 727MB
I_StartupTimer()...
W_InitMultipleFiles(): Adding IWAD and main PWADs.
Added file F:\Games\Srb2win\Srb2 2.1\srb2.srb (6190 lumps)
Loading main config from F:\Games\Srb2win\Srb2 2.1\srb2.srb
Added file F:\Games\Srb2win\Srb2 2.1\zones.dta (960 lumps)
Loading main config from F:\Games\Srb2win\Srb2 2.1\zones.dta
Added file F:\Games\Srb2win\Srb2 2.1\player.dta (526 lumps)
Added file F:\Games\Srb2win\Srb2 2.1\rings.dta (444 lumps)
Added file F:\Games\Srb2win\Srb2 2.1\patch.dta (232 lumps)
Loading main config from F:\Games\Srb2win\Srb2 2.1\patch.dta
Added file F:\Games\Srb2win\Srb2 2.1\music.dta (171 lumps)
I_StartupGraphics()...
VID_SetMode(0)
VID_SetWindowedDisplayMode()
VID_FreeAndAllocVidbuffer done, vidbuffersize: 4e200
Mode changed to 0 (320x200W)
CPU Info: 486: 1, 586: 1, MMX: 1, 3DNow: 0, MMXExt: 0, SSE2: 1
HU_Init(): Setting up heads up display.
Number of console HUD lines is now 5
executing config.cfg
Default resolution: 640 x 480 (16 bits)
M_Init(): Init miscellaneous info.
R_Init(): Init SRB2 refresh daemon.
R_LoadTextures()...
R_InitSprites()...
srb2.srb added 2960 frames in 230 sprites
player.dta added 163 frames in 1 sprites
rings.dta added 431 frames in 18 sprites
patch.dta added 10 frames in 2 sprites
Added skin 'tails'
Added skin 'knuckles'
R_InitColormaps()...
Number of Extra Colormaps: 6
S_Init(): Setting up sound.
ST_Init(): Init status bar.
D_CheckNetGame(): Checking network game status.
Entering main game loop...
I_StartupKeyboard()...
I_StartupMouse()...
VID_SetMode(10)
VID_SetDirectDrawMode...
VID_FreeAndAllocVidbuffer done, vidbuffersize: 177000
Mode changed to 10 (640x480)
===========================================================================
We hope you enjoy this game as
much as we did making it!
...wait. =P
===========================================================================
Sonic Robo Blast 2 v2.1.10 (Aug 5 2014 19:33:00 r8777)
>addfile test.wad
NOTICE: Game must be restarted to record statistics.
Added file test.wad (19 lumps)
Loading main config from test.wad
WARNING: Line 34: Couldn't find state named 'S_SPAKB0'
WARNING: Line 43: Couldn't find state named 'S_SPAKC0'
WARNING: Line 52: Couldn't find state named 'S_SPAKD0'
WARNING: Line 61: Couldn't find state named 'S_SPAKE0'
WARNING: Line 70: Couldn't find state named 'S_SPAKA0'
5 warnings in the SOC lump
test.wad added 5 frames in 1 sprites
MAP01
Starting Server....
Binding to 0.0.0.0:5029
Network system buffer: 8Kb
Network system buffer set to: 64Kb
Contacting the server...
Sending join request...
Join accepted, waiting for complete game state...
Player 1 has joined the game (node 0)
Speeding off to level...
Map is now "MAP01: GREENFLOWER ZONE 1"
Player 1 renamed to Deadpool The Hedge..
I_ShutdownMouse()
I_ShutdownKeyboard()
I_ShutdownTcpDriver: shut down
I_ShutdownGraphics: I_Quit(): end of logstream.

Are all the states supost to have a Freeslot? Because I don't it's supost to.
 
Last edited:
You have several states under the same name; it's overwriting the earlier states with the latest one (the last S_SPAK overwrites all of the S_SPAK states above it). You need them to all have different names. I'd normally put the states names in their order, such as S_SPAK1, S_SPAK2, and so on.

You cannot reference anything through sprite names other than sprites themselves, so you can't have the next state "SPAKA0", because there isn't a state called that (only state you can use is the last S_SPAK, at the moment). This may seem like an inconvenience, but it allows you to reuse sprites for other states, which is very useful in some cases. You should have next state as the name of a state.

And, yes. All of the states are supposed to have a FREESLOT. This may also seem inconvenient, but it's for flexibility and to make sure that most things that you are trying to do will be possible.
 
I still think I'm doing something wrong.

I remade the Soc. And my animation is not animating.

FREESLOT
MT_SPAK
SPR_SPAK
S_SPAK

FREESLOT
MT_SPAK1
SPR_SPAK1
S_SPAK1

FREESLOT
MT_SPAK2
SPR_SPAK2
S_SPAK2

FREESLOT
MT_SPAK3
SPR_SPAK3
S_SPAK3

FREESLOT
MT_SPAK4
SPR_SPAK4
S_SPAK4

FREESLOT
MT_SPAK5
SPR_SPAK5
S_SPAK5

Thing MT_SPAK
MAPTHINGNUM = 4020
SPAWNSTATE = S_SPAK
SPAWNHEALTH = 1000
SEESTATE = 0
SEESOUND = 0
REACTIONTIME = 8
ATTACKSOUND = 0
PAINSTATE = 0
PAINCHANCE = 0
PAINSOUND = 0
MELEESTATE = 0
MISSILESTATE = 0
DEATHSTATE = 0
DEATHSOUND = 0
XDEATHSTATE = 0
SPEED = 0
RADIUS = 1048576
HEIGHT = 2097152
MASS = 100
DAMAGE = 0
ACTIVESOUND = 0
RAISESTATE = 0
FLAGS = MF_NOCLIP|MF_SCENERY

State S_SPAK1
SPRITENAME = SPAK
SPRITEFRAME = A
DURATION = 1
NEXT = S_SPAK2
ACTION = None
VAR1 = 0
VAR2 = 0

State S_SPAK2
SPRITENAME = SPAK
SPRITEFRAME = B
DURATION = 1
NEXT = S_SPAK3
ACTION = None
VAR1 = 0
VAR2 = 0

State S_SPAK3
SPRITENAME = SPAK
SPRITEFRAME = C
DURATION = 1
NEXT = S_SPAK4
ACTION = None
VAR1 = 0
VAR2 = 0

State S_SPAK4
SPRITENAME = SPAK
SPRITEFRAME = D
DURATION = 1
NEXT = S_SPAK5
ACTION = None
VAR1 = 0
VAR2 = 0

State S_SPAK5
SPRITENAME = SPAK
SPRITEFRAME = E
DURATION = 1
NEXT = S_SPAK1
ACTION = None
VAR1 = 0
VAR2 = 0
 
Last edited:
MT_SPAK's spawnstate is set to S_SPAK, which doesn't exist, instead of S_SPAK1.

Also, you are only supposed to have one freeslot block, and in it you list the names of your custom resources(states, objects, sounds, sprites); there is no MT_SPAK1, no MT_SPAK2, no MT_SPAK3, no MT_SPAK4, but you put them in anyways for some reason, nevermind that you're making new freeslot blocks to list them, why are you listing them? Meanwhile, sprite names can only be 4 characters long not counting the prefix because 4 of the 8 lump characters are taken up by the frame, so what on earth are SPR_SPAK2 and on supposed to mean?
 
... That's what I attemped to do the first time with only one Freeslot, and having different state's for each. But I didn't get it at the time.

FREESLOT
MT_SPAK
SPR_SPAK
S_SPAK

Thing MT_SPAK
MAPTHINGNUM = 4020
SPAWNSTATE = S_SPAK
SPAWNHEALTH = 1000
SEESTATE = 0
SEESOUND = 0
REACTIONTIME = 8
ATTACKSOUND = 0
PAINSTATE = 0
PAINCHANCE = 0
PAINSOUND = 0
MELEESTATE = 0
MISSILESTATE = 0
DEATHSTATE = 0
DEATHSOUND = 0
XDEATHSTATE = 0
SPEED = 0
RADIUS = 1048576
HEIGHT = 2097152
MASS = 100
DAMAGE = 0
ACTIVESOUND = 0
RAISESTATE = 0
FLAGS = MF_NOCLIP|MF_SCENERY

STATE S_SPAK
SPRITENAME = SPAK
SPRITEFRAME = A
DURATION = 1
NEXT = S_SPAKB0
ACTION = None
VAR1 = 0
VAR2 = 0

State S_SPAK
SPRITENAME = SPAK
SPRITEFRAME = B
DURATION = 1
NEXT = S_SPAKC0
ACTION = None
VAR1 = 0
VAR2 = 0

State S_SPAK
SPRITENAME = SPAK
SPRITEFRAME = C
DURATION = 1
NEXT = S_SPAKD0
ACTION = None
VAR1 = 0
VAR2 = 0

State S_SPAK
SPRITENAME = SPAK
SPRITEFRAME = D
DURATION = 1
NEXT = S_SPAKE0
ACTION = None
VAR1 = 0
VAR2 = 0

State S_SPAK
SPRITENAME = SPAK
SPRITEFRAME = E
DURATION = 1
NEXT = S_SPAKA0
ACTION = None
VAR1 = 0
VAR2 = 0
And the reason I added SPAK1, SPAK2 ... etc
Is because of this.

You need them to all have different names. I'd normally put the states names in their order, such as S_SPAK1, S_SPAK2, and so on.

Here's the file what I'm trying to make.
http://www24.zippyshare.com/v/57369182/file.html

It's just a test I wanted to see if I can make it work right.
It's supost to animate it, but its not doing that.
 
Last edited:
For the record, your Lua version is almost correct, the only problem is that the state definition is incomplete. You can't leave out parameters in the shorthand state definition you're using, so it would have to look something like this:

states[S_F001] = {SPR_F001 , 0, -1, None, 0, 0, S_F001}
Incorrect. Lua shorthand state declarations absolutely can leave out unneeded parameters and I do it all the time for states that don't change. If you want to define the last parameter you'd need to define all prior ones, but if you just need a sprite and frame you don't have to define anything else.
 
Incorrect. Lua shorthand state declarations absolutely can leave out unneeded parameters and I do it all the time for states that don't change. If you want to define the last parameter you'd need to define all prior ones, but if you just need a sprite and frame you don't have to define anything else.
In that case I wonder why the Lua script wasn't working, because everything else seems to be correct.
 
It might have been the SOC stuff in the maincfg conflicting with it. I did have that LUA and the SOC both in one wad together added. So it might have been on my part why it wasn't working. I got rid of the LUA I'm just going to stick to the SOC version untill I get the hang of LUA. And the LUA version I got off the wiki and replaced the sprite name header with my own sprite name header.

I still wanna know how to fix the object animation though.
 
Last edited:
It might have been the SOC stuff in the maincfg conflicting with it. I did have that LUA and the SOC both in one wad together added. So it might have been on my part why it wasn't working. I got rid of the LUA I'm just going to stick to the SOC version untill I get the hang of LUA. And the LUA version I got off the wiki and replaced the sprite name header with my own sprite name header.

I still wanna know how to fix the object animation though.
Here's whole fixed version
FREESLOT
MT_SPAK
SPR_SPAK
S_SPAK1
S_SPAK2
S_SPAK3
S_SPAK4
S_SPAK5

Thing MT_SPAK
MAPTHINGNUM = 4020
SPAWNSTATE = S_SPAK1
SPAWNHEALTH = 1000
SEESTATE = 0
SEESOUND = 0
REACTIONTIME = 8
ATTACKSOUND = 0
PAINSTATE = 0
PAINCHANCE = 0
PAINSOUND = 0
MELEESTATE = 0
MISSILESTATE = 0
DEATHSTATE = 0
DEATHSOUND = 0
XDEATHSTATE = 0
SPEED = 0
RADIUS = 1048576
HEIGHT = 2097152
MASS = 100
DAMAGE = 0
ACTIVESOUND = 0
RAISESTATE = 0
FLAGS = MF_NOCLIP|MF_SCENERY

STATE S_SPAK1
SPRITENAME = SPAK
SPRITEFRAME = A
DURATION = 1
NEXT = S_SPAK2
ACTION = None
VAR1 = 0
VAR2 = 0

State S_SPAK2
SPRITENAME = SPAK
SPRITEFRAME = B
DURATION = 1
NEXT = S_SPAK3
ACTION = None
VAR1 = 0
VAR2 = 0

State S_SPAK3
SPRITENAME = SPAK
SPRITEFRAME = C
DURATION = 1
NEXT = S_SPAK4
ACTION = None
VAR1 = 0
VAR2 = 0

State S_SPAK4
SPRITENAME = SPAK
SPRITEFRAME = D
DURATION = 1
NEXT = S_SPAK5
ACTION = None
VAR1 = 0
VAR2 = 0

State S_SPAK5
SPRITENAME = SPAK
SPRITEFRAME = E
DURATION = 1
NEXT = S_SPAK1
ACTION = None
VAR1 = 0
VAR2 = 0
I think that i helped you. ;)
Edit
You must put this into a wad featuring the SPAK sprites to make it work.
 
Last edited:
Here's whole fixed version
FREESLOT
MT_SPAK
SPR_SPAK
S_SPAK1
S_SPAK2
S_SPAK3
S_SPAK4
S_SPAK5

Thing MT_SPAK
MAPTHINGNUM = 4020
SPAWNSTATE = S_SPAK1
SPAWNHEALTH = 1000
SEESTATE = 0
SEESOUND = 0
REACTIONTIME = 8
ATTACKSOUND = 0
PAINSTATE = 0
PAINCHANCE = 0
PAINSOUND = 0
MELEESTATE = 0
MISSILESTATE = 0
DEATHSTATE = 0
DEATHSOUND = 0
XDEATHSTATE = 0
SPEED = 0
RADIUS = 1048576
HEIGHT = 2097152
MASS = 100
DAMAGE = 0
ACTIVESOUND = 0
RAISESTATE = 0
FLAGS = MF_NOCLIP|MF_SCENERY|MF_NOGRAVITY

STATE S_SPAK1
SPRITENAME = SPAK
SPRITEFRAME = A
DURATION = 1
NEXT = S_SPAK2
ACTION = None
VAR1 = 0
VAR2 = 0

State S_SPAK2
SPRITENAME = SPAK
SPRITEFRAME = B
DURATION = 1
NEXT = S_SPAK3
ACTION = None
VAR1 = 0
VAR2 = 0

State S_SPAK3
SPRITENAME = SPAK
SPRITEFRAME = C
DURATION = 1
NEXT = S_SPAK4
ACTION = None
VAR1 = 0
VAR2 = 0

State S_SPAK4
SPRITENAME = SPAK
SPRITEFRAME = D
DURATION = 1
NEXT = S_SPAK5
ACTION = None
VAR1 = 0
VAR2 = 0

State S_SPAK5
SPRITENAME = SPAK
SPRITEFRAME = E
DURATION = 1
NEXT = S_SPAK1
ACTION = None
VAR1 = 0
VAR2 = 0
I think that i helped you. ;)
Edit
You must put this into a wad featuring the SPAK sprites to make it work.

Thank you so much this did help me, now it's working the way I want it to work.

Heres the final version.
FREESLOT
MT_SPAK
SPR_SPAK
S_SPAK1
S_SPAK2
S_SPAK3
S_SPAK4
S_SPAK5
S_SPAK6
S_SPAK7
S_SPAK8

Thing MT_SPAK
MAPTHINGNUM = 4020
SPAWNSTATE = S_SPAK1
SPAWNHEALTH = 1000
SEESTATE = 0
SEESOUND = 0
REACTIONTIME = 8
ATTACKSOUND = 0
PAINSTATE = 0
PAINCHANCE = 0
PAINSOUND = 0
MELEESTATE = 0
MISSILESTATE = 0
DEATHSTATE = 0
DEATHSOUND = 0
XDEATHSTATE = 0
SPEED = 0
RADIUS = 1048576
HEIGHT = 2097152
MASS = 100
DAMAGE = 0
ACTIVESOUND = 0
RAISESTATE = 0
FLAGS = MF_NOCLIP|MF_SCENERY|MF_NOGRAVITY
STATE S_SPAK1
SPRITENAME = SPAK
SPRITEFRAME = A
DURATION = 3
NEXT = S_SPAK2
ACTION = None
VAR1 = 0
VAR2 = 0

State S_SPAK2
SPRITENAME = SPAK
SPRITEFRAME = B
DURATION = 3
NEXT = S_SPAK3
ACTION = None
VAR1 = 0
VAR2 = 0

State S_SPAK3
SPRITENAME = SPAK
SPRITEFRAME = C
DURATION = 3
NEXT = S_SPAK4
ACTION = None
VAR1 = 0
VAR2 = 0

State S_SPAK4
SPRITENAME = SPAK
SPRITEFRAME = D
DURATION = 3
NEXT = S_SPAK5
ACTION = None
VAR1 = 0
VAR2 = 0

State S_SPAK5
SPRITENAME = SPAK
SPRITEFRAME = E
DURATION = 3
NEXT = S_SPAK6
ACTION = None
VAR1 = 0
VAR2 = 0

State S_SPAK6
SPRITENAME = SPAK
SPRITEFRAME = F
DURATION = 3
NEXT = S_SPAK7
ACTION = None
VAR1 = 0
VAR2 = 0

State S_SPAK7
SPRITENAME = SPAK
SPRITEFRAME = G
DURATION = 3
NEXT = S_SPAK8
ACTION = None
VAR1 = 0
VAR2 = 0

State S_SPAK8
SPRITENAME = SPAK
SPRITEFRAME = H
DURATION = 3
NEXT = S_SPAK1
ACTION = None
VAR1 = 0
VAR2 = 0

I gave it more animation sprites and a object flag MF_NOGRAVITY.
 
Last edited:
And the reason I added SPAK1, SPAK2 ... etc
That's the thing, though; there are S_SPAK1, S_SPAK2, etc., because you have multiple states for MT_SPAK, but there is only one MT_SPAK. That means you only make entries for MT_SPAK, S_SPAK1, S_SPAK2, etc., because those are the resources that exist; you made an MT_SPAK, and an S_SPAK1, S_SPAK2, etc., those are the resources you need to declare in the freeslot block. You did not make an MT_SPAK2, therefor you do not list an MT_SPAK2 in the freeslot because it does not exist. Furthermore, all listing happens in one freeslot block.
 
Status
Not open for further replies.

Who is viewing this thread (Total: 1, Members: 0, Guests: 1)

Back
Top