Decorate and Player Starts

Ask about ACS, DECORATE, ZScript, or any other scripting questions here!

Moderator: GZDoom Developers

Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. If you still don't understand how to use a feature, then ask here.

Decorate and Player Starts

Postby rabidrage » Sat Mar 27, 2021 3:54 pm

This might be something people have known for years...or it might be ridiculous and impossible, but...

I want to work in new things with my mod so that they alter existing maps. I've learned that by giving things the same editor number as DM and Coop starts, I can make them show up in interesting places. But having a monster spawn attacking the player immediately when they start the level, from behind, is kind of lame. So is there a way to twist it so that the Player 1 Start has the editor number of, say, the Player 3 Start? I want to make it happen in Decorate, if possible.
rabidrage
 
Joined: 28 Oct 2014

Re: Decorate and Player Starts

Postby Player701 » Sun Mar 28, 2021 4:11 am

You cannot do anything with player starts in DECORATE, since they are not actors. But you can use MAPINFO for that.

Code: Select allExpand view
DoomEdNums
{
    3 = "$Player1Start"
    1 = "$Player3Start"
}

The above code swaps the editor numbers of Player 3 and Player 1 starts. Note that removing the Player 3 start reassignment will result in a duplicate Player 1 start appearing on the map, and a voodoo doll will be spawned in its place (and you will also not be able to control where exactly the actual player will spawn, because it is determined by the order of records in the map's THINGS lump). However, this will also break any single-player or 2-player-only maps that do not have a Player 3 start.
User avatar
Player701
 
 
 
Joined: 13 May 2009
Location: Russia
Discord: Player701#8214
Operating System: Windows 10/8.1/8/201x 64-bit
OS Test Version: No (Using Stable Public Version)
Graphics Processor: nVidia with Vulkan support

Re: Decorate and Player Starts

Postby rabidrage » Mon Mar 29, 2021 10:15 am

Thanks! I should actually be able to do a lot with this. I'm aware this could cause unforeseen (and definitely foreseen) complications, but it's an experiment at the moment. Until I add custom maps to the mod, I want to be able to bring new Things into the picture and have them be as universal as possible. I'm thinking of grabbing WADs I like and making a custom megawad out of them (credit given to each mapper, of course). Then I can place the new Things in those maps.
rabidrage
 
Joined: 28 Oct 2014

Re: Decorate and Player Starts

Postby rabidrage » Mon Mar 29, 2021 10:40 am

Actually, so far it doesn't seem to be moving the Player 1 Start at all. I put the code in MapInfo. There are, however, no maps in there yet. But above it I have this:

Code: Select allExpand view
gameinfo{
pickupcolor = "7F7FFF"
   PlayerClasses = "GBADoomPlayer"
}


and it works.
rabidrage
 
Joined: 28 Oct 2014

Re: Decorate and Player Starts

Postby Polly Besslewill » Mon Mar 29, 2021 5:07 pm

Since I've put an enemy in place of all the DM spawns, I guess all I really need is a way to prevent the one near the P1 Start from appearing. So far no luck with adding an invisible actor with an editor number of 11 that spawns them with a jumpifcloser function. I might not be able to do this.
Polly Besslewill
 

Re: Decorate and Player Starts

Postby Player701 » Tue Mar 30, 2021 12:34 am

rabidrage wrote:Actually, so far it doesn't seem to be moving the Player 1 Start at all. I put the code in MapInfo. There are, however, no maps in there yet. But above it I have this:

Code: Select allExpand view
gameinfo{
pickupcolor = "7F7FFF"
   PlayerClasses = "GBADoomPlayer"
}


and it works.

If the MAPINFO code to reassign player start editor numbers is not working for you, perhaps you're using an older version of GZDoom or Zandronum. In this case, there is probably no way to swap player starts at all, unless, in case you're using Zandronum, its developers implement it in future releases.

Polly Besslewill wrote:Since I've put an enemy in place of all the DM spawns, I guess all I really need is a way to prevent the one near the P1 Start from appearing. So far no luck with adding an invisible actor with an editor number of 11 that spawns them with a jumpifcloser function. I might not be able to do this.

A_JumpIfCloser requires the calling actor to have a target, so your spawner actor should acquire one first before you can run any checks on it. You have to call A_Look once to have a chance of acquiring a target; also give your spawner the LOOKALLAROUND flag to ensure that players can be detected in a circle around it.

Code: Select allExpand view
actor TestSpawner
{
    +LOOKALLAROUND
   
    States
    {
        Spawn:
            TNT1 A 0
            TNT1 A 0 A_Look
            TNT1 A 0 A_JumpIfCloser(384, 2)
            TNT1 A 0 A_SpawnItemEx("DoomImp")
            TNT1 A 0
            Stop
    }
}
User avatar
Player701
 
 
 
Joined: 13 May 2009
Location: Russia
Discord: Player701#8214
Operating System: Windows 10/8.1/8/201x 64-bit
OS Test Version: No (Using Stable Public Version)
Graphics Processor: nVidia with Vulkan support

Re: Decorate and Player Starts

Postby rabidrage » Thu Apr 01, 2021 9:47 am

Okay. First off, I finally slowed down long enough to have the forum log me in automatically. I'm sure you're annoyed with me popping up under random names. :P

Second, your actor works! The thing is that I'm not sure why. Like, I'm not sure how this gives the spawner a target where my attempts at a spawner don't. It doesn't seem to establish a state where the spawner doesn't spawn, nor does it seem to establish a target, unless the target is...2? But the player doesn't automatically have an actor number, so...

I'm so confused!

Obviously there is still a lot I don't understand about all this. For all that I've pulled off, sometimes I still feel clueless.
rabidrage
 
Joined: 28 Oct 2014

Re: Decorate and Player Starts

Postby Player701 » Thu Apr 01, 2021 10:02 am

rabidrage wrote:Second, your actor works! The thing is that I'm not sure why.

It's rather simple, actually. First, we call A_Look to look for players, so that if a player is near, the spawner acquires a target. (Since it has LOOKALLAROUND, it will look for players regardless of the direction it's facing.) Then, A_JumpIfCloser is called. If there is no target present, or if the target is too far away, the jump doesn't happen, so the execution continues normally and calls A_SpawnItemEx to spawn a monster. If a target is present and is also sufficiently close to the spawner, A_JumpItemEx jumps 2 states forward and lands on the last "TNT1 A 0" line, skipping the call to A_SpawnItemEx.
User avatar
Player701
 
 
 
Joined: 13 May 2009
Location: Russia
Discord: Player701#8214
Operating System: Windows 10/8.1/8/201x 64-bit
OS Test Version: No (Using Stable Public Version)
Graphics Processor: nVidia with Vulkan support

Re: Decorate and Player Starts

Postby rabidrage » Thu Apr 01, 2021 11:04 am

And now it all makes sense! Thank you very much. So A_Look will always by default have something look for players without setting the player as a target any other way?
rabidrage
 
Joined: 28 Oct 2014

Re: Decorate and Player Starts

Postby Player701 » Thu Apr 01, 2021 11:31 am

I'm not sure if I understood your question completely. A_Look indeed does look for players, and if it finds one, it sets the target pointer of the calling actor to that player and also jumps to the See state provided that it exists (the DECORATE code that I posted does not have one).
User avatar
Player701
 
 
 
Joined: 13 May 2009
Location: Russia
Discord: Player701#8214
Operating System: Windows 10/8.1/8/201x 64-bit
OS Test Version: No (Using Stable Public Version)
Graphics Processor: nVidia with Vulkan support

Re: Decorate and Player Starts

Postby rabidrage » Mon Apr 05, 2021 1:26 pm

You answered it perfectly. I just wasn't sure if something had to be classed as a monster or not before its automatic target would the player, let alone anything at all.
rabidrage
 
Joined: 28 Oct 2014


Return to Scripting

Who is online

Users browsing this forum: bjork and 1 guest