Starting a level with Fists only (Resolved)

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
SlapTheFish
Posts: 61
Joined: Fri Jun 14, 2013 5:51 pm
Location: Australia

Starting a level with Fists only (Resolved)

Post by SlapTheFish »

Hello everyone,
Does anyone know what I have to do to get the player to begin Level 1 with only the fists :?:
I'm guessing it involves code.
Thank you! :mrgreen:
Last edited by SlapTheFish on Mon Aug 12, 2013 1:25 am, edited 1 time in total.
Blue Shadow
Posts: 5046
Joined: Sun Nov 14, 2010 12:59 am

Re: Starting a level with Fists only.

Post by Blue Shadow »

Make [wiki=Creating_new_player_classes]a new player class[/wiki], defining the items the player starts the game with by using [wiki=Player_properties#Player.StartItem]Player.StartItem[/wiki] property.

Code: Select all

ACTOR MyPlayer : DoomPlayer
{
  Player.StartItem "Fist"
}
User avatar
cocka
Posts: 1520
Joined: Sat Jul 02, 2011 7:21 am
Location: Hungary

Re: Starting a level with Fists only.

Post by cocka »

I would use this code:

Code: Select all

script 1 ENTER
{
TakeInventory("Pistol", 1);
SetWeapon("Fist");
}

User avatar
::Bloodfury::
Posts: 332
Joined: Mon Aug 01, 2011 7:39 pm
Graphics Processor: nVidia (Modern GZDoom)
Location: Finland

Re: Starting a level with Fists only.

Post by ::Bloodfury:: »

I personally use and would use this:

Code: Select all


Script 01 Open or Enter

Clear.Inventory ();
delay (amount);
Give inventory ("fist");
Thus it does not matter which player class you have, ignores difficulties etc. When the map starts, it clears all your items/weapons and sets the first weapon to use as a fist.
User avatar
edward850
Posts: 5902
Joined: Tue Jul 19, 2005 9:06 pm
Location: New Zealand
Contact:

Re: Starting a level with Fists only.

Post by edward850 »

And the point of the delay is to do what, exactly?
User avatar
cocka
Posts: 1520
Joined: Sat Jul 02, 2011 7:21 am
Location: Hungary

Re: Starting a level with Fists only.

Post by cocka »

And what is the point of an OPEN script here? :roll:
User avatar
FDARI
Posts: 1097
Joined: Tue Nov 03, 2009 9:19 am

Re: Starting a level with Fists only.

Post by FDARI »

The only relevant potentially correct change I see is the use of [wiki]ClearInventory[/wiki]() over [wiki]TakeInventory[/wiki]("Pistol", 1). This change also provides (on its own) the effect Bloodfury describes. You start every level with just a fist, regardless of player class and inventory from previous levels. (And since you cleared inventory a new fist has to be given.)

There may be player classes where this is a problem. For example, a player class where there is an essential weapon that you start with and will not find as a pickup. However, if you play only with compatible player classes, and want to lose everything at the start of every level, ClearInventory is a nice function.

Note though: ClearInventory will not remove "Undroppable" items. But that's probably a good thing. That should potentially increase compatibility with unknown mods. (Where essential items you start with or carry across levels might be marked as undroppable, and thus saved from gamebreaking ClearInventory.)

I notice though, now at long long last, that you ask how to begin level 1 with just fists. Note that the pistol is not a pickup, so it will never be recovered. Presumably, you're going to use the default class (since you're not just making a new starting class). Just removing the pistol exactly as in the opening script is actually ideal for that purpose. It will happen on every level, but since you'll never pick up a new one, the script only matters at level 1.

(A new player class would be a more to-the-point solution, though, and with less potential for side effects. Do you know how to create and use one?)
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49252
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: Starting a level with Fists only.

Post by Graf Zahl »

FDARI wrote:Note that the pistol is not a pickup, so it will never be recovered.

That's not entirely correct. ZDoom does have a pistol pickup so this advice only applies to gameplay mods without maps.
User avatar
::Bloodfury::
Posts: 332
Joined: Mon Aug 01, 2011 7:39 pm
Graphics Processor: nVidia (Modern GZDoom)
Location: Finland

Re: Starting a level with Fists only.

Post by ::Bloodfury:: »

The delay just came for there.. :D Cuz my map includes a textbrief and thus there is the delay. Not necessary. And OPEN script so if you would create a hub based map it only runs once. Enter script would always clear your inv and sets the fist when you come back to the same map.
User avatar
edward850
Posts: 5902
Joined: Tue Jul 19, 2005 9:06 pm
Location: New Zealand
Contact:

Re: Starting a level with Fists only.

Post by edward850 »

::Bloodfury:: wrote:And OPEN script so if you would create a hub based map it only runs once. Enter script would always clear your inv and sets the fist when you come back to the same map.
This isn't even remotely correct.
  • Never use an OPEN script to generically setup players, as no player will be the activator of the script. The world is.
  • ENTER scripts aren’t executed when returning to another map in a HUB. That’s for RETURN to do.
I suggest you do some reading.
Locked

Return to “Editing (Archive)”