Page 1 of 1

Scripting help

Posted: Mon Nov 27, 2017 8:17 am
by HellBlade64
I'm decent at coding, but I'm still not fantastic all these years later. I'm trying to set a script to kill someone... OK let me give a little more context to that.

For the past year or so, I've been working on and off, little by little, on my own version of Hard Doom aptly named "Hard Doom: HellBlade Edition" or alternatively, "Hard Doom: Hard Edition".

One of the many features of this version is that Fast Monsters is stuck permanently on.

This is thanks to a classic "If Then" script that makes sure sv_fastmonsters always equals 1.

If it detects that sv_fastmonsters is disabled, it triggers a rather silly easter-egg (I think that's what it is).

Part of the easter egg includes playing sounds and printing hud messages.
Spoiler: (Open)
script 594 (void)
{
SetFont("BIGFONT");
if(GetCVAR("sv_fastmonsters") == 0)
{
ConsoleCommand("sv_fastmonsters 2");
ConsoleCommand("echo DO YOU SUCK DICKS?");
ClearInventory();
GiveInventory("Pistol~",1);
GiveInventory("Fist~",1);
GiveInventory("Clip",30);
AmbientSound("SUCKDICKS",100);
HudMessage(s:"\cjDO YOU SUCK DICKS?"; HUDMSG_FADEOUT,0,CR_BLUE,0.5,0.6,3.0,3.0);
Delay(120);
AmbientSound("SCROUNGEY",100);
HudMessage(s:"\cgYou scroungey little fuck!!"; HUDMSG_FADEOUT,0,CR_YELLOW,0.5,0.65,3.0,3.0);
Delay(120);
HudMessage(s:"\cgI WILL PT YOU ALL UNTIL YOU FUCKING DIE!!"; HUDMSG_FADEOUT,0,CR_BLUE,0.5,0.6,3.0,3.0);
AmbientSound("FUCKINGDIE",100);
Delay(72);
On the word "DIE!", the player who activated the script gets killed. Originally, I accomplished this by spawning a strong explosion, but my friend (who's been helping me test it every step of the way) told me that it should only kill the activator, and not kill anyone around him.

So therein lies my problem. I've tried both DamageThing and Thing_Damage to try and kill the activator.
Another thing that might be adding to the problem is that I'm trying to make this work on a server. Well, it doesn't work on +netgame emulation, anyways.

All help is appreciated, no matter how little.

Re: Scripting help

Posted: Mon Nov 27, 2017 8:48 am
by Fused
So, you want to kill all players, and not just the activator? I'm confused, because at one moment you imply you want to kill everyone, and then you just want to kill the activator.
Anyway, I assume the activator is actually a player, and not the server. Thing_damage should do the trick in this case. Simply make a loop that loops through all playerIDs and kill them.

Here's an example from Zombie Horde 2. INT_MAX can just be a very high number in your case. It's part of ACSutils, which can prove extremely useful

Code: Select all

// Kill all who aren't safe.
if (GetGameMode() == ZEGAME)
{
	for(int i = 0; i < MAX_PLAYERS; ++i) 
	{
		if (!player[i].safe) {
			Thing_Damage(PLAYER_TID+i, INT_MAX, MOD_EXIT);
		}
	}
}
And I'm not too font of this easter egg. Sounds alot like a terrytrap that just ruins your mod, honestly. And what happends when somebody forgot to turn it on? Do they actually get this too?

Re: Scripting help

Posted: Tue Nov 28, 2017 4:04 am
by HellBlade64
Fused wrote:
Mon Nov 27, 2017 8:48 am
So, you want to kill all players, and not just the activator? I'm confused, because at one moment you imply you want to kill everyone, and then you just want to kill the activator.
Anyway, I assume the activator is actually a player, and not the server. Thing_damage should do the trick in this case. Simply make a loop that loops through all playerIDs and kill them.

Here's an example from Zombie Horde 2. INT_MAX can just be a very high number in your case. It's part of ACSutils, which can prove extremely useful

Code: Select all

// Kill all who aren't safe.
if (GetGameMode() == ZEGAME)
{
	for(int i = 0; i < MAX_PLAYERS; ++i) 
	{
		if (!player[i].safe) {
			Thing_Damage(PLAYER_TID+i, INT_MAX, MOD_EXIT);
		}
	}
}
And I'm not too font of this easter egg. Sounds alot like a terrytrap that just ruins your mod, honestly. And what happends when somebody forgot to turn it on? Do they actually get this too?
What I was referring to in my original post is that the radius of the spawned explosion was big enough that the explosion could unintentionally kill a player or monster (similar to how Legendary's Complex Addon's expansions spawn you in with an explosion that kills nearby enemies). I don'

"And what happends when somebody forgot to turn it on? Do they actually get this too?"

If someone forgot to turn on... what? Fast Monsters? What I showed was only the check script, there's another script, the enter script, and one of it's commands is that it sets sv_fastmonsters 1.

So in other words, it's stuck in the "on" position.

So (other than the obvious) how would I get Thing_Damage to target and kill the activator?

I know, I'm a big dummy or something like that. :biggrin:

Re: Scripting help

Posted: Tue Nov 28, 2017 8:16 am
by Fused
HellBlade64 wrote:
Tue Nov 28, 2017 4:04 am
So how would I get Thing_Damage to target and kill the activator?
You do the same thing as I did, but instead of PLAYER_TID+i, you just use ActivatorTID(), and no loop at all. This implies however that you do have the player you want killed as the actual activator, and not the server as I said before. This might be where your problem lies if you don't have anything happening. Where is this script called from? A good way to debug would be printing ActivatorTID(). If it returns -1, then you have the server as your activator.

Re: Scripting help

Posted: Fri Dec 01, 2017 9:10 pm
by HellBlade64
The script is called from the same enter script that enables sv_fastmonsters.

Re: Scripting help

Posted: Fri Dec 01, 2017 10:22 pm
by Fused
And how is that one called?

Re: Scripting help

Posted: Mon Dec 11, 2017 7:37 am
by HellBlade64
Fused wrote:
Fri Dec 01, 2017 10:22 pm
And how is that one called?
HellBlade64 wrote:
Fri Dec 01, 2017 9:10 pm
The script is called from the same ENTER script that enables sv_fastmonsters.
The script starts automatically.

Re: Scripting help

Posted: Sat Mar 03, 2018 1:14 pm
by HellBlade64
Update: I've decided to remove the fast monsters lock. It was kinda gay.

In light of that, there's another problem I'm encountering.

I wrote out custom obituaries for the Hard Doom monsters and vanilla monsters which are based upon the obituaries found in Duel32.
The problem I've been having is that Zandronum is not recognizing some obituaries.

As an example, here are the obituaries for a Rictus' kamikaze attack and a Lost Soul's attack.

"Rictus > Kamikaze > %o"
"Lost Soul > Charge > %o"

However, in game, Rictus' kamikaze attack obituary appears as "%o died" or in my case "Death > %o" (because custom obits.) and Lost Soul's obituary appears as "%o was spooked by a Lost Soul."

Re: Scripting help

Posted: Sat Mar 03, 2018 10:10 pm
by arkore
Is that attack using A_SpawnItemEx for any projectiles or such ? https://zdoom.org/wiki/A_SpawnItemEx You might have to add the SXF_TRANSFERPOINTERS flag?

Re: Scripting help

Posted: Sun Mar 04, 2018 5:17 pm
by HellBlade64
The Rictus kamikaze? Yeah.

"RICT A 0 Bright A_CustomMissile (RictusKamakazi,0,0,0,0,0)"