Problem with making some ACS/Decorate more than 1 tic

Discuss all aspects related to modding Zandronum here.
Post Reply
User avatar
FranckyFox2468
Forum Regular
Posts: 180
Joined: Sat May 07, 2016 8:30 pm

Problem with making some ACS/Decorate more than 1 tic

#1

Post by FranckyFox2468 » Fri Apr 05, 2019 6:11 pm

So recently, using some lan servers and some helpful references and documentation i was pointed to, i'm slowly trying to learn how to optimize decorate/acs to be a little more network friendly. But one of the main problems i have encountered is that apparently scripts that runs per every 1 tics can become problematic, and i have a couple of those
(Including this one by Kaminsky, which i am very thankful for https://zandronum.com/forum/viewtopic.p ... 55#p110411). Whether its for cooldowns, information checks and such.
I was guided towards some alternatives when possible and i tried to clientside some stuff (but doing so resulted in some weapons straight up not acknowledging an item's presence or such)

And my most recent experiment is the one i fear the most will become problematic. Concidering that larger groups of monsters tend to just derp out with patrol nodes because a pixel of em couldnt reach EXACTLY its location, i decided to try making patrol nodes that would unleash a script in a radius that makes them go after the node on their TID+1. The script works and everything but almost everything runs on single tics, and no matter what i seem to do, adding a single tic to ANYTHING seems to make things either derp out massively or straight up not do anything, monsters just standing still as if it didnt exist.

I'll drop the script and if someone can figure something out that'd be appreciated:

ACS:

Code: Select all

int ChasePVE;
int ChaserPVE;

//will eventually add an element that terminates the script if the tid is below 1

Script "PVEPath" (void)
{
If ( CheckInventory("PVELockout"))
	{
	Terminate;
	}
ChaserPVE = ActivatorTID();
ChasePVE = CheckInventory("PatrolItem");
int ChaserID = UniqueTID(); 
Thing_ChangeTID(0, ChaserID);
Thing_SetGoal (ChaserID, ChasePVE, 0, 0); 
Thing_ChangeTID(0, ChaserPVE);
TakeInventory("PatrolItem", 0x7fffffff); ///setting to a numbered value makes it too unstable and makes the script not working/buggy af for some reason???
delay(1);
GiveInventory("PVELockout", 1);
}
Decorate:

Code: Select all

ACTOR PatrolAOE : PatrolPoint 11099
{
 States
  {
  Spawn:
    //TNT1 A 0
    TRED A 0 nodelay A_RadiusGive("PatrolItem", 256, RGF_MONSTERS, tid)
	TNT1 A 0 A_RadiusGive("PatrolItem", 256, RGF_MONSTERS, 1)
    TNT1 A 0 A_RadiusGive("PatrolScriptItem", 256, RGF_MONSTERS, 1)
	TRED A 1
    Loop
  }
}

Actor PatrolItem : Inventory { Inventory.MaxAmount 999999 }

ACTOR PatrolScriptItem : CustomInventory
{
+INVENTORY.ALWAYSPICKUP
+INVENTORY.AUTOACTIVATE
-Invbar
Inventory.MaxAmount 1
  States
  {
  Spawn:
    TNT1 A 1
    stop
	Pickup:
	TNT1 A 0 A_JumpIfInventory("PVELockout", 1, "PveLock")
	TNT1 A 0 ACS_NamedExecuteAlways("PVEPath")
	TNT1 A 1
	stop
	PveLock:
	TNT1 A 1
	fail
   }
}

ACTOR PVELockout : PowerHighJump
{
  Powerup.Duration -5
  Powerup.Strength 0
  +INVENTORY.AUTOACTIVATE
}
As for the cooldown/reload scripts, if anyone is interested, i was suggested to use powerup timers as an alternative which could work, but the problem is that if i make use of some abilities that reduces cooldown or weapons that makes usage of per-shell reload (like a shotgun), it either becomes impossible or still requires ACS input. So ill try to drop my exemples here if anyone is interested in that:

Weapon reload acs:

Code: Select all

Script "ReloadDemo" Enter
{
If (CheckInventory("NaderAmmo") == 4)
{
TakeInventory("NaderCooldown", 35);
Delay(1);
Restart; 
}
Else if (CheckInventory("NaderCooldown") == 0)
		{
			If (CheckInventory("NaderAmmo") < 3)
			{
			    GiveInventory("NaderAmmo", 1);
				GiveInventory("NaderCooldown", 9); //was 18 or 35
				Delay(1);
				Restart;
			}
			else
				{
					GiveInventory("NaderAmmo", 1);
					Delay(1);
					Restart;
				}
			
		}
	Else
	{
	TakeInventory("NaderCooldown", 1);
	Delay(1);
    Restart; 
	}
}
The weapon basically gives you the max nadercooldown whenever you fire it, and it then goes down by itself. But when its mid-reload, it gives lower ammounts to make the pre-shell reload part faster.

And the cooldown script is as follow:

Code: Select all

Script "Cooldown Script" Enter //clientside
{
	TakeInventory("Cooldown1", 1);
	TakeInventory("Cooldown2", 1);
	Delay(1);
    Restart; 
}
And it makes uses of a clientside script that shows a single second per 35 tics on the HUD, to make sure they are precise even if a cooldown reduction is applied. Cause some characters have their cooldown reduces not by an ammount of seconds but the cooldown inventories goes down twice as fast under a certain circumstance.

As for the health view script i mentionned earlier, it works well in solo but in lan testing, it starts flickering like crazy to the point where it starts hurting the eyes.

So yeah... here's that. If anyone can provide suggestions/help, it would be appreciated. Cause these scripts works pretty well offline (and somehow on a lan test), but its online that i fear this might take the shitter.

Post Reply