Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. If you still don't understand how to use a feature, then ask here.
Please bear in mind that the people helping you do not automatically know how much you know. You may be asked to upload your project file to look at. Don't be afraid to ask questions about what things mean, but also please be patient with the people trying to help you. (And helpers, please be patient with the person you're trying to help!)
class wpglob : bulletpuff
{
default
{
+ROLLSPRITE;
+BRIGHT;
+ALWAYSPUFF;
Radius 2;
Height 2;
Speed 10;
scale 0.10;
+puffonactors;
+hittracer;
vspeed 0;
renderstyle "Add";
alpha 0.90;
}
States
{
crash:
FLFS M random(1,2) A_SetRoll(roll+random(0,359), SPF_INTERPOLATE);
FLFS N 1 A_SetScale(0.12);
FLFS N 1 A_SetScale(0.14);
FLFS O 1 A_SetScale(0.16);
FLFS O 1 A_SetScale(0.18);
FLFS P 1 A_SetScale(0.20);
FLFS P 1 A_SetScale(0.21);
FLFS Q 1 A_SetScale(0.22);
FLFS Q 1 A_SetScale(0.23);
FLFS Q 1 A_SetScale(0.24);
FLFS Q 1 A_SetScale(0.25);
TNT1 A -1;
stop;
spawn:
TNT1 A 1 NoDelay;
TNT1 A 1 A_SpawnItemEx("WPHitActor",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION|SXF_TRANSFERPOINTERS);
stop;
melee:
goto spawn;
}
}
class wpglobsmoke : actor
{
default
{
+noblockmap;
+nogravity;
//+nointeraction;
radius 2;
height 2;
scale 0.25;
+FORCEXYBILLBOARD;
+ROLLSPRITE;
renderstyle "translucent";
alpha 0.5;
// VSpeed 12;
}
states
{
spawn:
TNT1 A 0 nodelay
{
thrustthingz(0,2,0,0);
thrustthing(random(0,255),1,0,0);
}
goto fadeloop;
fadeloop:
TNT1 A 0;
SMO9 A 1 A_SetRoll(roll+random(0,359), SPF_INTERPOLATE);
SMO9 BBCCDDEEFFGGHHIIJJKK 1 A_fadeout(0.005);
loop;
}
}
class WPHitActor : actor
{
int lifetimer;
int burntime;
int burntics;
default
{
+noblockmap;
+thruactors;
}
override void BeginPlay()
{
burntics = 7;
burntime = 30;
}
states
{
spawn:
TNT1 A 1 nodelay;
TNT1 A 0 A_PlaySound("SetOnFire/Start", 6,0.75);
TNT1 A 0 A_PlaySound("SetOnFire/Burning", 5,0.5,1);
burning:
TNT1 A 1;
TNT1 A 1 A_spawnitemex("wpactorflame",frandom(-tracer.radius, tracer.radius),frandom(-tracer.radius, tracer.radius),frandom(-tracer.height, tracer.height),0,0,0,0,SXF_NOCHECKPOSITION);
TNT1 A 1 A_spawnitemex("wpactorflame",frandom(-tracer.radius, tracer.radius),frandom(-tracer.radius, tracer.radius),frandom(-tracer.height, tracer.height),0,0,0,0,SXF_NOCHECKPOSITION);
TNT1 A 1 A_spawnitemex("wpactorflame",frandom(-tracer.radius, tracer.radius),frandom(-tracer.radius, tracer.radius),frandom(-tracer.height, tracer.height),0,0,0,0,SXF_NOCHECKPOSITION);
TNT1 A 1 A_spawnitemex("wpactorflame",frandom(-tracer.radius, tracer.radius),frandom(-tracer.radius, tracer.radius),frandom(-tracer.height, tracer.height),0,0,0,0,SXF_NOCHECKPOSITION);
TNT1 A 1 A_spawnitemex("wpactorflame",frandom(-tracer.radius, tracer.radius),frandom(-tracer.radius, tracer.radius),frandom(-tracer.height, tracer.height),0,0,0,0,SXF_NOCHECKPOSITION);
TNT1 A 0
{
statelabel nextstate = "burning";
A_Warp(AAPTR_TRACER);
A_DamageTracer((1),"Fire");
lifetimer++;
if(lifetimer >= burntime)
{
nextstate = "death";
}
return ResolveState(nextstate);
}
stop;
death:
TNT1 A 0;
TNT1 A 0 A_StopSound(CHAN_5);
TNT1 A 0 A_PlaySound("SetOnFire/End", 6);
TNT1 A -1;
stop;
}
}
class wpactorflame : actor
{
default
{
+noblockmap;
+nogravity;
+alwayspuff;
//+nointeraction;
radius 2;
height 2;
scale 0.2;
+FORCEXYBILLBOARD;
+ROLLSPRITE;
renderstyle "Add";
// VSpeed 12;
}
States
{
Spawn:
TNT1 A 1 nodelay thrustthingz(0,5,0,0);
FLFS M random(1,2) A_SetRoll(roll+random(0,359), SPF_INTERPOLATE);
FLFS N 1 A_SetScale(0.12);
FLFS N 1 A_SetScale(0.14);
FLFS O 1 A_SetScale(0.16);
FLFS O 1 A_SetScale(0.18);
FLFS P 1 A_SetScale(0.20);
FLFS P 1 A_SetScale(0.21);
FLFS Q 1 A_SetScale(0.22);
FLFS Q 1 A_SetScale(0.23);
FLFS Q 1 A_SetScale(0.24);
FLFS Q 1 A_SetScale(0.25);
goto smokestart;
smokestart:
SMO9 B random(2,3)
{
thrustthingz(0,2,0,0);
thrustthing(random(0,255),1,0,0);
A_SetRenderStyle(0.5,STYLE_TRANSLUCENT);
A_SetScale(0.30);
A_SetRoll(roll+random(0,359), SPF_INTERPOLATE);
}
goto smoke;
smoke:
SMO9 CCDDEEFFGGHHIIJJKK 1 A_fadeout(0.005);
Death:
stop;
}
}
This is an edited version of a script made by kodi for a flame effect that sticks to enemies and deals damage over time.
It works fine for what I need BUT it causes a "Attempted to read from address zero" error when the fire actors are on an actor that doesn't leave a corpse ie lost soul, pain elemental, explosivebarrel, etc. The error occurs when the corpseless actor death phase ends without some sort of -1 line. I can short-term fix it by just using a "TNT1 A -1 Stop" line. However I intend this project to be used for gameplay addons like Corruption Cards which has it's own corpseless actors.
I tried to fix it on my own but my massive lack of zscript knowledge has left me ill-equipped. I believe the problem is somewhere in WPHitActorFlame. This occurs on the unedited script too.
VM execution aborted: tried to read from address zero.
Called from WPHitActor.StateFunction.6 at 1Pan-DOOMTIDE.pk3:zscript/firestuff.txt, line 106
Called from state WPHitActor.6 in WPHitActor
The lines alternate between lines 104-108 which are the A_SpawnItemEx calls.
What's causing the error is that once an actor stop existing (example: Using stop at its death state so it doesn't leave a corpse), then the tracer pointer the fire uses becomes null.
And that's why you get a VM abort, it's because it's trying to read the radius of null.
To fix this, alter your burning state to either:
1) Include this line between every A_SpawnItemEx call: TNT1 A 0 A_JumpIf(!tracer,"Death");
Or 2) Alter your A_SpawnItemEx frame to be this: (untested)
Jarewill wrote: ↑Fri Jan 27, 2023 6:57 am
What's causing the error is that once an actor stop existing (example: Using stop at its death state so it doesn't leave a corpse), then the tracer pointer the fire uses becomes null.
And that's why you get a VM abort, it's because it's trying to read the radius of null.
To fix this, alter your burning state to either:
1) Include this line between every A_SpawnItemEx call: TNT1 A 0 A_JumpIf(!tracer,"Death");
Or 2) Alter your A_SpawnItemEx frame to be this: (untested)
Ye, first one did the trick perfectly! Thanks for the help, I would've been scratching my head for a long time because zscript is still an alien language to me lol.