Moderator: GZDoom Developers

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!)
Seidolon
Posts: 463
Joined: Wed Oct 09, 2013 11:11 pm

I am having some trouble with my script and I don't know what the fuck is causing it or what to do.

I'm working on a fireworks mod for doom and I'm adding fuse that you can place on the ground. I have a transparent red hologram that displays on the ground to show you where you're placing the fuse. The problem is that I'm making a script so that the fuse and the hologram adjust to slopes and steps and look more smooth. I have made a similar script before for grass decorations where they auto aligned themselves to the ground when they were spawned. That worked for the grass decorations, but this isn't working at all for some reason.

Code: Select all

``````Script "Slope_Adjust" (void)
{
int angle = GetActorAngle(0);
int x = GetActorX(0);
int y = GetActorY(0);

log(f:x);
log(f:y);

int z1 = GetSectorFloorZ(0, (x + cos(angle + 0.25) * 40) >> 16, (y + sin(angle + 0.25) * 40) >> 16);
int z2 = GetSectorFloorZ(0, (x + cos(angle + 0.75) * 40) >> 16, (y + sin(angle + 0.75) * 40) >> 16);

log(f:z1);
log(f:z2);
log(s:"");

int z3 = GetSectorFloorZ(0, (x + cos(angle) * 40) >> 16, (y + sin(angle) * 40) >> 16);
int z4 = GetSectorFloorZ(0, (x + cos(angle + 0.5) * 40) >> 16, (y + sin(angle + 0.5) * 40) >> 16);

SetActorRoll(0,-(z2 - z1) / 64);
SetActorPitch(0,-(z4 - z3) / 64);
}``````
I added some log functions to the script to see what the problem was and it appears that it thinks the object is at coordinates 0,0 and it returns -32 for it's z height no matter where I am with it. Is there a problem with the GetActor coordinate functions or the way I'm using them? I have to go to sleep soon so I might not respond for a bit, but I really need some help with this.

If it helps, here are the actor definitons.

Code: Select all

``````ACTOR FireworkFuse
{
+SHOOTABLE
+NODAMAGE
+NOBLOOD
Height 3
States
{
Spawn:
TNT1 A 0 NoDelay
Loop
TNT1 A 0 A_PlaySound("FUSE",7,1.0,true)
TNT1 A 0 A_SpawnItemEx("FuseFXSpawner",random(-16,16),random(-16,16),5,0,0,0.7)
TNT1 A 0 A_SpawnItemEx("FuseFXSpawner",random(-32,32),random(-32,32),5,0,0,0.7)
FFUS A 5 Bright A_SpawnItemEx("FireworkSmoke1",random(-24,24),random(-24,24),5,0,0,0.7)
TNT1 A 0 A_SpawnItemEx("FuseFXSpawner",random(-16,16),random(-16,16),5,0,0,0.7)
TNT1 A 0 A_SpawnItemEx("FuseFXSpawner",random(-32,32),random(-32,32),5,0,0,0.7)
FFUS A 5 Bright A_SpawnItemEx("FireworkSmoke1",random(-24,24),random(-24,24),5,0,0,0.7)
TNT1 A 0 A_SpawnItemEx("FuseFXSpawner",random(-16,16),random(-16,16),5,0,0,0.7)
TNT1 A 0 A_SpawnItemEx("FuseFXSpawner",random(-32,32),random(-32,32),5,0,0,0.7)
FFUS A 5 Bright A_SpawnItemEx("FireworkSmoke1",random(-24,24),random(-24,24),5,0,0,0.7)
TNT1 A 0 A_SpawnItemEx("FuseFXSpawner",random(-16,16),random(-16,16),5,0,0,0.7)
TNT1 A 0 A_SpawnItemEx("FuseFXSpawner",random(-32,32),random(-32,32),5,0,0,0.7)
FFUS A 5 Bright A_SpawnItemEx("FireworkSmoke1",random(-24,24),random(-24,24),5,0,0,0.7)
TNT1 A 0 A_StopSound(7)
Stop
}
}

ACTOR FireworkFuseFake
{