The "How do I..." Thread
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.
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.
- Graf Zahl
- Lead GZDoom+Raze Developer
- Posts: 49230
- Joined: Sat Jul 19, 2003 10:19 am
- Location: Germany
Re: The "How do I..." Thread
Judging from the sprite names - yes.
- Matt
- Posts: 9696
- Joined: Sun Jan 04, 2004 5:37 pm
- Preferred Pronouns: They/Them
- Operating System Version (Optional): Debian Bullseye
- Location: Gotham City SAR, Wyld-Lands of the Lotus People, Dominionist PetroConfederacy of Saudi Canadia
- Contact:
Re: The "How do I..." Thread
Oh, right, should be MISG in the launcher not MISL.
Have you tried shooting it into a ceiling?
Have you tried shooting it into a ceiling?
Re: The "How do I..." Thread
1. How do i make homing missiles using SMF_LOOK exclude a species and or class as the target?
2. How do i create a script that counts the number of times a player died and then does x thing, for example lower speed and health by say 15% each time.
2. How do i create a script that counts the number of times a player died and then does x thing, for example lower speed and health by say 15% each time.
- Wiw
- Posts: 769
- Joined: Thu Jun 11, 2015 1:58 am
- Graphics Processor: nVidia with Vulkan support
- Location: Everywhere and nowhere.
Re: The "How do I..." Thread
Well, now I just get propelled backwards at ludicrous speeds.Vaecrius wrote:Oh, right, should be MISG in the launcher not MISL.
Have you tried shooting it into a ceiling?
- Matt
- Posts: 9696
- Joined: Sun Jan 04, 2004 5:37 pm
- Preferred Pronouns: They/Them
- Operating System Version (Optional): Debian Bullseye
- Location: Gotham City SAR, Wyld-Lands of the Lotus People, Dominionist PetroConfederacy of Saudi Canadia
- Contact:
Re: The "How do I..." Thread
That is very odd why calling target.A_ChangeVelocity would not work.
So here's the fixed version:Still by no means whatsoever anything remotely resembling a finished product but it should be enough for you to get the idea.
(EDIT: I get the problem now... CVF_RELATIVE only ever means relative to whatever's calling the A_ChangeVelocity, so the player is always moving forward or backward rather than towards the hook... the vertical movement is in fact being calculated based on the hook's pitch, it just wasn't making any visible difference because it was either pushing down or not enough to counter gravity.)
So here's the fixed version:
Code: Select all
class ThisRocketSucks:Rocket{
states{
death:
MISL A 2;
MISL A 1{
//eventually it's time to let go
if(!target || target.bkilled || !SucketLauncher(target.player.readyweapon)){
destroy();
return;
}
A_FaceTarget(0,0);
// target.A_ChangeVelocity(cos(self.pitch),0,-sin(self.pitch),CVF_RELATIVE);
target.vel+=(pos-target.pos)*0.04+(0,0,1);
}
wait;
}
}
class SucketLauncher:RocketLauncher{
default{
weapon.ammouse1 0;
}
states{
fire:
MISG B 10 A_FireCustomMissile("ThisRocketSucks");
hold:
MISG B 1;
MISG B 0 A_Refire();
goto ready;
//because we want to shoot things again asap
select:
MISG A 1 A_Raise(48);
wait;
deselect:
MISG A 1 A_Lower(48);
wait;
}
}
(EDIT: I get the problem now... CVF_RELATIVE only ever means relative to whatever's calling the A_ChangeVelocity, so the player is always moving forward or backward rather than towards the hook... the vertical movement is in fact being calculated based on the hook's pitch, it just wasn't making any visible difference because it was either pushing down or not enough to counter gravity.)
- Wiw
- Posts: 769
- Joined: Thu Jun 11, 2015 1:58 am
- Graphics Processor: nVidia with Vulkan support
- Location: Everywhere and nowhere.
Re: The "How do I..." Thread
Yeah, it kinda works! But how am I supposed to let go?
Re: The "How do I..." Thread
What am i doing wrong here?
Code: Select all
If(GetPlayerLivesLeft == 3) { Print(s:"PlayerLivesLeft = 3"); }
Re: The "How do I..." Thread
Everything.
You should do GetPlayerLivesLeft(<put player number here>), e.g. GetPlayerLivesLeft(PlayerNumber()).
https://zdoom.org/wiki/Functions
https://zdoom.org/wiki/GetPlayerLivesLeft
You should do GetPlayerLivesLeft(<put player number here>), e.g. GetPlayerLivesLeft(PlayerNumber()).
https://zdoom.org/wiki/Functions
https://zdoom.org/wiki/GetPlayerLivesLeft
Re: The "How do I..." Thread
I thought i already did that (meaning it is displayed on the screen but it was already automatic in survival mode) but i need a way to store that value in a variable to then use that to change the players stats after each respawn, i will see if i can return the value of the function and print it to the user for example.¨ZZYZX wrote:Everything.
You should do GetPlayerLivesLeft(<put player number here>), e.g. GetPlayerLivesLeft(PlayerNumber()).
https://zdoom.org/wiki/Functions
https://zdoom.org/wiki/GetPlayerLivesLeft
Thanks for the directions ZZYZX
This worked so far:
Code: Select all
script 647 enter
{
//ClearInventory();
GiveInventory("CheckMarines", 1);
int pll = GetPlayerLivesLeft(0);
print(d:pll);
//if(GetPlayerLivesLeft == 3) { Print(s:"PlayerLivesLeft = 3"); }
}
Re: The "How do I..." Thread
Don't use 0 in argument to GetPlayerLivesLeft, use PlayerNumber(). 0 will work offline, but break online, which is not what you want judging by usage of multiplayer functions 

- Matt
- Posts: 9696
- Joined: Sun Jan 04, 2004 5:37 pm
- Preferred Pronouns: They/Them
- Operating System Version (Optional): Debian Bullseye
- Location: Gotham City SAR, Wyld-Lands of the Lotus People, Dominionist PetroConfederacy of Saudi Canadia
- Contact:
Re: The "How do I..." Thread
Switching weapons. The "!SucketLauncher(target.player.readyweapon)" checks to see that the player does not ("!x" means "not x") have that weapon out.Wiw wrote:Yeah, it kinda works! But how am I supposed to let go?
I think if you change that line to
Code: Select all
if(!target || target.bkilled || !SucketLauncher(target.player.readyweapon) || target.getplayerinput(MODINPUT_BUTTONS) & (BT_ATTACK||BT_ALTATTACK)){
EDIT: syntax
EDIT: Question of my own: how do you type a check for getplayerinput for when a button is not being pressed, without bracketing the entire check and putting a ! in front of it? Or is that the best way to do it?
EDIT: The above doesn't work, but this does:
Code: Select all
if(!target || target.bkilled || !SucketLauncher(target.player.readyweapon) || target.getplayerinput(MODINPUT_BUTTONS) & BT_ATTACK || target.getplayerinput(MODINPUT_BUTTONS) & BT_ALTATTACK){
Re: The "How do I..." Thread
This isn't a how but a when...
When did Sector_SetDamage get added to GZDoom? Reason I am asking is because originally in my maps I was using SetSectorDamage (which is the newest and added in 2.8.1 of ZDoom) but found out it doesn't work in old versions due to it being so new. After that, I switched to Sector_SetDamage but much to my surprise even that seems to have no effect whatsoever in my maps on older versions (specifically 2.0.5.0 of GZDoom). I found posts claiming that Sector_SetDamage was working as intended and they were dated 2011, but 2.0.5.0 was released in 2014!
So... wtf? Was there some bug present in 2.0.5.0 that prevented this special from functioning correctly or what?
EDIT: I just discovered this:
I suppose a hacky way to make this fully compatible with old versions is to remove the UDMF damage setting and then use an OPEN script to set the damage instead, then clear it later and not even use the UDMF settings. A lot of extra work but it will be the most compatible.
When did Sector_SetDamage get added to GZDoom? Reason I am asking is because originally in my maps I was using SetSectorDamage (which is the newest and added in 2.8.1 of ZDoom) but found out it doesn't work in old versions due to it being so new. After that, I switched to Sector_SetDamage but much to my surprise even that seems to have no effect whatsoever in my maps on older versions (specifically 2.0.5.0 of GZDoom). I found posts claiming that Sector_SetDamage was working as intended and they were dated 2011, but 2.0.5.0 was released in 2014!
So... wtf? Was there some bug present in 2.0.5.0 that prevented this special from functioning correctly or what?
EDIT: I just discovered this:
FML. This is why it's not working pre-2.8.1 it seems. The special is working but the UDMF specific sector damage setting is not being overridden. Sigh. Is there a way to clear a sector's special or a sector's action with ACS? I know you can change thing and line specials, but I'm not seeing a "SetSectorSpecial" type action here... really need it for something like this.Damage settings from regular Doom sector types or UDMF map settings will be overridden by this. (New from 2.8.1)
I suppose a hacky way to make this fully compatible with old versions is to remove the UDMF damage setting and then use an OPEN script to set the damage instead, then clear it later and not even use the UDMF settings. A lot of extra work but it will be the most compatible.
- 4thcharacter
- Banned User
- Posts: 1183
- Joined: Tue Jun 02, 2015 7:54 am
Re: The "How do I..." Thread
So I made this thing who wanders around and shoots projectiles in random directions, the problem is everytime it fires a projectile the pistol firing sound is heard.
How do I stop that?
EDIT: NVM. It was the lone A_Playsound. Didn't know that would happen if you have that somewhere.
Code: Select all
ACTOR WillOTheWisp
{
Radius 11
Height 8
Mass 800
Health 55
Speed 8
+NOGRAVITY
-COUNTKILL
Deathsound "caco/shotx"
Monster
Tag "Wisp"
Translation "13:15=205:207", "16:47=192:207", "48:79=192:201", "128:128=195:195", "160:167=192:199", "168:191=192:207", "209:223=192:201", "224:231=4:4", "232:235=202:205", "253:253=204:204"
States
{
Spawn:
BAL2 A 1 Bright A_Chase
Goto Missile
Missile:
BAL2 AB 4 Bright A_PlaySound
BAL2 B 3 A_Chase
BAL2 AB 4 Bright A_CustomMissile ("PurpleShot", 8.0, 4.0, random(0,359), 6, (5 - random(0,10)))
BAL2 B 3 A_Chase
BAL2 ABA 4 Bright A_Wander
BAL2 A 3 A_Chase
BAL2 BA 4 Bright A_CustomMissile ("SmallPurpleShot", 8.0, 4.0, random(0,359), 6, (5 - random(0,10)))
BAL2 A 3 A_Chase
BAL2 BAB 4 Bright A_Wander
BAL2 B 3 A_Chase
BAL2 AB 4 Bright A_CustomMissile ("PurpleShot", 8.0, 4.0, random(0,359), 6, (5 - random(0,10)))
BAL2 B 3 A_Chase
BAL2 B 4 Bright A_Wander
BAL2 A 3 A_Chase
BAL2 A 4 Bright A_CustomMissile ("SmallPurpleShot", 8.0, 4.0, random(0,359), 6, (5 - random(0,10)))
Loop
Death:
BAL2 CDE 6
Stop
}
}
EDIT: NVM. It was the lone A_Playsound. Didn't know that would happen if you have that somewhere.
-
- Posts: 89
- Joined: Tue May 24, 2016 8:59 am
Re: The "How do I..." Thread
Could y'all point me at some mods that are using ZScript? I'm interested in updating from GZDoom 2.2, but I learn these kinds of things much better when I can actually see how they're done, as opposed to just reading through the page on the wiki.
- DoomKrakken
- Posts: 3489
- Joined: Sun Oct 19, 2014 6:45 pm
- Location: Plahnit Urff
- Contact: