Page 849 of 972
Re: The "How do I..." Thread
Posted: Wed Mar 08, 2017 5:59 pm
by Graf Zahl
Judging from the sprite names - yes.
Re: The "How do I..." Thread
Posted: Wed Mar 08, 2017 6:25 pm
by Matt
Oh, right, should be MISG in the launcher not MISL.
Have you tried shooting it into a ceiling?
Re: The "How do I..." Thread
Posted: Wed Mar 08, 2017 8:28 pm
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.
Re: The "How do I..." Thread
Posted: Thu Mar 09, 2017 6:38 am
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.
Re: The "How do I..." Thread
Posted: Thu Mar 09, 2017 10:46 am
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.)
Re: The "How do I..." Thread
Posted: Thu Mar 09, 2017 11:11 am
by Wiw
Yeah, it kinda works! But how am I supposed to let go?
Re: The "How do I..." Thread
Posted: Thu Mar 09, 2017 11:17 am
by Elias79
What am i doing wrong here?
Code: Select all
If(GetPlayerLivesLeft == 3) { Print(s:"PlayerLivesLeft = 3"); }
Re: The "How do I..." Thread
Posted: Thu Mar 09, 2017 11:24 am
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
Re: The "How do I..." Thread
Posted: Thu Mar 09, 2017 11:38 am
by Elias79
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.
Re: The "How do I..." Thread
Posted: Thu Mar 09, 2017 1:08 pm
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

Re: The "How do I..." Thread
Posted: Thu Mar 09, 2017 3:09 pm
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.
Re: The "How do I..." Thread
Posted: Fri Mar 10, 2017 3:25 am
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.
Re: The "How do I..." Thread
Posted: Fri Mar 10, 2017 4:28 am
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.
Re: The "How do I..." Thread
Posted: Fri Mar 10, 2017 4:48 am
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.
Re: The "How do I..." Thread
Posted: Fri Mar 10, 2017 4:54 am
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