local pnpc = API.load("pnpc"); --load the pnpc library
function onTick() --event run every tick (a measure of time)
for _, v in pairs(NPC.get(267)) do --iterate over all Larry Koopas
local larry = pnpc.wrap(v); --give each NPC its own wrapper
if larry.data.downward == nil then --if there is no data named "downward" in the NPCs data table
larry.data.downward = false; --set it to false
end
if v.speedX > 0 then --if the NPC is moving down
larry.data.downward = true; --set the data table variable "downward" to true
end
if (larry.data.downward) and (v.collidesBlockBottom) then --if the data table variable "downward" is true and the NPC is colliding with a block from the bottom
Defines.earthquake = 6; --set an earthquake factor of 6 (you can definitely change this)
larry.data.downward = false; --since the NPC is obviously no longer moving down this can be set to false
end
end
end
Hit "Select All" and copy it to a lunadll.lua file. Haven't tested it since I'm on my phone but it should work
local pnpc = API.load("pnpc"); --load the pnpc library
function onTick() --event run every tick (a measure of time)
for _, v in pairs(NPC.get(267)) do --iterate over all Larry Koopas
local larry = pnpc.wrap(v); --give each NPC its own wrapper
if larry.data.downward == nil then --if there is no data named "downward" in the NPCs data table
larry.data.downward = false; --set it to false
end
if v.speedX > 0 then --if the NPC is moving down
larry.data.downward = true; --set the data table variable "downward" to true
end
if (larry.data.downward) and (v.collidesBlockBottom) then --if the data table variable "downward" is true and the NPC is colliding with a block from the bottom
Defines.earthquake = 6; --set an earthquake factor of 6 (you can definitely change this)
larry.data.downward = false; --since the NPC is obviously no longer moving down this can be set to false
end
end
end
Hit "Select All" and copy it to a lunadll.lua file. Haven't tested it since I'm on my phone but it should work
Would Defines.player_runspeed = 0 and Defines.player_walkspeed=0 Prevent the player from moving when the Eathquake happens and how do I do this when it happens and when the player is on the floor when it happens?
Last edited by ElectriKong on Sat May 06, 2017 7:58 am, edited 1 time in total.
King of Eterity wrote:Would Defines.player_runspeed = 0 and Defines.player_walkspeed=0 Prevent the player from moving when the Eathquake happens and how do I do this when it happens and when the player is on the floor when it happens?
local pnpc = API.load("pnpc") --load the pnpc library
local inputs2 = API.load("inputs2") --load the inputs2 library
local stun = 0 --initialize a variable for the stun timer, local to this file, and start with it at 0
function onTick() --event run every tick (a measure of time)
for _, v in pairs(NPC.get(267)) do --iterate over all Larry Koopas
local larry = pnpc.wrap(v) --give each NPC its own wrapper
if larry.data.downward == nil then --if there is no data named "downward" in the NPCs data table
larry.data.downward = false --set it to false
end
if v.speedY > 0 then --if the NPC is moving down
larry.data.downward = true --set the data table variable "downward" to true
end
if (larry.data.downward) and (v.collidesBlockBottom) then --if the data table variable "downward" is true and the NPC is colliding with a block from the bottom
Defines.earthquake = 8 --set an earthquake factor of 8 (you can definitely change this)
larry.data.downward = false --since the NPC is obviously no longer moving down this can be set to false
if player:isGroundTouching() then --if the player is touching the ground
stun = 30 --set the stun timer to 30 ticks, this is ~0.5 seconds (you can definitely change this)
player.speedX = 0 --stop the player in their tracks
end
end
if stun > 0 then --if the stun timer is still going
stun = stun - 1 --tick the stun timer down by 1
inputs2.locked[1].all = true --use inputs2 to lock all of player 1's inputs
else --otherwise (if the stun timer ISN'T still going)
inputs2.locked[1].all = false --use inputs2 to unlock all of player 1's inputs
end
end
end