Boomerang

This is the place for discussion and support for LunaLua and related modifications and libraries.
Forum rules
Before you make a topic/post, consider the following:
-Is there a topic for this already?
-Is your post on topic/appropriate?
-Are you posting in the right forum/following the forum rules?
yoshiegg
Hoopster
Hoopster
Posts: 122
Joined: Mon Jan 25, 2016 9:20 am

Re: Boomerang

Postby yoshiegg » Fri Jun 09, 2017 10:53 am

My Api now works fine.NPC:transform even solved the section issue.The only thing I want to add now is that the sword sound shouldn't be played when you play Link.So I want to ask if I can use playSFX to overwrite it even though I think that won't work as I need to disable Links sword sound and which id Toad's boomerang sound has.If I need to disable the sword sound, I'd need soe help again as I didn't find an appropriate function while browsing some APIs in the default Scripts coming with 2.0.

Hoeloe
Foo
Foo
Posts: 1442
Joined: Sat Oct 03, 2015 6:18 pm
Flair: The Codehaus Girl
Pronouns: she/her

Re: Boomerang

Postby Hoeloe » Fri Jun 09, 2017 12:33 pm

You can disable sounds by muting them using Audio.sounds[soundid].muted = true.

yoshiegg
Hoopster
Hoopster
Posts: 122
Joined: Mon Jan 25, 2016 9:20 am

Re: Boomerang

Postby yoshiegg » Fri Jun 09, 2017 10:15 pm

Thanks.Now I just need the ids of sword and boomerang Sound or where to find them in my smbx folders as They are Named and not numbered in the Sounds folder.

Hoeloe
Foo
Foo
Posts: 1442
Joined: Sat Oct 03, 2015 6:18 pm
Flair: The Codehaus Girl
Pronouns: she/her

Re: Boomerang

Postby Hoeloe » Sat Jun 10, 2017 6:27 am

There should be a file called sounds.ini which will map the filenames to the IDs.

yoshiegg
Hoopster
Hoopster
Posts: 122
Joined: Mon Jan 25, 2016 9:20 am

Re: Boomerang

Postby yoshiegg » Sun Aug 13, 2017 9:31 am

Hello guys.
after I changed the function to npc:transform, my code doesn't produce an error when I load a level.However, when I try to throw a hammer/boomerang I get an error message saying: "attempt to load global "v" (a nil value) and I have no idea what produces this error so I need your help for a hopefully last time.And here's the code:

Code: Select all

local boomerang = {}

local BoomerangLock = 0
function boomerang.onInitAPI()
registerEvent(boomerang, "onTickEnd", "onTickEnd", false)
end
function boomerang.onTickEnd()
   if player.powerup == PLAYER_HAMMER then

         if BoomerangLock == 0 then
            if(player.runKeyPressing) then
               for k,v in pairs(NPC.get({170,266,291},-1)) do
                   v:transform(292)
                  if BoomerangLock == 0 then
                     if player:mem(0x106,FIELD_WORD) ~= -1 then
                        BoomerangLock = 1
                        v.x = v.x + 2
                        v.speedX = 25
                        v.speedY = -10
                     else
                        v.x = v.x - 2
                        v.speedX = -25
                        v.speedY = -10
                        BoomerangLock = 1
                     end
                  end
               end
            end
         else
            local BoomerangCheck = NPC.get(292,-1)
            if table.getn(BoomerangCheck) == 0 then
               BoomerangLock = 0
            else
               player:mem(0x160,FIELD_WORD,2)
            end
         end
      end
   end
   
return boomerang
Greetings, yoshiegg


Return to “LunaLua”

Who is online

Users browsing this forum: No registered users and 1 guest