Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
glenzinho

Change default weapon

Recommended Posts

Hi all

I want to make the chainsaw my default weapon when the map opens. I don't want to change anything else, I still want the pistol with 50 ammo, I just want the opening weapon to be the chainsaw. How do I do this?

Share this post


Link to post

Thought about that already, but if I can get around having the weapon click sound at the start through means of DECORATE or something similar then I would prefer that instead...

At the start of my map you are facing a ripped open fence (I believe the texture is called DOBWIREx 1 or 2 from the Final Doom texture pack) and I want to start with the chainsaw already in the player's hands to explain the ripped open fence.

Share this post


Link to post

Not an expert on this, but I think you have to derive a new player class and assign the desired starting weapons to it, then have that class replace the default one. Should be such info on the wiki for that.

Share this post


Link to post

I've looked on the wiki.. they talk about something called "inheritance" which I gather to mean that you only have to replace changes you are making and not a whole class... can anyone clarify this for me?

Share this post


Link to post

EDIT: THE FOLLOWING STEPS ARE NO LONGER RECOMMENDED. PLEASE SEE THE NEW STEPS A FEW POSTS DOWN FOR A MORE EFFICIENT WAY OF DOING THIS!

I'm certainly not a DECORATE guru but this method worked for me:
1. Create a new DECORATE entry in your WAD
2. Go to this page and copy the entire actor definition (For now, ignore the warnings at the top of the page)
3. Paste the actor definition into your new DECORATE entry
4. Add the following line above Player.StartItem "Pistol":

Player.StartItem "Chainsaw"
This overrides the old player start with the new one. Now, when you start the game, you'll have the fist, chainsaw, and pistol and the chainsaw will be the default starting/readied weapon. Basically the way it works is the first "Player.StartItem" entry determines which weapon will be the one held the moment you spawn.

glenzinho said:

I've looked on the wiki.. they talk about something called "inheritance" which I gather to mean that you only have to replace changes you are making and not a whole class... can anyone clarify this for me?


Inheritance is extremely useful because like you basically said, it allows you to "inherit" every single property of an object and type only the new things you want to add or old ones you'd like to change. The problem I always have with inheriting player starts/pawns and creating my own actors from them, though, is that when I try to start the game using them it tells me there is no Player 1 start. And of course if I do place a regular Player 1 start, the default actor is used rather than the one I created. If someone knows how to bypass this (I'm sure there's a way), please let me know. Inheritance would obviously make this all much easier because you wouldn't have to copy that big actor definition from the link above and add one measly line of code.

Share this post


Link to post
chubz said:

If someone knows how to bypass this (I'm sure there's a way), please let me know. Inheritance would obviously make this all much easier because you wouldn't have to copy that big actor definition from the link above and add one measly line of code.


You add the new actor class to MAPINFO. For example, in my TC, I have a new actor class called "WhiteLord", defined in DECORATE.

ACTOR WhiteLord : PlayerPawn
etc.

In MAPINFO, in the GAMEINFO section, I added this:
playerclasses = "WhiteLord"
which just uses the new actor class and completely ignores the original one.

Hope that helps.

Share this post


Link to post

Ick. Why suggest copying the entire DoomPlayer definition? Just have the new player class inherit from DoomPlayer.

Note that you'll have to redefine the two Player.StartItem definitions from DoomPlayer as well, since adding a new one will toss the old list (for ease of inheritance). Just be sure to explicitly give a chainsaw, the fist, a pistol, and 50 bullets. FYI, the first-defined weapon is the one that's selected at first.

Share this post


Link to post
Xaser said:

Ick. Why suggest copying the entire DoomPlayer definition? Just have the new player class inherit from DoomPlayer.


Read the rest of my post, or even Eponasoft's reply. :-)

Share this post


Link to post

Cheers chubz!

I've used your method and it works just fine, even if it's a bit cumbersome to copy all of that stuff just to add 1 measly line!

Xaser, can you provide a short Decorate example of what inheriting would look like? I tried to just add that one line in a Decorate entry and it didn't work.

Thanks to all!

Share this post


Link to post
glenzinho said:

Cheers chubz!

I've used your method and it works just fine, even if it's a bit cumbersome to copy all of that stuff just to add 1 measly line!

Xaser, can you provide a short Decorate example of what inheriting would look like? I tried to just add that one line in a Decorate entry and it didn't work.

Thanks to all!


From now on you'll want to use the method suggested by Eponasoft and Xaser. I gave it a shot and it worked flawlessly. Below are step-by-step instructions on how to create a chainsaw wielding player (also equipped with fists and pistol) without copying and pasting the entire actor definition from the link above:

1. Create a new DECORATE entry in your WAD.
2. Type the following lines of code:

actor ChainsawPlayer : DoomPlayer
{
   Player.StartItem "Chainsaw"
   Player.StartItem "Pistol"
   Player.StartItem "Fist"
   Player.StartItem "Clip", 50
}
3. Create a new MAPINFO entry in your WAD.
4. Type the following lines of code:
gameinfo
{
    playerclasses = "ChainsawPlayer"
}
You're finished! Now, let's break this down a little further.

In step two, you're using inheritance to take every property from the DoomPlayer actor and modify it only so that you also begin with the chainsaw. The new actor you're creating is called ChainsawPlayer. This is just a custom name I decided on. The colon (:) indicates inheritance and the actor following the colon -- DoomPlayer, in this case -- is the one you're inheriting every property from. The other weapons are also included because when you change the StartItem, even if you're just adding one, you need to include all the others you'd like the player to start with as well. If you were to use only the chainsaw line of code, you'd start with the chainsaw and nothing else!

In step four, you're changing the player class from the regular DoomPlayer to the ChainsawPlayer actor you created in step two.

When you start the game, every Player Start Thing will spawn a player who wields a chainsaw and also has his fists and pistol in his inventory.

Share this post


Link to post

Fan-fucken-tastic chubz!

You've explained it so that even I can understand!!!

One day we'll have to make the zdoom wiki so that it is me-proof!! ;)

[edit]
Hang on I just got this on gzdoom startup:

Script error, "FtopStuff.wad:MAPINFO" line 9:
gameinfo definitions not supported with old MAPINFO syntax

Share this post


Link to post

Get the MAPINFO converter from here (scroll down a bit, it's between the ZDBSP source and the WadAuthor configs).

You could also convert by hand, but if you don't understand the wiki, it might be simpler to let a tool do the work for you.

Share this post


Link to post

Nope, still don't get it... Here is my MAPINFO lump:


defaultmap
fallingdamage
sky1 LAVA1

map MAP01 "Firetop Mountain"
next EndGameC
music D_RUNNIN

gameinfo
{
playerclasses = "ChainsawPlayer"
}

I'll be honest here Gez, I've only got back into computers after 15 years or so in the last year and I've got no idea what to do with a Windows binary or source code that the mapinfo converter comes as... the only stuff I remember how to do is basic Doom editing stuff... I can figure some stuff out but I need some other stuff spelled out to me like I'm an idiot sometimes!!

Share this post


Link to post

This should work.

defaultmap
{
    fallingdamage
    sky1 = LAVA1
}

map MAP01 "Firetop Mountain"
{
    next = EndGameC
    music = D_RUNNIN
}

gameinfo
{
    playerclasses = "ChainsawPlayer"
}

Share this post


Link to post

The new MAPINFO format requires all sections to be enclosed in curly braces, and values have to be assigned with the equals sign, like Gez shows. It's generally better to do this kind of stuff by hand than to rely on an automatic tool.

Share this post


Link to post

Cheers Gez, works perfectly!!!

Thanks again to chubz, Gez and Eponasoft for spelling this out for me!!
And to everyone else who tried to help!

Share this post


Link to post
Guest
This topic is now closed to further replies.
×