Code: Select all
local jumpCounter = 4;
function onLoop ()
if player:mem(0x146,FIELD_WORD) == 1 then
jumpCounter = 4;
end
end
function onKeyDown(keycode)
if keycode == KEY_JUMP and jumpCounter > 0 then
player.speedY = -10;
jumpCounter = jumpCounter - 1;
end
end
local upgradedHealth = false;
local bossHealth = 50;
local triggeredBoss2 = false;
function killNPC(npcID)
for k,v in pairs(NPC.get(npcID,-1)) do
v:kill()
end
end
function onLoopSection13()
for k,v in pairs(NPC.get(209,-1)) do
v:mem(0x148,FIELD_FLOAT,-20)
if v:mem(0x156,FIELD_WORD) == 1 then
bossHealth = bossHealth - 1;
Audio.clearSFXBuffer()
playSFX(39)
end
end
end
function onLoop()
if bossHealth <= 0 then
killNPC(209)
triggerEvent("The end")
bossHealth = 1;
end
end
color = {85,87}
function onLoad()
fire = -2
end
function onLoop()
fireball = findnpcs(282,player.section)
ludwig = findnpcs(280,player.section)
for g,h in pairs(ludwig) do
if h.speedY ~= 0 then
fire = -2
end
if h:mem(0x148,FIELD_FLOAT) >= 0 then
if h:mem(0x118,FIELD_DFLOAT) < 55 + h:mem(0x148,FIELD_FLOAT) * 4 then
h:mem(0x118,FIELD_DFLOAT,55 + h:mem(0x148,FIELD_FLOAT) * 4)
end
if h:mem(0x118,FIELD_DFLOAT) == 60 + h:mem(0x148,FIELD_FLOAT) * 4 and fire < (h:mem(0x148,FIELD_FLOAT) + 10) / 2.5 then
fire = fire + 1
h:mem(0x118,FIELD_DFLOAT,h:mem(0x118,FIELD_DFLOAT) - 5)
end
else
if h:mem(0x118,FIELD_DFLOAT) < 55 then
h:mem(0x118,FIELD_DFLOAT,55)
end
if h:mem(0x118,FIELD_DFLOAT) == 60 and fire < (h:mem(0x148,FIELD_FLOAT) + 10) / 2.5 then
fire = fire + 1
h:mem(0x118,FIELD_DFLOAT,h:mem(0x118,FIELD_DFLOAT) - 5)
end
end
if h:mem(0x100,FIELD_DFLOAT) < 10 then
h:mem(0x100,FIELD_DFLOAT,10)
end
end
for a,b in pairs(fireball) do
if b:mem(0x46,FIELD_WORD) ~= -1 then
rand = math.random(1,3)
if rand == 3 then
b:mem(0x46,FIELD_WORD,-1)
else
b:mem(0xE2,FIELD_WORD,color[rand])
end
end
end
end
function onLoad()
-- ....
Level.loadPlayerHitBoxes(5, 1, "link-1.ini")
Level.loadPlayerHitBoxes(5, 2, "link-2.ini")
Level.loadPlayerHitBoxes(5, 3, "link-3.ini")
Level.loadPlayerHitBoxes(5, 4, "link-4.ini")
Level.loadPlayerHitBoxes(5, 5, "link-5.ini")
Level.loadPlayerHitBoxes(5, 6, "link-6.ini")
Level.loadPlayerHitBoxes(5, 7, "link-7.ini")
-- ....
end
function onLoad()
if (player.powerup == PLAYER_SMALL) then
player.powerup = PLAYER_BIG;
end
end
function onEventDirect(eventObj, eventName)
if eventName == "The end" then
eventObj.cancelled = true
end
end
function onEventDirect(butt, calledEvent)
if (calledEvent == "Ignoritus1") then
Audio.playSFX("snd_vc_Ness_CliffCatch.wav");
end
if (calledEvent == "Ignoritus3") then
Audio.playSFX("snd_vc_Ness_Appeal01.wav");
end
if (calledEvent == "Fairy Talk 3") then
Audio.playSFX("snd_vc_Ness_DamageFly01.wav");
end
if (calledEvent == "Moving layer to dungeon") then
Audio.playSFX("snd_vc_Ness_DamageFly01.wav");
end
if (calledEvent == "Go to phase 3") then
Audio.playSFX("snd_se_common_hp_lastAttack.wav");
end
if (calledEvent == "Stop phase 3") then
Audio.playSFX("snd_se_common_hp_lastAttack.wav");
end
if (calledEvent == "Dark secret lava") then
Audio.playSFX("snd_vc_Ness_MissFoot02.wav");
end
if (calledEvent == "Death") then
Audio.playSFX("Dunked da Goose.ogg");
end
if (calledEvent == "Dark secret lava") then
Audio.MusicOpen("illuminati.ogg");
end
end
function onNPCKill (eventObj, killedNPC, killReason)
if killedNPC.id == (285) then
eventObj.cancelled = true
end
end
local starman = loadAPI("starman")
starman.koopaId = 177
function onLoad()
Defines.block_hit_link_rupeeID2 = 10
end
function onLoad()
Defines.block_hit_link_rupeeID1 = 10
end
function onLoad()
Defines.kill_drop_link_rupeeID2 = 10
end
function onLoad()
Defines.kill_drop_link_rupeeID1 = 10
end
function onLoad()
Defines.block_hit_link_rupeeID3 = 10
end
function onLoad()
Defines.kill_drop_link_rupeeID3 = 10
end
function onInputUpdate()
if(player.altJumpKeyPressing) then
player.altJumpKeyPressing = true;
end
if(player2)then
if(player2.altJumpKeyPressing) then
player2.altJumpKeyPressing = true;
end
end
end
--characters.lua
--v1.1.2
--Created by Horikawa Otane, 2015
local characters = {}
local playerCharacters = {}
playerCharacters[1] = "mario"
playerCharacters[2] = "luigi"
playerCharacters[3] = "peach"
playerCharacters[4] = "toad"
playerCharacters[5] = "link"
local intIds = {}
intIds["mario"] = 1
intIds["luigi"] = 2
intIds["peach"] = 3
intIds["toad"] = 4
intIds["link"] = 5
local playerCharacters = {"mario", "luigi", "peach", "toad", "link"}
local function resetCharacter(characterId, powerupId)
loadHitboxes(characterId, powerupId, Misc.resolveFile("character_defaults\\" .. playerCharacters[characterId] .. "-" .. tostring(powerupId) .. ".ini"))
end
local function loadAllHitBoxes()
for _, butts in pairs(playerCharacters) do
for i = 1, 7, 1 do
local theIniFile = Misc.resolveFile(butts .. "-" .. i .. ".ini")
if theIniFile ~= nil then
loadHitboxes(intIds[butts], i, theIniFile)
else
resetCharacter(intIds[butts], i)
end
end
end
end
function characters.onInitAPI()
loadAllHitBoxes()
end
local characters = loadSharedAPI("characters")
local colliders = loadSharedAPI("colliders")
local horikawaTools = loadSharedAPI("horikawaTools")
local pnpc = loadSharedAPI("pnpc")
local rng = loadSharedAPI("rng");
local vectr = loadSharedAPI("vectr")
local vision = loadSharedAPI("visioncone")
local snake = {}
local visioncones = {}
snake.visionSettings = {}
snake.EXCLAMATION = Graphics.loadImage(Misc.resolveFile("graphics\\new_characters\\snake\\" .. "exclaim.png"))
snake.HUD_CAMO = Graphics.loadImage(Misc.resolveFile("graphics\\new_characters\\snake\\" .. "camo.png"))
snake.HUD_POWER_ARMOUR = Graphics.loadImage(Misc.resolveFile("graphics\\new_characters\\snake\\" .. "power_armour.png"))
snake.HUD_POWER_C4 = Graphics.loadImage(Misc.resolveFile("graphics\\new_characters\\snake\\" .. "power_c4.png"))
snake.HUD_POWER_ATHLETIC = Graphics.loadImage(Misc.resolveFile("graphics\\new_characters\\snake\\" .. "power_athletic.png"))
snake.HUD_POWER_BOX = Graphics.loadImage(Misc.resolveFile("graphics\\new_characters\\snake\\" .. "power_box.png"))
snake.HUD_POWER_GRENADE = Graphics.loadImage(Misc.resolveFile("graphics\\new_characters\\snake\\" .. "power_grenade.png"))
snake.HUD_POWER_FREEZE = Graphics.loadImage(Misc.resolveFile("worlds\\Bald Toad's Peak\\" .. "pk_freeze.png"))
local exclamations = {}
local spawningsources = {}
snake.alertTimer = 0;
snake.alertCooldown = 600;
local c4;
local grenades = {};
local function contains(a,b)
if(type(a) == 'number') then return a == b; end
for _,v in ipairs(a) do
if(v == b) then
return true;
end
end
return false;
end
function onInitAPI()
registerEvent(snake, "onLoop", "onLoop", false)
registerEvent(snake, "onHUDDraw", "onHUDDraw", false)
registerEvent(snake, "onKeyDown", "onKeyDown", false)
registerEvent(snake, "onInputUpdate", "onInputUpdate", false)
registerEvent(snake, "onJump", "onJump", true)
registerEvent(snake, "onJumpEnd", "onJumpEnd", false)
if (player.isValid) then
end
end
if keycode == KEY_SPINJUMP and (player:mem(0xF0, FIELD_WORD) == 5) then
player:mem(0x50, FIELD_WORD, -1)
if player:mem(0x52, FIELD_WORD) > 7 then
player:mem(0x11C, FIELD_WORD, 9);
end
end
function onJump()
end
function onKeyDown(key)
if (player:mem(0xF0, FIELD_WORD) == 5) then
if(key == KEY_X and player:mem(0x114,FIELD_WORD) ~= 11 and player:mem(0x114,FIELD_WORD) ~= 10 and player:mem(0x40,FIELD_WORD)~= 3) then
if(player.powerup == PLAYER_FIREFLOWER) then
local yoffset = 0;
if(player:mem(0x12E,FIELD_WORD) == -1) then --player is crouching
yoffset = 8;
local n = pnpc.wrap(NPC.spawn(266,player.x+player.width/2,player.y+yoffset,player.section));
n.speedX = player:mem(0x106,FIELD_WORD)*7;
table.insert(grenades,n);
n.speedY = -2;
end
elseif(player.powerup == PLAYER_HAMMER) then
local yoffset = 0;
if(player:mem(0x12E,FIELD_WORD) == -1) then --player is crouching
yoffset = 8;
end
local n = pnpc.wrap(NPC.spawn(171,player.x+player.width/2,player.y+yoffset,player.section));
n.speedX = player:mem(0x106,FIELD_WORD)*7;
n.speedY = -2;
table.insert(grenades,n);
end
end
end
end
function onLoop()
Defines.player_link_shieldEnabled = false
Defines.player_link_fairyVineEnabled = false
player:mem(0x162, FIELD_WORD, 19)
player:mem(0x0E, FIELD_WORD, 1)
if player:mem(0x11C, FIELD_WORD) > 19 then
player:mem(0x11C, FIELD_WORD, 20);
end
if player.powerup ~= PLAYER_ICE then
player:mem(0x02, FIELD_WORD);
end
if player.powerup ~= PLAYER_LEAF and player:mem(0x11C, FIELD_WORD) > 29 then
player:mem(0x11C, FIELD_WORD, 30);
end
if player.powerup ~= PLAYER_LEAF and keycode == KEY_JUMP and player:mem(0x1A, FIELD_WORD) then
player:mem(0x18, FIELD_WORD);
player:mem(0x1C, FIELD_WORD, 4)
end
if player:mem(0x20, FIELD_FLOAT) > 8 then
player:mem(0x20, FIELD_FLOAT, 9);
end
for k,v in ipairs(NPC.get()) do
if(horikawaTools.npcList[v.id] and not v.friendly) then
local npc = pnpc.wrap(v);
if(visioncones[npc.uid] == nil) then
if (snake.visionSettings[npc.id] == nil) then
snake.visionSettings[npc.id] = {length = 256, angle = 30, height = 8};
end
if (snake.visionSettings[npc.id] ~= nil) then
visioncones[npc.uid] = {cone = vision.VisionCone(npc.x+ npc.width/2, npc.y+snake.visionSettings[npc.id].height, snake.visionSettings[npc.id].length * npc.direction * vectr.right2, snake.visionSettings[npc.id].angle), npc = npc};
end
end
end
end
end
function onHUDDraw()
if(player:mem(0xF0, FIELD_WORD) == 5) then
Graphics.drawImage(snake.HUD_CAMO, 748, 12);
local camo = tostring(math.ceil(1*(snake.alertCooldown-snake.alertTimer)/(snake.alertCooldown)));
Text.print(camo,1,782-#camo*18,36)
if(player:mem(0x16, FIELD_WORD) > 1 and player:mem(0x122, FIELD_WORD) ~= 1 and player:mem(0x122, FIELD_WORD) ~= 4) then
local power = {label = "", graphic = snake.HUD_POWER_ARMOUR}
if(player.powerup <= PLAYER_BIG) then
power.label = "";
power.graphic = snake.HUD_POWER_ARMOUR;
elseif(player.powerup == PLAYER_FIREFLOWER) then
power.label = "PK FIRE";
power.graphic = snake.HUD_POWER_C4;
elseif(player.powerup == PLAYER_LEAF) then
power.label = "LIGHT FEATHER";
power.graphic = snake.HUD_POWER_ATHLETIC;
elseif(player.powerup == PLAYER_TANOOKIE) then
power.label = "FLYING NW";
power.graphic = snake.HUD_POWER_BOX;
elseif(player.powerup == PLAYER_HAMMER) then
power.label = "ARCHERY";
power.graphic = snake.HUD_POWER_GRENADE;
elseif(player.powerup == PLAYER_ICE) then
power.label = "PK FREEZE";
power.graphic = snake.HUD_POWER_FREEZE;
end
Graphics.drawImage(power.graphic, 16, 16);
Text.print(power.label,12,12);
end
end
end