Ideas for coding a helicopter-type actor?

Archive of the old editing forum
Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. This forum is archived - please use this set of forums to ask new questions.
Locked
User avatar
Boreas249
Posts: 112
Joined: Thu Aug 05, 2010 10:47 am

Ideas for coding a helicopter-type actor?

Post by Boreas249 »

So I've been brainstorming about how to make a helicopter type foe. Now simply replacing Cacodemon sprites and modifying its missile codes so it fires some rockets and a machine gun won't cut it here; I want it to FEEL like you're fighting an actual rotary wing aircraft. In other words, it stays a good altitude above the ground, not too far from the player but also not too close, evades oncoming projectiles (i.e. rockets) and hammers its target while on the move most of the time.
I can see the "fastchase" action command being helpful for this but that's about it; I can't think of a way to make it behave like a helicopter would and not a Cacodemon or other airborne demonfolk. (I am not that good at coding. Yet. Heh.)
Now I know even if I could code this correctly it wouldn't perfectly mimick an actual helicopter (unfortunately) but I'm not looking for total realism, just something that at least feels like you're faced against an actual airborne vehicle and not a Cacodemon in a helicopter costume. (Nor a Sentinel, noooooooo.)
So may someone help me with some ideas on how to do this, please?
RaveYard
Posts: 194
Joined: Fri Apr 12, 2013 10:51 am

Re: Ideas for coding a helicopter-type actor?

Post by RaveYard »

Here something on top of my head:

Prototype for an actor states: it should stay 384 units above the floor...
Or to be precise.. get pushed up... so this actor should be affected by gravity in order to not float towards the ceiling. There are other solutions too...

Code: Select all

States {
  Spawn:
      PLSS A 1 A_JumpIf(z-floorz < 384,"PushUp")
      loop
 PushUp:
      PLSS B 1 A_ChangeVelocity(0,0,10)
      goto Spawn
}
This should follow it's target until hitting a certain distance

Code: Select all

States {
   Spawn:
    POSS AB 2 A_Look
    loop
   See:
    POSS ABCD 4 A_Chase //You should check for each frame A B C D but I am too lazy to write that here
    POSS A 0 A_JumpIfCloser(512,"Standing")
    loop
   Standing:
     POSS A 2
     POSS A 2 A_JumpIfCloser(512,"Standing")
     goto See
}
Avoiding missile ... no real solution which wouldn't require insane coding or would be half pretending to dodge... (something like Brutal Doom's dodging zombies)

Also you might try to push the chopper around rather than using A_Chase and +NOGRAVITY... just an idea.

EDIT: I haven't tested these codes myself, so sorry if it doesn't work.
User avatar
Boreas249
Posts: 112
Joined: Thu Aug 05, 2010 10:47 am

Re: Ideas for coding a helicopter-type actor?

Post by Boreas249 »

Well, it didn't work right at all without the +NOGRAVITY flag. so I had to put it back on... otherwise the actor just stayed in place and did nothing but try to stay 384 units above the floor. It seems actors affected by gravity cannot attack or perform other actions (i.e. chase or missile commands) while not on solid ground, if they are airborne they will do nothing until they reach a surface and cannot move in any direction other than that which they are already set to be moving. (heh, physics.)
However. with the +NOGRAVITY flag, while it does float straight to the ceiling, it still stays on the move at least, and performs its normal actions.

So this is a start. Thank you!
Now to find out how to keep it from getting up too high, and the other things... but it's starting to come together.
Also, this gives me ideas of other funny things I can do with actors... :3
User avatar
Caligari87
Admin
Posts: 6225
Joined: Thu Feb 26, 2004 3:02 pm
Preferred Pronouns: He/Him
Contact:

Re: Ideas for coding a helicopter-type actor?

Post by Caligari87 »

How about getting the difference between floorz and ceilingz, then using those as a kind of "range" the actor has to stay between? If it gets too high, push it down, and if too low push it back up. Sort of like "range=(ceilingz-floorz)/2" or something.

8-)
User avatar
Boreas249
Posts: 112
Joined: Thu Aug 05, 2010 10:47 am

Re: Ideas for coding a helicopter-type actor?

Post by Boreas249 »

There's an idea. I'll have to try that out when I can.
User avatar
Caligari87
Admin
Posts: 6225
Joined: Thu Feb 26, 2004 3:02 pm
Preferred Pronouns: He/Him
Contact:

Re: Ideas for coding a helicopter-type actor?

Post by Caligari87 »

Ooo! You could even have the actor send a "movement target" marker out, either toward its target, or offset to allow strafing. The invisible movement marker would center itself between floor and ceiling, report if there's enough room, and you can thrust the actor toward the marker. That way it can stay focused on the target and strafe around it or various other behaviors.

8-)
User avatar
Athel
Posts: 777
Joined: Wed Aug 21, 2013 11:31 am
Location: New Jersey

Re: Ideas for coding a helicopter-type actor?

Post by Athel »

How about AD2's helicopter? It (ab)uses ACS but it works well...unless its not what you're looking for...?
User avatar
Boreas249
Posts: 112
Joined: Thu Aug 05, 2010 10:47 am

Re: Ideas for coding a helicopter-type actor?

Post by Boreas249 »

I haven't played AD2 (yet) so I dunno what that's like. I'm also trying not to use ACS for this at all (which might be hard, but I may resort to that will if I have to though.) but we'll see how this goes.

I'm liking the thought of the movement marker idea. :D
Gez
 
 
Posts: 17938
Joined: Fri Jul 06, 2007 3:22 pm

Re: Ideas for coding a helicopter-type actor?

Post by Gez »

Boreas249 wrote:Now I know even if I could code this correctly it wouldn't perfectly mimick an actual helicopter (unfortunately)
Good thing too, because you'd have to code so many "if (weird and non-intuitive situation) crash();" for a realistic helicopter. Examples include hovering at just the right altitude or just going really fast. Even being on the ground can cause a crash! :P
User avatar
Isle
Posts: 687
Joined: Fri Nov 21, 2003 1:30 am
Location: Arizona, USA

Re: Ideas for coding a helicopter-type actor?

Post by Isle »

fellowzdoomer wrote:How about AD2's helicopter? It (ab)uses ACS but it works well...unless its not what you're looking for...?
AD2's heli isn't so bad, it's just a monster on an invisible platform.
Locked

Return to “Editing (Archive)”