I hope this would be possible in future, too. In Unreal Engine, the class is called PlayerController and it stays persistent across maps. Only the PlayerPawn is the physical thing that you see running around the level, and those get created and destroyed per level. You would store things like the player's experience points on the PlayerController and those would never get destroyed between levels.Major Cooke wrote:Curious. Would it be possible to have local vars on players that could be saved when transitioning from one map to another, like inventory?
ZScript Discussion
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.
Please bear in mind that the people helping you do not automatically know how much you know. You may be asked to upload your project file to look at. Don't be afraid to ask questions about what things mean, but also please be patient with the people trying to help you. (And helpers, please be patient with the person you're trying to help!)
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.
Please bear in mind that the people helping you do not automatically know how much you know. You may be asked to upload your project file to look at. Don't be afraid to ask questions about what things mean, but also please be patient with the people trying to help you. (And helpers, please be patient with the person you're trying to help!)
-
Nash
-

- Posts: 17511
- Joined: Mon Oct 27, 2003 12:07 am
- Location: Kuala Lumpur, Malaysia
Re: ZScript Discussion
-
Nash
-

- Posts: 17511
- Joined: Mon Oct 27, 2003 12:07 am
- Location: Kuala Lumpur, Malaysia
Re: ZScript Discussion
Code: Select all
class Z_Player : DoomPlayer
{
Default
{
Player.StartItem "Fist";
}
override void Tick()
{
A_SetAngle(angle + 0.0025, SPF_INTERPOLATE);
A_SetRoll(roll + 0.0025, SPF_INTERPOLATE);
Super.Tick();
}
}
EDIT: I forgot that the angles in DECORATE is in degrees. The correct way is:
Code: Select all
class Z_Player : DoomPlayer
{
Default
{
Player.StartItem "Fist";
}
override void Tick()
{
// roll the view 1 degree every tic. wheeeee
A_SetRoll(roll + 1.f);
Super.Tick();
}
}
-
Major Cooke
- Posts: 8218
- Joined: Sun Jan 28, 2007 3:55 pm
- Preferred Pronouns: He/Him
- Operating System Version (Optional): Windows 10
- Graphics Processor: nVidia with Vulkan support
- Location: GZBoomer Town
Re: ZScript Discussion
Suggestion: Don't do it on the doom player itself. Have something else do it instead. I.e. have an ACS script spawn an actor which then grabs the player(s) immediately, and performs stuff on them. The ACS would be merely to spawn the actor, nothing more.
Otherwise, it'll be far less mod compatible. Just look at all the players who complained qtilt done fucking broke with D4D.

Otherwise, it'll be far less mod compatible. Just look at all the players who complained qtilt done fucking broke with D4D.
Please and thank you.Nash wrote:I hope this would be possible in future, too. In Unreal Engine, the class is called PlayerController and it stays persistent across maps. Only the PlayerPawn is the physical thing that you see running around the level, and those get created and destroyed per level. You would store things like the player's experience points on the PlayerController and those would never get destroyed between levels.Major Cooke wrote:Curious. Would it be possible to have local vars on players that could be saved when transitioning from one map to another, like inventory?
-
Ed the Bat
- Posts: 3060
- Joined: Thu May 03, 2012 1:18 pm
- Location: Maryland, US
Re: ZScript Discussion
Is there a method yet to retrieve the class name of a player? I have a set of ACS scripts that are named after player classes (with the word "Spawner" on the end; concatenation would hopefully help me address that), and would like to call them just based on what classes are being played, so I'll need the names in a format I can give to CallACS().
-
Graf Zahl
- Lead GZDoom+Raze Developer

- Posts: 49252
- Joined: Sat Jul 19, 2003 10:19 am
- Location: Germany
Re: ZScript Discussion
Nash wrote:I hope this would be possible in future, too. In Unreal Engine, the class is called PlayerController and it stays persistent across maps. Only the PlayerPawn is the physical thing that you see running around the level, and those get created and destroyed per level. You would store things like the player's experience points on the PlayerController and those would never get destroyed between levels.
Actually, the PlayerPawn in ZDoom is carried over a level exit. You only lose it when you die and respawn.
-
Nash
-

- Posts: 17511
- Joined: Mon Oct 27, 2003 12:07 am
- Location: Kuala Lumpur, Malaysia
Re: ZScript Discussion
Qtilt was always meant to be a modder's resource/learning example... I didn't make it as a modular autoload thing. Not my fault that I can't control what players do with mods.Major Cooke wrote:Suggestion: Don't do it on the doom player itself. Have something else do it instead. I.e. have an ACS script spawn an actor which then grabs the player(s) immediately, and performs stuff on them. The ACS would be merely to spawn the actor, nothing more.
Otherwise, it'll be far less mod compatible. Just look at all the players who complained qtilt done fucking broke with D4D.
Making mods that alter the player's angle/pitch/roll be modular and play nice with each other is kind of difficult/impossible because ideally, the actual angle changes should only be handled at the end/close to the end of the "pipeline" and only called once. Everything that happens before this point in time should only collect a "buffer" of the angle changes. Good luck getting every mod to agree with this... :O
But yeah, point taken. Can you show me how to make another actor control the player pawns in their Tick method? I don't quite understand how to establish the relationship.
-
D2JK
- Posts: 545
- Joined: Sat Aug 30, 2014 8:21 am
Re: ZScript Discussion
About the Tick() function: if it's fairly simple to have the constant actions on an actor execute within states, are there any benefits in moving these actions into the Tick() function instead, such as (slightly) better performance?
-
Graf Zahl
- Lead GZDoom+Raze Developer

- Posts: 49252
- Joined: Sat Jul 19, 2003 10:19 am
- Location: Germany
Re: ZScript Discussion
No, it's about better control for some things. Tick() is the main driving function in the game, it gets executed once each tic. Which means it's better do do stuff that needs to be independent of states.
-
Major Cooke
- Posts: 8218
- Joined: Sun Jan 28, 2007 3:55 pm
- Preferred Pronouns: He/Him
- Operating System Version (Optional): Windows 10
- Graphics Processor: nVidia with Vulkan support
- Location: GZBoomer Town
Re: ZScript Discussion
So with this round of internal scripting conversion done, what's next?
-
Graf Zahl
- Lead GZDoom+Raze Developer

- Posts: 49252
- Joined: Sat Jul 19, 2003 10:19 am
- Location: Germany
Re: ZScript Discussion
I am goinfg though the source right now to see what function still need to be exported. After that, benchmarking. The VM currently allocated memory like crazy and I want to see where I can somehow get that under control and make faster. A scripted function call is a horrendously inefficient affair right now and the can cause problems later when code gets more complex.
-
Major Cooke
- Posts: 8218
- Joined: Sun Jan 28, 2007 3:55 pm
- Preferred Pronouns: He/Him
- Operating System Version (Optional): Windows 10
- Graphics Processor: nVidia with Vulkan support
- Location: GZBoomer Town
Re: ZScript Discussion
Here's one you can do.
Hmm, you did talk about attempting to export P_DamageMobj directly but that sounds like hell. It would be nice if something could be done about pain and/or wound functions.
Hmm, you did talk about attempting to export P_DamageMobj directly but that sounds like hell. It would be nice if something could be done about pain and/or wound functions.
-
Major Cooke
- Posts: 8218
- Joined: Sun Jan 28, 2007 3:55 pm
- Preferred Pronouns: He/Him
- Operating System Version (Optional): Windows 10
- Graphics Processor: nVidia with Vulkan support
- Location: GZBoomer Town
Re: ZScript Discussion
Oh snap. Local arrays are in now? Can they accept the same types as their constant counterparts?
-
Nash
-

- Posts: 17511
- Joined: Mon Oct 27, 2003 12:07 am
- Location: Kuala Lumpur, Malaysia
Re: ZScript Discussion
@Major Cooke:
@Graf Zahl:
I have some C++ actors that do things like this:
Will ZScript allow scripted access to consoleplayer?
Help me help you. I'm going to convert everything I've ever released into ZScript and I don't want to end up making stuff that will break your mods. :PNash wrote:Can you show me how to make another actor control the player pawns in their Tick method? I don't quite understand how to establish the relationship.
@Graf Zahl:
I have some C++ actors that do things like this:
Code: Select all
//===========================================================================
//
//===========================================================================
IMPLEMENT_CLASS (APrecipitation)
void APrecipitation::Tick ()
{
Super::Tick ();
if (tracer == nullptr)
{
return;
}
// hide rain from other players
if (tracer != nullptr && tracer != players[consoleplayer].mo)
{
renderflags |= RF_INVISIBLE;
}
}
-
Major Cooke
- Posts: 8218
- Joined: Sun Jan 28, 2007 3:55 pm
- Preferred Pronouns: He/Him
- Operating System Version (Optional): Windows 10
- Graphics Processor: nVidia with Vulkan support
- Location: GZBoomer Town
Re: ZScript Discussion
D'oh fuck I forgot. Okay. I'll get to it in the morning.
-
Edward-san
- Posts: 1774
- Joined: Sat Oct 17, 2009 9:40 am
Re: ZScript Discussion
'consoleplayer' should work on you. But in any case that code would break with coop spying, so you should use '!tracer.CheckLocalView(consoleplayer)' in place of 'tracer != players[consoleplayer].mo'.Nash wrote:Will ZScript allow scripted access to consoleplayer?