Quantcast
Channel: ZDoom
Viewing all articles
Browse latest Browse all 3391

Scripting • Help With A_SprayDecal Offset/Direction

$
0
0
I'm having trouble with A_SprayDecal, specifically how to use offset and direction parameters. I'm using A_SprayDecal as a replacement for GZDoom's inflexible built in blood generation, calling it from DamageMObj. I thought I had figured out how the Offset and Direction parameters worked because from limited testing on a tiny test map, the blood generated as expected but on actual larger normal maps, the blood often doesn't generate at all or in it does in the completely wrong places.

Here is how I currently have it implemented.

Code:

Blood = String.Format("%sBlood%s",Clr,Size);Double DPitch;Double DHeight;Vector2 VAngle;Vector3 Position;Vector3 Direction;For (Int I = 0; I < Num; I++){If (Inflictor){VAngle = AngleToVector(FRandom(Inflictor.Angle - 15.0,Inflictor.Angle + 15.0));DPitch = Clamp(FRandom(Inflictor.Pitch - 7.5,Inflictor.Pitch + 7.5),-89.0,89.0);DHeight = Clamp(Inflictor.Pos.Z - Pos.Z,Pos.Z,Pos.Z + Height);}Else If (Source){VAngle = AngleToVector(FRandom(Source.Angle - 15.0,Source.Angle + 15.0));DPitch = Clamp(FRandom(Source.Pitch - 7.5,Source.Pitch + 7.5),-89.0,89.0);DHeight = Pos.Z + (Height / 2);}Else{VAngle = AngleToVector(FRandom(0.0,360.0));DPitch = FRandom(-30.0,30.0);DHeight = Pos.Z + (Height / 2);}Position = (0.0,0.0,DHeight);Direction = (VAngle.X,VAngle.Y,Sin(-DPitch));A_SprayDecal(Blood,172.0,Position,Direction);}

Statistics: Posted by 22alpha22 — Sat Dec 28, 2024 2:59 pm



Viewing all articles
Browse latest Browse all 3391

Trending Articles