Helicopter

Learn here how to create and use plugins.

Moderator: Plugin Moderators

Post Reply
User avatar
Lobby
Developer
Reactions:
Posts: 2974
Joined: Sun Oct 26, 2008 12:34
Plugins: Show
Version: Beta
Phone: S7 edge

Helicopter

Post by Lobby » Thu Dec 07, 2017 20:51

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 913 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 the helicopter spawner let's define a decoration tile :img
heliport.png
heliport.png (976 Bytes) Viewed 913 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 96 times
...Have a nice stay

User avatar
Lobby
Developer
Reactions:
Posts: 2974
Joined: Sun Oct 26, 2008 12:34
Plugins: Show
Version: Beta
Phone: S7 edge

Re: [385]Helicopter

Post by Lobby » Thu Dec 07, 2017 20:57

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

User avatar
JustAnyone
Feature manager
Reactions:
Posts: 2082
Joined: Sun Jul 23, 2017 12:45
Location: TheoTown command centre
Plugins: Show
Version: Beta
Phone: Xiaomi Redmi 3s

Re: [385]Helicopter

Post by JustAnyone » Thu Dec 07, 2017 23:39

My life is working once again.
Founder and owner of DSA
TheoTown discord manager
Developer of Plugin Creator Application.

User avatar
TheFennekin
Inhabitant of a Solar System
Reactions:
Posts: 1793
Joined: Thu Aug 24, 2017 11:17
Location: Here
Plugins: Show
Version: Beta
Phone: Samsung Galaxy Tab4

Re: [385]Helicopter

Post by TheFennekin » Fri Dec 08, 2017 2:11

Time to create a fighter heli :lol:
Who wants a tower that will not eat your plugin space?!

User avatar
THEMAX
Inhabitant of a Galaxy Cluster
Reactions:
Posts: 2789
Joined: Thu Sep 14, 2017 17:30
Location: Astrellia, UAGF
Plugins: Show
Version: Beta

Re: [385]Helicopter

Post by THEMAX » Fri Dec 08, 2017 9:49

The new STQAE combat helicopters will take off soon
Emperor of Atlantean federated empire
Image
Founder state of United Nations
Leader of OISP

#FightLikeAizat
#PrayForAizat

User avatar
-LeoLeo-
Inhabitant of a Continent
Reactions:
Posts: 1281
Joined: Sat Jul 08, 2017 12:46
Location: Planet Fastoon, Polaris Galaxy // Th
Plugins: Show
Version: Beta
Phone: Vivo V7

Re: [385]Helicopter

Post by -LeoLeo- » Wed Dec 20, 2017 18:53

Lobby wrote:
Thu Dec 07, 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
• I'm one with the Lombaxes •
-สวัสดี! มีใครอ่านไทยมั๊ยฮะ?-
- #PrayForAizat -


Detroit: Become Human looks cool AS HELL ❤️ |ℹ️|
¤ The P.M. of Attobaxia.
¤ The CEO of Leopolis Corp.
¤ Love Ratchet&Clank

;) :space

User avatar
Lobby
Developer
Reactions:
Posts: 2974
Joined: Sun Oct 26, 2008 12:34
Plugins: Show
Version: Beta
Phone: S7 edge

Re: [385]Helicopter

Post by Lobby » Wed Dec 20, 2017 19:08

May you show your code? I assume there's something wrong in it that's not that obvious.
...Have a nice stay

User avatar
-LeoLeo-
Inhabitant of a Continent
Reactions:
Posts: 1281
Joined: Sat Jul 08, 2017 12:46
Location: Planet Fastoon, Polaris Galaxy // Th
Plugins: Show
Version: Beta
Phone: Vivo V7

Re: [385]Helicopter

Post by -LeoLeo- » Wed Dec 20, 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?!

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 719 times
1 - TT_Plugin_Management_VTOLpad.png
1 - TT_Plugin_Management_VTOLpad.png (1000 Bytes) Viewed 719 times
TT_Pulgin_Managment_VTOLpad.json
(581 Bytes) Downloaded 30 times
Last edited by -LeoLeo- on Wed Dec 20, 2017 19:32, edited 1 time in total.
• I'm one with the Lombaxes •
-สวัสดี! มีใครอ่านไทยมั๊ยฮะ?-
- #PrayForAizat -


Detroit: Become Human looks cool AS HELL ❤️ |ℹ️|
¤ The P.M. of Attobaxia.
¤ The CEO of Leopolis Corp.
¤ Love Ratchet&Clank

;) :space

User avatar
JustAnyone
Feature manager
Reactions:
Posts: 2082
Joined: Sun Jul 23, 2017 12:45
Location: TheoTown command centre
Plugins: Show
Version: Beta
Phone: Xiaomi Redmi 3s

Re: [385]Helicopter

Post by JustAnyone » Wed Dec 20, 2017 19:29

-LeoLeo- wrote:
Wed Dec 20, 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?
Founder and owner of DSA
TheoTown discord manager
Developer of Plugin Creator Application.

User avatar
CommanderABab
Inhabitant of a Multiverse
Reactions:
Posts: 5883
Joined: Tue Jun 07, 2016 21:12
Plugins: Show
Version: Beta

Re: [385]Helicopter

Post by CommanderABab » Wed Dec 20, 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.
497497Currently using 497. 497 What's new? :)
Save bug squashed!
:)

Telegram - t.me/
🆎️🆎️🆎️🆎️Commander🆎️🆎️

User avatar
Lobby
Developer
Reactions:
Posts: 2974
Joined: Sun Oct 26, 2008 12:34
Plugins: Show
Version: Beta
Phone: S7 edge

Re: [385]Helicopter

Post by Lobby » Wed Dec 20, 2017 19:47

@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.
...Have a nice stay

User avatar
CommanderABab
Inhabitant of a Multiverse
Reactions:
Posts: 5883
Joined: Tue Jun 07, 2016 21:12
Plugins: Show
Version: Beta

Re: [385]Helicopter

Post by CommanderABab » Wed Dec 20, 2017 19:48

You didn't see this coming did you? @Lobby
497497Currently using 497. 497 What's new? :)
Save bug squashed!
:)

Telegram - t.me/
🆎️🆎️🆎️🆎️Commander🆎️🆎️

User avatar
-LeoLeo-
Inhabitant of a Continent
Reactions:
Posts: 1281
Joined: Sat Jul 08, 2017 12:46
Location: Planet Fastoon, Polaris Galaxy // Th
Plugins: Show
Version: Beta
Phone: Vivo V7

Re: [385]Helicopter

Post by -LeoLeo- » Wed Dec 20, 2017 19:53

CommanderABab wrote:
Wed Dec 20, 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?
• I'm one with the Lombaxes •
-สวัสดี! มีใครอ่านไทยมั๊ยฮะ?-
- #PrayForAizat -


Detroit: Become Human looks cool AS HELL ❤️ |ℹ️|
¤ The P.M. of Attobaxia.
¤ The CEO of Leopolis Corp.
¤ Love Ratchet&Clank

;) :space

User avatar
Lobby
Developer
Reactions:
Posts: 2974
Joined: Sun Oct 26, 2008 12:34
Plugins: Show
Version: Beta
Phone: S7 edge

Re: [385]Helicopter

Post by Lobby » Wed Dec 20, 2017 19:57

Yes, looks fine to me :)
...Have a nice stay

User avatar
CommanderABab
Inhabitant of a Multiverse
Reactions:
Posts: 5883
Joined: Tue Jun 07, 2016 21:12
Plugins: Show
Version: Beta

Re: [385]Helicopter

Post by CommanderABab » Wed Dec 20, 2017 19:58

Besides the lack of rotors?

No, didn't see anything off hand.
497497Currently using 497. 497 What's new? :)
Save bug squashed!
:)

Telegram - t.me/
🆎️🆎️🆎️🆎️Commander🆎️🆎️

User avatar
Lobby
Developer
Reactions:
Posts: 2974
Joined: Sun Oct 26, 2008 12:34
Plugins: Show
Version: Beta
Phone: S7 edge

Re: [385]Helicopter

Post by Lobby » Wed Dec 20, 2017 20:04

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.
...Have a nice stay

User avatar
-LeoLeo-
Inhabitant of a Continent
Reactions:
Posts: 1281
Joined: Sat Jul 08, 2017 12:46
Location: Planet Fastoon, Polaris Galaxy // Th
Plugins: Show
Version: Beta
Phone: Vivo V7

Re: [385]Helicopter

Post by -LeoLeo- » Wed Dec 20, 2017 20:33

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.
• I'm one with the Lombaxes •
-สวัสดี! มีใครอ่านไทยมั๊ยฮะ?-
- #PrayForAizat -


Detroit: Become Human looks cool AS HELL ❤️ |ℹ️|
¤ The P.M. of Attobaxia.
¤ The CEO of Leopolis Corp.
¤ Love Ratchet&Clank

;) :space

Post Reply

Return to “Tutorials and Documentation”

Who is online

Users browsing this forum: No registered users and 1 guest