Change Projectiles?

Description: Official subforum for LunaLua - an extension framework for SMBX Engine Version 1.3 (which a core of SMBX 2.0). Share your creations that require the use of LunaLUA. You may also share info/tutorials on how to use LunaLUA.
Moderator: Moderators

Jayce 777
Topic author, Citizen
Citizen
Jayce 777
Topic author, Citizen
Citizen
Reputation: 0
Posts: 5
Joined: 8 Jun 2016

Post #1by Jayce 777 » 25 Jul 2016, 20:14

I am trying to change Birdo eggs into Rinkas, but I can't get the right code. Is this correct?

Code: Select all

function onTick()
      for _, n in pairs(NPC.get(40, -1)) do --for all Birdo Eggs in all sections
            n.id = 210 --turn Birdo Eggs into Rinkas
      end
end
:crazy: :wacko: :SOS: !SOS!
Jayce777
Very skilled gamer
Very intelligent
e=2.71...
(5x+2)(5x-2)=25x^2
Plays Super Mario Maker Often
I support:
[spoiler][url=http://www.supermariobrosx.org/forums/viewtopic.php?f=34&t=3610&p=44996#p44996][img]http://i782.photobucket.com/albums/yy104/henryrichard1234/qLvulGW%201_zpshylsf0or.png[/img][/url][url=http://www.supermariobrosx.org/forums/viewtopic.php?f=31&t=11593][img]http://i1063.photobucket.com/albums/t520/Pwner523746/Graphics%20pack%20logo.png[/img][/url][url=http://www.supermariobrosx.org/forums/viewtopic.php?f=34&t=467&p=2740#p2740][img]http://s10.postimg.org/9dpghzcfd/support_banner.png[/img][/url][url=http://www.supermariobrosx.org/forums/viewtopic.php?f=34&t=13458][img]http://i.imgur.com/vidjJFM.png[/img][/url][/spoiler]

Sambo M
Count
Count
Avatar
Sambo M
Count
Count
Age: 20
Reputation: 13
Posts: 264
Joined: 27 Jun 2014

Post #2by Sambo » 25 Jul 2016, 21:30

That looks like it should turn Birdo's eggs into Rinkas. It may be a bit buggy though, since it doesn't change the size of the NPC or the number of frames it has.
Have you tested this?
Image
Current Project:
Image

Jayce 777
Topic author, Citizen
Citizen
Jayce 777
Topic author, Citizen
Citizen
Reputation: 0
Posts: 5
Joined: 8 Jun 2016

Re : Change Projectiles?

Post #3by Jayce 777 » 25 Jul 2016, 22:20

My laptop is broken, so I cannot. I may tweak it.

Will this fix width and height?

Code: Select all

function onTick()
      for _, n in pairs(NPC.get(40, -1)) do --for all Birdo Eggs in all sections
            n.id = 210 --turn Birdo Eggs into Rinkas
n.width = 32
n.height = 32
n.collidesBlockLeft = false
n.collidesBlockRight = false
n.collidesBlockUp = false
n.collidesBlockDown = false
      end
      end

EDIT : My laptop may get fixed soon, so I can test it later. :crazy: :)
Jayce777
Very skilled gamer
Very intelligent
e=2.71...
(5x+2)(5x-2)=25x^2
Plays Super Mario Maker Often
I support:
[spoiler][url=http://www.supermariobrosx.org/forums/viewtopic.php?f=34&t=3610&p=44996#p44996][img]http://i782.photobucket.com/albums/yy104/henryrichard1234/qLvulGW%201_zpshylsf0or.png[/img][/url][url=http://www.supermariobrosx.org/forums/viewtopic.php?f=31&t=11593][img]http://i1063.photobucket.com/albums/t520/Pwner523746/Graphics%20pack%20logo.png[/img][/url][url=http://www.supermariobrosx.org/forums/viewtopic.php?f=34&t=467&p=2740#p2740][img]http://s10.postimg.org/9dpghzcfd/support_banner.png[/img][/url][url=http://www.supermariobrosx.org/forums/viewtopic.php?f=34&t=13458][img]http://i.imgur.com/vidjJFM.png[/img][/url][/spoiler]

Sambo M
Count
Count
Avatar
Sambo M
Count
Count
Age: 20
Reputation: 13
Posts: 264
Joined: 27 Jun 2014

Post #4by Sambo » 22 Aug 2016, 21:20

This looks like it should work. You don't need to change the collision fields, though. Those fields are collision flags, meaning they would only be true if the NPC was colliding with a block. Setting them to false for one frame is really pointless. In fact, messing with the collision flags at all is pointless, since Rinkas don't interact with blocks anyway.

Dirty Rinka lover. :blum:
Image
Current Project:
Image

yoshiegg
Passerby
Passerby
yoshiegg
Passerby
Passerby
Reputation: 0
Posts: 3
Joined: 5 Jun 2017

Change Bomb to Boomerang (both player items)

Post #5by yoshiegg » 5 Jun 2017, 19:32

Hello Guys.
I want to have a boomerang suit for Mario, Luigi, Peach and Toad.
Toad's no problem as he throws boomerangs by default.Mario and Luigi aren't either as I've found some code for them that works fine.
But for Peach, I tried it with the same script, with the same script with the conditional if player.character == CHARACTER_PEACH then added and with the following code that fits this topic:

Code: Select all

if player.character == CHARACTER_PEACH then
           function onTick()
      for _, n in pairs(NPC.get(291, -1)) do --for all PlayerBombs in all sections
            n.id = 292 --turn PlayerBombs into boomerangs
n.height = 32
n.width = 32
end
end

So can anyone say me why it doesn't work or if player objects just can't be modified with that script (which is imo unlogic as they're NPCs like any other NPC.)
Btw, it didn't throw an error so the syntax is correct in my code even if the amount of ends issn't correct in this extract.

Yoshi021 M
Moderator
Moderator
Avatar
Yoshi021 M
Moderator
Moderator
Age: 17
Reputation: 81
Posts: 637
Joined: 15 Feb 2016
Location: Yoshi's Island

Post #6by Yoshi021 » 6 Jun 2017, 1:18

function onTick() must be outside the if statement like this:

Code: Select all

function onTick()
  if player.character == CHARACTER_PEACH then
    for _, n in pairs(NPC.get(291, -1)) do --for all PlayerBombs in all sections
      n.id = 292 --turn PlayerBombs into boomerangs
      n.height = 32
      n.width = 32
    end
  end
end
Links
ImageImageImage
Image
Image
"Going to University is FUN!" :pardon:

yoshiegg
Passerby
Passerby
yoshiegg
Passerby
Passerby
Reputation: 0
Posts: 3
Joined: 5 Jun 2017

Peach Boomerang code

Post #7by yoshiegg » 6 Jun 2017, 14:50

Thanks for your help but somehow Peach still throws bombs.
Could someone please help me out as I don't have the slightest idea of what the problem is.


Return to “LunaLua - Extension Framework”

Who is online (over the past 5 minutes)

Users browsing this forum: 1 guest