Page 2 of 2
Re: Boomerang
Posted: Fri Jun 09, 2017 10:53 am
by Gaming-Dojo
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.
Re: Boomerang
Posted: Fri Jun 09, 2017 12:33 pm
by Hoeloe
You can disable sounds by muting them using Audio.sounds[soundid].muted = true.
Re: Boomerang
Posted: Fri Jun 09, 2017 10:15 pm
by Gaming-Dojo
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.
Re: Boomerang
Posted: Sat Jun 10, 2017 6:27 am
by Hoeloe
There should be a file called sounds.ini which will map the filenames to the IDs.
Re: Boomerang
Posted: Sun Aug 13, 2017 9:31 am
by Gaming-Dojo
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