The "How do I..." Thread

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.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49230
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: The "How do I..." Thread

Post by Graf Zahl »

Judging from the sprite names - yes.
User avatar
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

Post by Matt »

Oh, right, should be MISG in the launcher not MISL.

Have you tried shooting it into a ceiling?
Elias79
Posts: 50
Joined: Mon Jan 30, 2017 6:09 am

Re: The "How do I..." Thread

Post by Elias79 »

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.
User avatar
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

Post by Wiw »

Vaecrius wrote:Oh, right, should be MISG in the launcher not MISL.

Have you tried shooting it into a ceiling?
Well, now I just get propelled backwards at ludicrous speeds.
User avatar
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

Post by Matt »

That is very odd why calling target.A_ChangeVelocity would not work.

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;
   }
}
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.)
User avatar
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

Post by Wiw »

Yeah, it kinda works! But how am I supposed to let go?
Elias79
Posts: 50
Joined: Mon Jan 30, 2017 6:09 am

Re: The "How do I..." Thread

Post by Elias79 »

What am i doing wrong here?

Code: Select all

If(GetPlayerLivesLeft == 3) { Print(s:"PlayerLivesLeft = 3"); }
User avatar
ZZYZX
 
 
Posts: 1384
Joined: Sun Oct 14, 2012 1:43 am
Location: Ukraine
Contact:

Re: The "How do I..." Thread

Post by ZZYZX »

Everything.

You should do GetPlayerLivesLeft(<put player number here>), e.g. GetPlayerLivesLeft(PlayerNumber()).

https://zdoom.org/wiki/Functions
https://zdoom.org/wiki/GetPlayerLivesLeft
Elias79
Posts: 50
Joined: Mon Jan 30, 2017 6:09 am

Re: The "How do I..." Thread

Post by Elias79 »

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
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.¨

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"); }
}
I am not a "programmer" yet so far only done simple Python coding.
User avatar
ZZYZX
 
 
Posts: 1384
Joined: Sun Oct 14, 2012 1:43 am
Location: Ukraine
Contact:

Re: The "How do I..." Thread

Post by ZZYZX »

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 :)
User avatar
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

Post by Matt »

Wiw wrote:Yeah, it kinda works! But how am I supposed to let go?
Switching weapons. The "!SucketLauncher(target.player.readyweapon)" checks to see that the player does not ("!x" means "not x") have that weapon out.

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)){
you would let go once you hit altfire, switched or tried shooting a second hook.

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){
So uh, yeah a better way to do this would be really appreciated because ew.
Nevander
Posts: 2254
Joined: Mon Jan 06, 2014 11:32 pm

Re: The "How do I..." Thread

Post by Nevander »

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:
Damage settings from regular Doom sector types or UDMF map settings will be overridden by this. (New from 2.8.1)
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.

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.
User avatar
4thcharacter
Banned User
Posts: 1183
Joined: Tue Jun 02, 2015 7:54 am

Re: The "How do I..." Thread

Post by 4thcharacter »

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.

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
  }
}
How do I stop that?

EDIT: NVM. It was the lone A_Playsound. Didn't know that would happen if you have that somewhere.
LogicalFallacy
Posts: 89
Joined: Tue May 24, 2016 8:59 am

Re: The "How do I..." Thread

Post by LogicalFallacy »

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.
User avatar
DoomKrakken
Posts: 3489
Joined: Sun Oct 19, 2014 6:45 pm
Location: Plahnit Urff
Contact:

Re: The "How do I..." Thread

Post by DoomKrakken »

LogicalFallacy wrote: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.
ARGENT
MetaDoom
Locked

Return to “Editing (Archive)”