Helicopter

Learn here how to create and use plugins.

Moderator: Plugin Moderators

User avatar
Lobby
Developer
Reactions:
Posts: 3705
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 13048 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 13048 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 623 times

User avatar
Lobby
Developer
Reactions:
Posts: 3705
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 13045 times
  • $helifirefighter00
    fire.png
    fire.png (767 Bytes) Viewed 13045 times
  • $helipolice00
    police.png
    police.png (777 Bytes) Viewed 13045 times
  • $helinews00
    news.png
    news.png (735 Bytes) Viewed 13045 times
  • $heliswat00
    swat.png
    swat.png (594 Bytes) Viewed 13045 times

User avatar
JustAnyone
Developer
Reactions:
Posts: 3474
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.

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

Plugin Creator

Platform

Re: [385]Helicopter

#4

Post by TheFennekin »

Time to create a fighter heli :lol:

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

Plugin Creator

Platform

Re: [385]Helicopter

#5

Post by THEMAX »

The new STQAE combat helicopters will take off soon

User avatar
-LeoLeo-
Inhabitant of a Solar System
Reactions:
Posts: 1624
Joined: 08 Jul 2017, 12:46
Plugins: Showcase Store
Version: Beta
Contact:

Plugin Creator

Platform

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

User avatar
Lobby
Developer
Reactions:
Posts: 3705
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
Plugins: Showcase Store
Version: Beta
Contact:

Plugin Creator

Platform

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 12854 times
1 - TT_Plugin_Management_VTOLpad.png
1 - TT_Plugin_Management_VTOLpad.png (1000 Bytes) Viewed 12854 times
TT_Pulgin_Managment_VTOLpad.json
(581 Bytes) Downloaded 281 times
Last edited by -LeoLeo- on 20 Dec 2017, 19:32, edited 1 time in total.

User avatar
JustAnyone
Developer
Reactions:
Posts: 3474
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?

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

Plugin Creator

Platform

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: 3705
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: 11086
Joined: 07 Jun 2016, 21:12
Plugins: Showcase Store
Version: Beta

Plugin Creator

Platform

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
Plugins: Showcase Store
Version: Beta
Contact:

Plugin Creator

Platform

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?

User avatar
Lobby
Developer
Reactions:
Posts: 3705
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: 11086
Joined: 07 Jun 2016, 21:12
Plugins: Showcase Store
Version: Beta

Plugin Creator

Platform

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: 3705
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
Plugins: Showcase Store
Version: Beta
Contact:

Plugin Creator

Platform

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.

User avatar
hihihihi
Metropolitan
Reactions:
Posts: 111
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..?

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

Plugin Creator

Platform

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: 131
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 🥺

Post Reply Previous topicNext topic

Return to “Tutorials and Documentation”