Forum rules
The Projects forums are only for projects. If you are asking questions about a project, either find that project's thread, or start a thread in the General section instead.
This is my ACS resources thread where I post my weird experiments and other things that people request. Feel free to make suggestions or requests here for stuff if you need something simple.
REQUESTS ARE DONE AT MY DISCRETION.
This thread is also a place where I will be conducting experiments of various kinds and providing vital data to the modification of doom and the usage of ACS.
For now enjoy my new two submissions:
Monster projectiles turned particle simulator. Works best with SV_Fastmonsters 1.
Essentially this file is nothing more than a working example of looped orbital movement with an object across a 2d plane. Apparently this was my attempt at helping Ryan_Cordell with his own orbit code
#include "zcommon.acs"
int counter;
int backwards;
script 1 ENTER
{
thing_hate(1,3,6);
orbit(2, 3, 3, (1024-counter), 0, 2048, 1);
thing_activate(1);
while (thingcount(t_NONE, 3) && (Timer()% (35*10)))
delay(1);
counter+= 512.0;
if(backwards)
counter-=1024.0;
print(s:"interval");
if(!thingcount(t_NONE, 3))
spawnspot("HateTarget", 2, 3, 0);
if (counter>=1024)
{
backwards++;
}
else if (counter <= 16)
{
backwards = 0;
}
delay(1);
restart;
}
int orbitarray[255][255];
int playertidarray[16];
int loop, loop2;
int bubbletid[64];
int group_size;
function int Orbit(int focustid, int orbitobjtid, int speed, int radius, int duration, int height, bool permanent)
{
if(!focustid) focustid = activatortid();
orbitarray[focustid][0] = focustid;
orbitarray[focustid][1] = orbitobjtid;
orbitarray[focustid][2] = speed;
orbitarray[focustid][3] = radius;
orbitarray[focustid][4] = duration;
orbitarray[focustid][5] = height;
orbitarray[focustid][6] = permanent;
acs_execute(344,0,focustid,0,0);
return 1;
}
Script 344 (int focustid)
{
// [KS] Dear God, Ryan, what have you done!?
// THEY CALLED ME CRAZY. But I showed them..!
int orbitpoint = orbitarray[focustid][0];
int x = GetActorX(orbitpoint), y = GetActorY(orbitpoint), z = GetActorZ(orbitpoint);
int step = 0;
int angle = GetActorAngle(focustid);
int speed_var = orbitarray[focustid][2];
int radius_var = orbitarray[focustid][3] << 16;
int duration_var = orbitarray[focustid][4];
int height_var = orbitarray[focustid][5] << 16;
int permanent_var = orbitarray[focustid][6];
int offset;
while(permanent_var == 1)
{
x = GetActorX(orbitpoint); y = GetActorY(orbitpoint); z = GetActorZ(orbitpoint);
offset = FixedDiv(speed_var * 1.0, 360.0) * step;
SetActorPosition(orbitarray[focustid][1],
x + FixedMul(radius_var , cos( (angle + offset) % 1.0)),
y + FixedMul(radius_var , sin( (angle + offset) % 1.0)),
z + height_var,0);
step++;
delay(1);
if (!thingcount(t_none,focustid))
break;
}
for(step = 0; step < duration_var; step++)
{
x = GetActorX(orbitpoint); y = GetActorY(orbitpoint); z = GetActorZ(orbitpoint);
// [KS] Speed is measured as an angle / tics
// O rly?
offset = FixedDiv(speed_var * 1.0, 360.0) * step;
SetActorPosition(orbitarray[focustid][1],
x + FixedMul(radius_var , cos( (angle + offset) % 1.0)),
y + FixedMul(radius_var , sin( (angle + offset) % 1.0)),
z + height_var,0);
delay(1);
if (!thingcount(t_none,focustid))
break;
}
}
Apothem's Monster HP Bar (v1.2) [Updated as of 2/11/12]
WAD located at: I dont have the original wad with the original resources/graphics anymore, sorry guys!
I believe there's a wiki thread that may need to be updated with this new version as well.
#include "zcommon.acs"
//Apothem's Monster HP Bar - V1.1
int monhp;
int mtid = 666; //Replace the number here with your monster TID
int mmaxhp; //This is the variable used for the current monster's MAX hp.
void function ResetBar(int targettid)
{
mtid = targettid; //set the current monster TID to the specified TID
monhp = GetActorProperty (MTID, APROP_Health);
mmaxhp = monhp;
acs_executealways(4,0,0,0,0); //normally calling scripts from inside functions
} //has caused more problems than it has ever solved for me, but in this case it works.
Script 4 ENTER //Replace ENTER with (void) if you want to activate the script
{ //with a line instead of on level entry.
int hdisp;
int oldmonhp; //This script is the meat of the code. This is the display script.
int acounter;
int bcounter;
monhp = mmaxhp;
while (monhp > 0) //Basically, we use this while loop to constantly check for termination conditions without
{ //having to waste system resources. This almost makes it a lot more responsive.
SetFont ("NORMAL");
monhp = GetActorProperty (MTID, APROP_Health);
hdisp = (monhp * 100 / mmaxhp);
if (hdisp <= 0)
hdisp = 0;
SetHudSize (800,600,0);
HudMessage (i:hdisp; 1, 0, CR_WHITE, 120.1, 10.1, 1);
SetFont ("MONHPBAR");
HudMessage (s:"a"; 1, 101, CR_GREEN, 0.1, 1.1, 1);
for (acounter = 0; acounter <= hdisp; acounter++) //This loop can be optimized with different
{ //graphics to make it to where you dont need to show as many bar fillers
if (hdisp <= 0) //to display the whole bar.
break;
bcounter = bcounter + 2.0;
SetFont ("FILLNORM"); //By default, the bar shows as a blue bar.
if (hdisp < 75) //If the hp is at a caution level (75%) Display a yellow bar.
SetFont ("FILLCAUT");
if (hdisp < 50) //If the hp is at a danger level (50%) Display an orange bar.
SetFont ("FILLDANG");
if (hdisp < 25) // If the hp is at a critical level (25%) Display a red bar.
SetFont ("FILLCRIT");
HudMessage (s:"a"; 1, acounter, CR_GREEN, 23.1 + bcounter, 7.1, 1);
}
while(monhp == oldmonhp)
{ //In order to keep the game from lagging we make sure to only have it update when the
monhp = GetActorProperty (MTID, APROP_Health); //actor in question actually has a change in health.
delay(15); //I set this delay to approx. 1/2 of a second because I have the display loop using the same delay.
}
oldmonhp = monhp;
bcounter = 0;
acounter = 0;
delay(20);
}
HudMessage (s:" "; 1, 101, CR_GREEN, 0.1, 1.1, 1);
HudMessage (s:" "; 1, 0, CR_WHITE, 120.1, 10.1, 1);
}
Script 5 OPEN
{
//All this script is meant to do is grab the health of the specified actor.
//Later updates will include being able to change the target of this
//hp bar in real time.
mmaxhp = getactorproperty(MTID, APROP_Health);
}
Apothem's Magnification texture V0.1
Example file showing how to make a zoom-in effect with cameratextures.
#include "zcommon.acs"
int zoom;
script 100 (void)
{
setcameratotexture(0, "camtex1", 45); //set the camea texture to the player's view. replace 45 with whatever fov(in degrees!)
sethudsize(800, 600, 0); //set the hud to the same size as the camera texture.
setfont("camtex1"); //set the font to the camera texture
//turns the zoom on and off
if(!zoom)
{
hudmessage(s:"A"; 0, 1, -1, 0.1, 0.1, 0);
zoom++;
}
else
{
zoom = 0;
hudmessage(s:" "; 0, 1, -1, 0.1, 0.1, 0);
}
}