Useful ACS Scripts

Discuss all aspects related to modding Zandronum here.
User avatar
WhoDaMan
 
Posts: 35
Joined: Thu Jun 07, 2012 4:19 pm
Location: Denton, Texas

RE: Useful ACS Scripts

#21

Post by WhoDaMan » Sun Sep 23, 2012 7:11 am

Ijon Tichy wrote:

Code: Select all

HudMessage(d:ThingCount(T_NONE, 249), s:" of 12 monsters"; HUDMSG_PLAIN, 6, CR_YELLOW, 0.8, 0.2, 0);
Hmmmmm, I put that in as a void script and tried to have to monster's spawn state execute so there TiD could be changed before the script activated but it still didnt work. So I decided to puke the script ingame and "1 of 12 Monsters" came up. I started killing the monsters 1 by and keep repuking the script and after about the 5th monster died it droped down to "0 of 12 Monsters" Funny thing is I looked at that monsters Decorate and theres nothing to explain why it was counted and the others weren't. IDK I don't think either scripts are working. I'll try to figure it out more tommorrow. Thanks for helping me out anyways.

Ijon Tichy
Frequent Poster Miles card holder
Posts: 901
Joined: Mon Jun 04, 2012 5:07 am

RE: Useful ACS Scripts

#22

Post by Ijon Tichy » Sun Sep 23, 2012 4:05 pm

Code: Select all

script 31 OPEN
{
    int monCount;
    while (1)
    {
        monCount = ThingCount(0, 249);
        HudMessage(d:monCount, s:" of 12 monsters"; HUDMSG_PLAIN, 6, CR_YELLOW, 0.8, 0.2, 0);
        
        if (monCount == 0) { break; }

        Delay(1);
    }
}
Last edited by Ijon Tichy on Sun Sep 23, 2012 4:35 pm, edited 1 time in total.

User avatar
WhoDaMan
 
Posts: 35
Joined: Thu Jun 07, 2012 4:19 pm
Location: Denton, Texas

RE: Useful ACS Scripts

#23

Post by WhoDaMan » Sun Sep 23, 2012 7:11 pm

Cool Thanks. That solved one of my problems. At least now the Hudmessege is Displaying now. Only problem is it still shows 0 of 12 monsters because there TiDs aren't changing. So I tried Spawning it without an Invasion spawner like this

Code: Select all

script 1 OPEN
{
 while (( GetInvasionWave( ) != 1 ));  
  Spawn ("cspitter2b", -4864, 8576, 0, 249, 270);
    While(( GetInvasionState( ) != IS_COUNTDOWN ));  
		delay( 1 );
Thing_remove(1);
cspitter2b is the monster. Anyways now at the start of the map it says "runaway script 1 terminated" and it won't even spawn. Obviously I screwed up the scripted again. I also wandering if I am just making things more complicated then they need to be.
Last edited by WhoDaMan on Sun Sep 23, 2012 7:14 pm, edited 1 time in total.

Llewellyn
Forum Regular
Posts: 578
Joined: Mon Jul 02, 2012 7:12 am

RE: Useful ACS Scripts

#24

Post by Llewellyn » Sun Sep 23, 2012 7:19 pm

Ijon Tichy wrote: script 31 OPEN
{
int monCount;
while (1)
{
monCount = ThingCount(T_NONE, 249);
HudMessage(d:monCount, s:" of 12 monsters"; HUDMSG_PLAIN, 6, CR_YELLOW, 0.8, 0.2, 0);

if (monCount == 0) { break; }

Delay(1);
}
}
fixed

WhoDaMan wrote: cspitter2b is the monster. Anyways now at the start of the map it says "runaway script 1 terminated" and it won't even spawn.
Thats because it needs to look like this

Code: Select all

script 1 OPEN
{
while (GetInvasionWave() != 1);  
	Delay(1);
Spawn ("cspitter2b", -4864, 8576, 0, 249, 270);
  
while (GetInvasionState() != IS_COUNTDOWN);  
	delay(1);
Thing_remove(1);
}
That will wait until GetInvasionWave is one, then spawn one of your monster, then wait until the countdown, then remove a thing with TID 1.
Last edited by Llewellyn on Sun Sep 23, 2012 7:23 pm, edited 1 time in total.

User avatar
WhoDaMan
 
Posts: 35
Joined: Thu Jun 07, 2012 4:19 pm
Location: Denton, Texas

RE: Useful ACS Scripts

#25

Post by WhoDaMan » Sun Sep 23, 2012 7:42 pm

OK cool thanks. I got it to spawn now but unfortuantly its either not spawning with the specified TiD, or the Thingcount script isn't reading the new TiD, or both. Point is its still displaying as 0 of 12 once all the monsters have spawned. I can't used namedthingcount because they each have a slightly different name.

EDIT: Ok, Ive determined the monster is spawning with the correct ID. I puked the script after it spawned and it went up to "1 of 12 monsters" then puked it again after I killed it and it went back down to 0.
Last edited by WhoDaMan on Sun Sep 23, 2012 8:22 pm, edited 1 time in total.

Llewellyn
Forum Regular
Posts: 578
Joined: Mon Jul 02, 2012 7:12 am

RE: Useful ACS Scripts

#26

Post by Llewellyn » Sun Sep 23, 2012 8:27 pm

WhoDaMan wrote: OK cool thanks. I got it to spawn now but unfortuantly its either not spawning with the specified TiD, or the Thingcount script isn't reading the new TiD, or both. Point is its still displaying as 0 of 12 once all the monsters have spawned. I can't used namedthingcount because they each have a slightly different name.

EDIT: Ok, Ive determined the monster is spawning with the correct ID. I puked the script after it spawned and it went up to "1 of 12 monsters" then puked it again after I killed it and it went back down to 0.
CAn you just post all of your acs so I can tell what you're doing wrong, instead of short snippets that have nothing to do with the actual problem?

User avatar
WhoDaMan
 
Posts: 35
Joined: Thu Jun 07, 2012 4:19 pm
Location: Denton, Texas

RE: Useful ACS Scripts

#27

Post by WhoDaMan » Sun Sep 23, 2012 8:46 pm

ACS

Code: Select all

script 1 OPEN
{
 while (( GetInvasionWave( ) != 1 ))
    {
     delay( 1 );
    }
   
  Spawn ("cspitter2b", -4864, 8576, 200, 251, 270);
  
   int monCount;
while (1)
{
monCount = ThingCount(T_NONE, 251);
HudMessage(d:monCount, s:" of 12 monsters"; HUDMSG_PLAIN, 6, CR_YELLOW, 0.8, 0.2, 0);

if (monCount == 0) { break; }

Delay(1); 
  
  While(( GetInvasionState( ) != IS_COUNTDOWN ))  
delay( 1 );
}


Thing_remove(1);
}

script 31 OPEN
{
int monCount;
while (1)
{
monCount = ThingCount(T_NONE, 251);
HudMessage(d:monCount, s:" of 12 monsters"; HUDMSG_PLAIN, 6, CR_YELLOW, 0.8, 0.2, 0);

if (monCount == 0) { break; }

Delay(1);
}
}

Decorate of monster

Code: Select all

ACTOR cspitter2b : cspitterb
{
        
        SpawnID 249
	States
	{
	Spawn:
                BBRN A 1
                BBRN A 0 ACS_Execute (4, 14, 0, 0, 0) <==== Ignore
                Goto see
        See:
                BBRN A 200
                BBRN A 1 A_Custommissile ("iconcube3", 110, 0, 0, 2) 
		Loop
	
	Death:
		BBRN B 0 A_Die
         BBRN B 0 ACS_Execute (5, 14, 0, 0, 0) <==== Ignore 
		BBRN B 1 A_Scream
		BBRN B 1 A_Fall
         BBRN B 1 ACS_Execute (31, 14, 0, 0, 0)
		BBRN B -1
		Stop
	}
}
My lasted attempt to get it to work. The Thing count in the first script works but.... trying to reexicute it in the monster's death state didn't work as once the monsters is dead it still says 1 of 12 instead of 0 of 12.

Llewellyn
Forum Regular
Posts: 578
Joined: Mon Jul 02, 2012 7:12 am

RE: Useful ACS Scripts

#28

Post by Llewellyn » Sun Sep 23, 2012 9:01 pm

Delete script 31, it's causing problems, and then use this:

Code: Select all

int monCount;
script 1 OPEN
{
	while (GetInvasionWave() != 1)
		delay(1);
	Spawn ("cspitter2b", -4864, 8576, 200, 251, 270);

	while (1)
	{
		monCount = ThingCount(T_NONE, 251);
		HudMessage(d:monCount, s:" of 12 monsters"; HUDMSG_PLAIN, 6, CR_YELLOW, 0.8, 0.2, 0);

		if (monCount == 0)
			break;
		Delay(1);
		
	}
	While(GetInvasionState() != IS_COUNTDOWN)  
		delay(1);
	Thing_remove(1);
}

User avatar
WhoDaMan
 
Posts: 35
Joined: Thu Jun 07, 2012 4:19 pm
Location: Denton, Texas

RE: Useful ACS Scripts

#29

Post by WhoDaMan » Sun Sep 23, 2012 9:14 pm

Thankyou SO MUCH. It worked!!!!! One last question. Do I use the same script for waves 2 and 3 if I want them to be the same way? and Thanks a ton to you and Ijon Tichy for all the help.

Nvm on question, I figured it out. Thanks again yall :D.
Last edited by WhoDaMan on Sun Sep 23, 2012 11:52 pm, edited 1 time in total.

TheBladeRoden
 
Posts: 30
Joined: Thu Jun 07, 2012 10:33 am

RE: Useful ACS Scripts

#30

Post by TheBladeRoden » Fri Sep 28, 2012 8:34 am

Here's a script to cap a player's freelook speed, useful for simulating vehicles or turrets and stuff. Though for some reason bots can still override it. Edit the "500" to taste.

Code: Select all

script 152 (void)
{
	if (GetActorProperty(0, APROP_Health) > 0)
	{
		int AnglePre, PitchPre, AnglePost, PitchPost, AngleResult, OppositeAngle;
		int MaxAnglePostLeft, MaxAnglePostRight;
		int AltMaxAnglePostLeft, AltMaxAnglePostRight;
		AnglePre=getactorangle(0);
		PitchPre=getactorpitch(0);
		MaxAnglePostLeft=AnglePre+500;
		if (MaxAnglePostLeft > 65536)
		{
			MaxAnglePostLeft = MaxAnglePostLeft-65536;
		}
		MaxAnglePostRight=AnglePre-500;
		if (MaxAnglePostRight < 0)
		{
			MaxAnglePostRight = MaxAnglePostRight+65536;
		}
		OppositeAngle = AnglePre-32768;
		if (OppositeAngle < 0)
		{
			OppositeAngle = OppositeAngle + 65536;
		}
		Delay(1);
		AnglePost=getactorangle(0);
		PitchPost=getactorpitch(0);	
		int TooFarLeft = 0;
		int TooFarRight = 0;
		if(MaxAnglePostLeft < OppositeAngle)
		{
			if (AnglePost >= MaxAnglePostLeft && AnglePost <= OppositeAngle)
				{
					TooFarLeft = 1;		
				}
		}
		if(MaxAnglePostLeft > OppositeAngle)
		{
			if (AnglePost >= MaxAnglePostLeft && AnglePost <= 65536)
				{
					TooFarLeft = 1;
				}
			if (AnglePost >= 0 && AnglePost <= OppositeAngle)
				{
					TooFarLeft = 1;
				}	
		}
		if(MaxAnglePostRight > OppositeAngle)
		{
			if (AnglePost >= OppositeAngle && AnglePost <= MaxAnglePostRight)
				{
					TooFarRight = 1;
				}
		}
		if(MaxAnglePostRight < OppositeAngle)
		{
			if (AnglePost >= 0 && AnglePost <= MaxAnglePostRight)
				{
					TooFarRight = 1;
				}
			if (AnglePost >= OppositeAngle && AnglePost <= 65536)
				{
					TooFarRight = 1;
				}	
		}
		if (ToofarLeft == 1)
		{
			SetActorAngle(0,AnglePre + 500);
			AnglePost = AnglePre + 500;
		}
		if (ToofarRight == 1)
		{
			SetActorAngle(0,AnglePre - 500);
			AnglePost = AnglePre - 500;
		}
		if(PitchPost > PitchPre + 500)
		{
			SetActorPitch(0,PitchPre + 500);
			PitchPost = PitchPre + 500;
		}
		if(PitchPost < PitchPre - 500)
		{
			SetActorPitch(0,PitchPre - 500);
			PitchPost = PitchPre - 500;
		}
		restart;
	}
}
Last edited by TheBladeRoden on Fri Sep 28, 2012 9:59 am, edited 1 time in total.

Post Reply