Trying to SOC a Rotating Turret

Status
Not open for further replies.
I'll continue research with your advice in mind.

I assume your SOC is already outdated, so you'll have to give me the complete new SOC if you want me to identify your current problem.

I've mad a few adjustments since your post but it's still exhibiting the same problem. The target spawns but then quickly disappears. The turret never gets a chance to fire and the target shows no sign of taking an orbit and it has no Z height, whereas it should be 32 fracunits above the ground.

Here it is, I really appreciate it!

# Turret
Thing 321
MAPTHINGNUM = 125
SPAWNSTATE = 1795
SPAWNHEALTH = 1000
SEESTATE = 1803
SEESOUND = 0
REACTIONTIME = 100
ATTACKSOUND = 119
PAINSTATE = 0
PAINCHANCE = 2000
PAINSOUND = 0
MELEESTATE = 0
MISSILESTATE = 0
SPEED = 0
RADIUS = 1310720
HEIGHT = 3932160
MASS = 0
DAMAGE = 200
ACTIVESOUND = 0
RAISESTATE = 111
FLAGS = 2147483650

#Spawning
FRAME 1795
SPRITENUMBER = 246
SPRITESUBNUMBER = 0
DURATION = 1
NEXT = 1796
ACTION None

# Turret's Invisible Orbiting Target
Thing 322
MAPTHINGNUM = 126
SPAWNSTATE = 1808
SPAWNHEALTH = 5000
RADIUS = 1310720
HEIGHT = 3276800
MASS = 100
FLAGS = 2147483648

FRAME 1808
SPRITENUMBER = 247
SPRITESUBNUMBER = 0
DURATION = 100
NEXT = 1809
ACTION None

FRAME 1809
SPRITENUMBER = 247
SPRITESUBNUMBER = 0
DURATION = 100
NEXT = 1809
ACTION A_CapeChase
VAR1 = 131072
VAR2 = 65664

###################################
# Targeting Invisible Target #1
FRAME 1796
SPRITENUMBER = 246
SPRITESUBNUMBER = 0
DURATION = 10
NEXT = 1797
ACTION A_FindTracer
Var1 = 322
var2 = 0

# Turret Firing Once
FRAME 1797
SPRITENUMBER = 246
SPRITESUBNUMBER = 0
DURATION = 20
NEXT = 1798
ACTION A_ShootBullet

# Rotating
FRAME 1798
SPRITENUMBER = 246
SPRITESUBNUMBER = 0
DURATION = 20
NEXT = 1799
ACTION A_ChangeAngleRelative
VAR1 = 90
VAR2 = 90

###################################
# Targeting Invisible Target #2
FRAME 1799
SPRITENUMBER = 246
SPRITESUBNUMBER = 0
DURATION = 10
NEXT = 1800
ACTION A_FindTracer
Var1 = 322
var2 = 0

# Turret Firing Twice
FRAME 1800
SPRITENUMBER = 246
SPRITESUBNUMBER = 0
DURATION = 20
NEXT = 1801
ACTION A_ShootBullet

# Rotating
FRAME 1801
SPRITENUMBER = 246
SPRITESUBNUMBER = 0
DURATION = 20
NEXT = 1802
ACTION A_ChangeAngleRelative
VAR1 = 90
VAR2 = 90

###################################
# Targeting Invisible Target #3
FRAME 1802
SPRITENUMBER = 246
SPRITESUBNUMBER = 0
DURATION = 10
NEXT = 1803
ACTION A_FindTracer
Var1 = 322
var2 = 0

# Turret Firing Thrice
FRAME 1803
SPRITENUMBER = 246
SPRITESUBNUMBER = 0
DURATION = 20
NEXT = 1804
ACTION A_ShootBullet

# Rotating
FRAME 1804
SPRITENUMBER = 246
SPRITESUBNUMBER = 0
DURATION = 20
NEXT = 1805
ACTION A_ChangeAngleRelative
VAR1 = 90
VAR2 = 90

###################################
# Targeting Invisible Target #4
FRAME 1805
SPRITENUMBER = 246
SPRITESUBNUMBER = 0
DURATION = 10
NEXT = 1806
ACTION A_FindTracer
Var1 = 322
var2 = 0

# Turret Firing Frice
FRAME 1806
SPRITENUMBER = 246
SPRITESUBNUMBER = 0
DURATION = 20
NEXT = 1807
ACTION A_ShootBullet

# Rotating
FRAME 1807
SPRITENUMBER = 246
SPRITESUBNUMBER = 0
DURATION = 20
NEXT = 1796
ACTION A_ChangeAngleRelative
VAR1 = 90
VAR2 = 90
 
I have one more question as far as this is concerned. How can I change the Z offset of the projectile. I'm using A_ShootBullet. I've tried other projectiles but they all seem to throw the projectile. (by throw I mean there's an arch) and other projectile are too violent.

A_FireShot is probably what you're looking for here; it allows you to specify the projectile fired in VAR1, and the Z offset in VAR2. However, in order to keep the projectile's path horizontal you may need to also adjust the Z displacement of the invisible target, by multiplying the desired Z displacement of the invisible target by 65536 and adding it to VAR1 of the A_CapeChase state. The trick is to make sure that the height at which the projectile spawns and the height of "Invisible target" are the same.

Use A_FindTracer on the turret or target? Same question for A_CapeChase.
The turret should use A_FindTarget to target "Invisible target", as whatever firing action you use works by shooting at the actor's(the object using the action, in this case the turret) target.

"Invisible target" should use A_FindTracer on the turret, so that A_CapeChase can use Tracer. Add 1 to VAR1 of the state using capechase to configure it to use "Invisible Target"'s tracer(which you just set to the turret using A_FindTracer) as the target object of A_CapeChase instead of "Invisible Target"'s target(which probably doesn't exist).

In this condition, the target spawns (I know this because I've given it a temporary sprite) but shortly after spawning it disappears. I'm not sure if it goes into the floor or disappears entirely. Needless to say It's way off from orbiting.
A_CapeChase checks to see if the selected target object(the actor's target or tracer, depending on VAR1) doesn't exist or has 0 health; if either of those things are true, the actor despawns. This probably explains the issue you brought up with your attempt at a single target version not working, as you had configured A_CapeChase to use target instead of tracer. Thus, when "Invisible target" used A_CapeChase, it found that the target object of the action, "Invisible target"'s tracer, didn't exist and so told "Invisible target" to despawn.
 
Can I just jump in and ask - do you really want the turret to rotate in 90 degree chunks, rather than it turning in a smooth circle?

If you want the latter, you could possibly just have the invisible target use A_RotateSpikeBall instead of A_CapeChase, so the turret won't need to use A_ChangeAngleRelative at all - as long as the invisible target is its target, it will turn with the target to try and shoot it down.

If not, completely ignore what I just said. =V
 
Yeah, 90 degree increments are ideal. Unless I could get the target to move, pause, move, pause. It would probably make a smoother rotation and their would be less SOCing on the turret. But then (I think) all that SOCing would go to the target. That just sounds maddening since I've already programed the turret. I tried to use A_RotateSpikeball for the target anyway (thinking it would help it to follow the turret) but that didn't work either (for reasons that are beyond me) After a long day of SOCing the best I could get is...

After everything spawns, the turret does fire at the target. the target still wont move and still disappears. The turret tries to rotate but flips back to its starting point and shoots at the target that is seemingly no longer there. Other turrets placed in the zone rotate fine but I haven't placed targets around them so I'm not expecting them to fire yet.

Ultimately it would be fantastic if the turrets actually spawned the target themselves relative to their position. Because 1 I'm not sure how to set the targets offset other than the map editor and 2 some turrets sit in pits while others are flat on the ground or even on small hills. Again, nailing this skill will come in handy for far more than just turrets.

Not wanting to flood the thread with yet another complete SOC, I have here everything for target and the first rotation for the turret (since it's rotating properly but it's targeting might be the problem) This is the SOC I made before I destroyed everything trying to get the turret to spawn the target.


# Turret
Thing 321
MAPTHINGNUM = 125
SPAWNSTATE = 1795
SPAWNHEALTH = 1000
SEESTATE = 1803
SEESOUND = 0
REACTIONTIME = 100
ATTACKSOUND = 119
ACTIVESOUND = 119
PAINSTATE = 0
PAINCHANCE = 2000
PAINSOUND = 0
MELEESTATE = 0
MISSILESTATE = 0
SPEED = 0
RADIUS = 1310720
HEIGHT = 3932160
MASS = 0
DAMAGE = 200
ACTIVESOUND = 0
RAISESTATE = 111
FLAGS = 2147483650

#Spawning Turret
FRAME 1795
SPRITENUMBER = 246
SPRITESUBNUMBER = 0
DURATION = 1
NEXT = 1796
ACTION None

# Turret's Invisible Orbiting Target
Thing 322
MAPTHINGNUM = 126
SPAWNSTATE = 1808
SPAWNHEALTH = 5000
RADIUS = 1310720
HEIGHT = 3276800
MASS = 100
FLAGS = 512

# Target Spawning
FRAME 1808
SPRITENUMBER = 247
SPRITESUBNUMBER = 0
DURATION = 100
NEXT = 1809
ACTION None

# Looking for Turret
FRAME 1809
SPRITENUMBER = 247
SPRITESUBNUMBER = 0
DURATION = 20
NEXT = 1810
ACTION A_FindTracer
VAR1 = 246
VAR2= 0

# Taking Orbit Around Turret
FRAME 1810
SPRITENUMBER = 247
SPRITESUBNUMBER = 0
DURATION = 20
NEXT = 1809 <NOTE; weather this frame jumps back 1809 or 1810 the in-game result turned out the same>
ACTION A_CapeChase
VAR1 = 1966081 <NOTE; Yes I added 1>
VAR2 = 7964320

###################################
# Targeting Invisible Target
FRAME 1796
SPRITENUMBER = 246
SPRITESUBNUMBER = 0
DURATION = 10
NEXT = 1797
ACTION A_FindTarget
Var1 = 322
var2 = 0

# Turret Firing Once
FRAME 1797
SPRITENUMBER = 246
SPRITESUBNUMBER = 0
DURATION = 20
NEXT = 1798
ACTION A_ShootBullet

# Rotating
FRAME 1798
SPRITENUMBER = 246
SPRITESUBNUMBER = 0
DURATION = 20
NEXT = 1799
ACTION A_ChangeAngleRelative
VAR1 = 90
VAR2 = 90
 
Last edited:
Ultimately it would be fantastic if the turrets actually spawned the target themselves relative to their position. Because 1 I'm not sure how to set the targets offset other than the map editor and 2 some turrets sit in pits while others are flat on the ground or even on small hills. Again, nailing this skill will come in handy for far more than just turrets.
Use A_SpawnObjectRelative. It allows you to spawn any Object you like and determined its relative position to the turret.

The problem is that I can't properly test your SOC to see what's wrong because I don't have the sprites and your test map.
 
Use A_SpawnObjectRelative. It allows you to spawn any Object you like and determined its relative position to the turret.

The problem is that I can't properly test your SOC to see what's wrong because I don't have the sprites and your test map.

I was looking at A_SpawnObject! That's certainly the rout I'm going to take but first I need to stabilize "invisible target" I've been working on it all day and night and though I fixed some obvious problems since my latest post "invisible target" never takes orbit and still despawns.

I also wanna thank you setting me straight on the directories. For a review, and these are ultimately the pieces of information I've been pining for, it is the SpriteNumber that calls sprites from the lumps? Additionally, the ThingNumber or ID is how objects can reference each other or interact, not through their SpriteNumbers or MapThingNumbers. So SpriteNumber 243 will always call lumps with the FOO1 prefix but its ThingNumber and MapThingNumber can be whatever the hell I want in the free slots, less I overwrite something. Again, correct me if I'm wrong but I think I got it right this time!!!

And I would greatly appreciate you taking a look at my map!
Green Grove I
http://www.mediafire.com/?oqqw207nqq6oncs
 
Last edited:
O.K. A few more hours of intense SOCing and I'm almost there! I got the turrets to spawn their own targets with the correct distance and Z position. Getting them to finally orbit proves tricky because they keep despawning. But only when I use A_CapeChase or A_RotateSpikeBall. I can get the targets to all kinds of actions (like A_changePositionRelative/ absolute or A_BunnyHop) and the turrets are happy to fire at them while they slide or fly to the furthest reaches of the map:p Does A_RotateSpikeBall require 8 states as I have observed on the EggMobile? I ask because I already have stuff in some of those states and I'm reluctant to move it all around again.
 
Last edited:
Does A_RotateSpikeBall require 8 states as I have observed on the EggMobile? I ask because I already have stuff in some of those states and I'm reluctant to move it all around again.

No, it doesn't require 8 states. The only reason the Egg Mobile's spikeball needs 8 states is so all 8 frames of it's animation are shown.

All you really need to use in your case is just one state, since of course there is no animation involved. =P
 
No, it doesn't require 8 states. The only reason the Egg Mobile's spikeball needs 8 states is so all 8 frames of it's animation are shown.

All you really need to use in your case is just one state, since of course there is no animation involved. =P

And with that, I nailed it:D The turrets spawn their own targets. the targets locate the turrets, taking orbit and the turrets try desperately to shoot them down! THANKS EVERYBODY!!!
 
He does want it to rotate in 90 degree chunks. He wants to recreate the turret from Sonic 3D Blast.
Actually, I think I see what MI's saying. The turret as-is will turn the full 90° instantly, instead of smoothly turning from one 90° angle to another. You'd probably do better to have six states where it turns 15° instead...
 
Actually, I think I see what MI's saying. The turret as-is will turn the full 90° instantly, instead of smoothly turning from one 90° angle to another. You'd probably do better to have six states where it turns 15° instead...

I was thinkin' that myself. A smoother rotaion would rock! Now that I have the whole setup rigged properly, I'mma tweak some things. I may be able to time everything right and get rid of most of the turret's frames altogether as I'll see if tracking the target yields desirable results.
 
Status
Not open for further replies.

Who is viewing this thread (Total: 1, Members: 0, Guests: 1)

Back
Top