Helicopter

Learn here how to create and use plugins.

Moderator: Plugin Moderators

User avatar
Lobby
Developer
Reactions:
Posts: 3686
Joined: 26 Oct 2008, 12:34
Plugins: Showcase Store
Version: Beta

Platform

Helicopter

#1

Post by Lobby »

preview.png
Since version 385 you're able to define helicopter spawners, therefore it now also makes sense to define your own ones. Everything you need are frames for the heli. For example these :img
heli.png
heli.png (1.93 KiB) Viewed 9217 times
Each has a size of 38x18. The helicopter definition looks now like :json

Code: Select all

{
  "id":"$my_heli00",
  "type":"helicopter",
  "frames":[{"bmp":"heli.png","w":38,"h":18,"count":4,"handle x":18,"handle y":16}], // 4 frames for the helicopter, handle defined the pivot point
  "animation":[{
    "id":"$rotor00","x":0,"y":-10
  }]
}
Notice how is uses a predefined animation called "$rotor00". It just contains 8 images, 4 for slow rotation, 4 for fast rotation. In most cases you won't need to come up with your own rotor frames.
For reference it's defined by

Code: Select all

{
  "id":"$rotor00",
  "type":"animation",
  "frames":[
    {"x":360,"y":526,"w":38,"h":9,"count":4,"handle x":18,"handle y":5},
    {"x":360,"y":512,"w":38,"h":13,"count":4,"handle x":18,"handle y":6}
  ]
}
For the helicopter spawner let's define a decoration tile :img
heliport.png
heliport.png (976 Bytes) Viewed 9217 times
It's code contains the helicopter spawner :json

Code: Select all

{
  "id":"$heliplaza00",
  "type":"decoration",
  "width":1,
  "height":1,
  "frames":[{"bmp":"heliport.png"}],
  "build height":0,  // Ensure correct building height so that helicopter will start at right height (zero = ground level)
  "helicopter spawner":{  // Helicopter spawner object
    "id":"$my_heli00",  // Id of the helicopter to spawn
    "radius":16  // Radius where they helicopter will fly randomly. Is 16 by default
  }
}
Note that the id provided in a helicopter spawner doesn't have to be defined yet. However, if it's still not defined when the game tries to use it, it will crash. So always test your own plugins :)

In conclusion, the complete code for this sample plugin :json

Code: Select all

[
  {
    "id":"$my_heli00",
    "type":"helicopter",
    "frames":[{"bmp":"heli.png","w":38,"h":18,"count":4,"handle x":18,"handle y":16}],
    "animation":[{
      "id":"$rotor00","x":0,"y":-10
    }]
  },
  
  {
    "id":"$heliplaza00",
    "type":"decoration",
    "width":1,
    "height":1,
    "frames":[{"bmp":"heliport.png"}],
    "build height":0,
    "helicopter spawner":{
      "id":"$my_heli00",
      "radius":16
    }
  }
]
Attachments
own_heli.zip
(3.7 KiB) Downloaded 518 times
=^._.^= ∫

User avatar
Lobby
Developer
Reactions:
Posts: 3686
Joined: 26 Oct 2008, 12:34
Plugins: Showcase Store
Version: Beta

Platform

Re: [385]Helicopter

#2

Post by Lobby »

In case you want to use or override an existing helicopter, their ids are:
  • $heliprivate00
    priv.png
    priv.png (781 Bytes) Viewed 9214 times
  • $helifirefighter00
    fire.png
    fire.png (767 Bytes) Viewed 9214 times
  • $helipolice00
    police.png
    police.png (777 Bytes) Viewed 9214 times
  • $helinews00
    news.png
    news.png (735 Bytes) Viewed 9214 times
  • $heliswat00
    swat.png
    swat.png (594 Bytes) Viewed 9214 times
=^._.^= ∫

User avatar
JustAnyone
Developer
Reactions:
Posts: 3340
Joined: 23 Jul 2017, 12:45
Location: Easter Island
Plugins: Showcase Store

Platform

Re: [385]Helicopter

#3

Post by JustAnyone »

My life is working once again.
:pickle:

User avatar
TheFennekin
Neighborhood fox
Reactions:
Posts: 2723
Joined: 24 Aug 2017, 11:17
Location: Wandering around
Plugins: Showcase Store
Version: Beta

Platform

Plugin Creator

Re: [385]Helicopter

#4

Post by TheFennekin »

Time to create a fighter heli :lol:
Doing my 100+ pages modules 2 days before the deadline :D

User avatar
THEMAX
Inhabitant of a Universe
Reactions:
Posts: 4303
Joined: 14 Sep 2017, 17:30
Location: Astrellia, UHAE
Plugins: Showcase Store
Version: Beta

Platform

Plugin Creator

Re: [385]Helicopter

#5

Post by THEMAX »

The new STQAE combat helicopters will take off soon
Emperor of Atlantean federated empire
Image
Founder state of Internationxal council
Leader of AEOY and steel pact

User avatar
-LeoLeo-
Inhabitant of a Solar System
Reactions:
Posts: 1624
Joined: 08 Jul 2017, 12:46
Location: Planet Fastoon, Polaris Galaxy // Th
Plugins: Showcase Store
Version: Beta
Contact:

Platform

Plugin Creator

Re: [385]Helicopter

#6

Post by -LeoLeo- »

Lobby wrote:
07 Dec 2017, 20:51
Note that the id provided in a helicopter spawner doesn't have to be defined yet. However, if it's still not defined when the game tries to use it, it will crash. So always test your own plugins :)
Excuse me... What does this means? I already spent 4½ hours doing a pad and this is my last problem to solve finally..., the game crashed when the game tried to use it. Can someone give more explanation?

I gave my aircraft It's own ID in the code, and put the same ID in the heli-spawner part code. I checked everything. But... Yeah
• The KING of procrastination! •

¤ The P.M. of Attobaxia.
¤ The CEO of Leopolis Corp.
¤ Love Ratchet&Clank

;) :space

User avatar
Lobby
Developer
Reactions:
Posts: 3686
Joined: 26 Oct 2008, 12:34
Plugins: Showcase Store
Version: Beta

Platform

Re: [385]Helicopter

#7

Post by Lobby »

May you show your code? I assume there's something wrong in it that's not that obvious.
=^._.^= ∫

User avatar
-LeoLeo-
Inhabitant of a Solar System
Reactions:
Posts: 1624
Joined: 08 Jul 2017, 12:46
Location: Planet Fastoon, Polaris Galaxy // Th
Plugins: Showcase Store
Version: Beta
Contact:

Platform

Plugin Creator

Re: [385]Helicopter

#8

Post by -LeoLeo- »

Well.... I use JsonGenie, so there could be a 99%chance of me screwing up. I didn't watchany tutorials too, just try to make sense of your code and fix the game's syntax errors til i got it to work to this stage. quite proud of myself, actually. lol


By the way. Can you make 1 helipad spawn diferrent kinds of helicopters? I assume you can, right? just expand more of the same code?? What a code to set 'destination' to the chopper? "destination":(building id)???

And, yes, it's a flying car. Because why not?!

To anyone who would download this... I just wanna say it doesn't work.
Attachments
1 - TT_Plugin_Management_AeroCars01.png
1 - TT_Plugin_Management_AeroCars01.png (2.18 KiB) Viewed 9023 times
1 - TT_Plugin_Management_VTOLpad.png
1 - TT_Plugin_Management_VTOLpad.png (1000 Bytes) Viewed 9023 times
TT_Pulgin_Managment_VTOLpad.json
(581 Bytes) Downloaded 213 times
Last edited by -LeoLeo- on 20 Dec 2017, 19:32, edited 1 time in total.
• The KING of procrastination! •

¤ The P.M. of Attobaxia.
¤ The CEO of Leopolis Corp.
¤ Love Ratchet&Clank

;) :space

User avatar
JustAnyone
Developer
Reactions:
Posts: 3340
Joined: 23 Jul 2017, 12:45
Location: Easter Island
Plugins: Showcase Store

Platform

Re: [385]Helicopter

#9

Post by JustAnyone »

-LeoLeo- wrote:
20 Dec 2017, 19:23
Well.... I use JsonGenie, so there could be a 99%chance of me screwing up. I didn't watchany tutorials too, just try to make sense of your code and fix the game's syntax errors til i got it to work to this stage. quite proud of myself, actually. lol


By the way. Can you make 1 helipad spawn diferrent kinds of helicopters? I assume you can, right? just expand more of the same code?? What a code to set 'destination' to the chopper? "destination":(building id)???

And, yes, it's a flying car. Because why not?!
I don't think you can define more than one helicopter.
Maybe.
Lobby am I right?
:pickle:

User avatar
CommanderABab
AB
Reactions:
Posts: 10713
Joined: 07 Jun 2016, 21:12
Plugins: Showcase Store
Version: Beta

Platform

Plugin Creator

Re: [385]Helicopter

#10

Post by CommanderABab »

Code: Select all

"helicopter spawner":{"id":"",
Is probably what crashes your game!

You have to give the spawner the id of the helicopter you defined.

User avatar
Lobby
Developer
Reactions:
Posts: 3686
Joined: 26 Oct 2008, 12:34
Plugins: Showcase Store
Version: Beta

Platform

Re: [385]Helicopter

#11

Post by Lobby »

@JustAnyone is right, multiple helicopters for one building is not supported.
@CommanderABab is right, too. You have to provide the id of your helicopter to the spawner.
Last edited by CommanderABab on 04 Feb 2020, 02:48, edited 1 time in total.
Reason: Removed snow
=^._.^= ∫

User avatar
CommanderABab
AB
Reactions:
Posts: 10713
Joined: 07 Jun 2016, 21:12
Plugins: Showcase Store
Version: Beta

Platform

Plugin Creator

Re: [385]Helicopter

#12

Post by CommanderABab »

You didn't see this coming did you? @Lobby

User avatar
-LeoLeo-
Inhabitant of a Solar System
Reactions:
Posts: 1624
Joined: 08 Jul 2017, 12:46
Location: Planet Fastoon, Polaris Galaxy // Th
Plugins: Showcase Store
Version: Beta
Contact:

Platform

Plugin Creator

Re: [385]Helicopter

#13

Post by -LeoLeo- »

CommanderABab wrote:
20 Dec 2017, 19:40

Code: Select all

"helicopter spawner":{"id":"",
Is probably what crashes your game!

You have to give the spawner the id of the helicopter you defined.
I thought i did.
So i didn't...
Thank you very very much!!

is there anything other thing wrong with the code?
• The KING of procrastination! •

¤ The P.M. of Attobaxia.
¤ The CEO of Leopolis Corp.
¤ Love Ratchet&Clank

;) :space

User avatar
Lobby
Developer
Reactions:
Posts: 3686
Joined: 26 Oct 2008, 12:34
Plugins: Showcase Store
Version: Beta

Platform

Re: [385]Helicopter

#14

Post by Lobby »

Yes, looks fine to me :)
=^._.^= ∫

User avatar
CommanderABab
AB
Reactions:
Posts: 10713
Joined: 07 Jun 2016, 21:12
Plugins: Showcase Store
Version: Beta

Platform

Plugin Creator

Re: [385]Helicopter

#15

Post by CommanderABab »

Besides the lack of rotors?

No, didn't see anything off hand.

User avatar
Lobby
Developer
Reactions:
Posts: 3686
Joined: 26 Oct 2008, 12:34
Plugins: Showcase Store
Version: Beta

Platform

Re: [385]Helicopter

#16

Post by Lobby »

That's a good point, you probably should add

Code: Select all

  "animation":[{
    "id":"$rotor00","x":0,"y":-10
  }]
to your helicopter. If you don't want to have a rotor, that's possible by using an animation of 8 frames that contain nothing.
=^._.^= ∫

User avatar
-LeoLeo-
Inhabitant of a Solar System
Reactions:
Posts: 1624
Joined: 08 Jul 2017, 12:46
Location: Planet Fastoon, Polaris Galaxy // Th
Plugins: Showcase Store
Version: Beta
Contact:

Platform

Plugin Creator

Re: [385]Helicopter

#17

Post by -LeoLeo- »

OMG IT WORKS!!!!!!
Screenshot_2017-12-21-01-26-52.jpg
FLYYY!!! MY MATIES!!


I liturally almost tearup inside.
I didn't though animation matters.

Now I know what's wrong. I can make it even better. Thankyou!!!, Everyone!!

Here's a snowflake for you guys.
• The KING of procrastination! •

¤ The P.M. of Attobaxia.
¤ The CEO of Leopolis Corp.
¤ Love Ratchet&Clank

;) :space

hihihihi
Metropolitan
Reactions:
Posts: 112
Joined: 30 Jul 2019, 06:05
Location: south korea
Plugins: Showcase Store

Platform

Re: Helicopter

#18

Post by hihihihi »

Umm.....how to define "handle x" and "handle y" code...? And about $rotor00 animation..?
Actually, I'm alive. :bc

User avatar
CommanderABab
AB
Reactions:
Posts: 10713
Joined: 07 Jun 2016, 21:12
Plugins: Showcase Store
Version: Beta

Platform

Plugin Creator

Re: Helicopter

#19

Post by CommanderABab »

handle defined the pivot point < see comment in code above.

$rotor00 is a prdefined animation. Much easier to use than trying to make my own animation was. :)

User avatar
Lakan Haraya
Metropolitan
Reactions:
Posts: 128
Joined: 28 Mar 2019, 09:34
Location: Philippines
Plugins: Showcase Store
Version: Beta

Plugin Creator

Platform

Re: Helicopter

#20

Post by Lakan Haraya »

Light animations for helicopters, please 🥺
"ᜀᜃᜓ ᜀᜅ᜔ ᜁᜌᜓᜅ᜔ ᜑᜇᜌ"
CEO of Haráya Motors

“TheoTown Philippines Council”
“Kapulungan Ng Mga Nagkakaisang Lungsod”

Post Reply Previous topicNext topic

Return to “Tutorials and Documentation”