Page 1 of 1
Topic Outdated. No longer needed.
Posted: Thu May 11, 2017 7:53 pm
by loop
This is outdated. My problem was solved.
Re: Make Thwomps spawn other NPCs?
Posted: Thu May 11, 2017 10:02 pm
by Quantumenace
The memory offsets? Are you trying to check the Thwomp's AI state? You can do that based on the NPC's
.ai fields (.ai1, .ai2)
Re: Make Thwomps spawn other NPCs?
Posted: Thu May 11, 2017 10:04 pm
by loop
Uh, yeah.
eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
I just need to know HOW to do it.
Re: Make Thwomps spawn other NPCs?
Posted: Thu May 11, 2017 10:32 pm
by Quantumenace
if v.ai1 == 2 and v.ai2 == 0 then...
(if that doesn't work try v.ai2 == 1 instead)
Re: Make Thwomps spawn other NPCs?
Posted: Thu May 11, 2017 11:44 pm
by loop
How do i get it to check for the Thwomp's AI? How do I spawn NPCs with LunaLua?
Re: Make Thwomps spawn other NPCs?
Posted: Fri May 12, 2017 12:07 am
by Quantumenace
Jayce 777 wrote:How do i get it to check for the Thwomp's AI? How do I spawn NPCs with LunaLua?
1) I just told you. The NPC's ai values can be accessed with .ai1, .ai2 etc. This checks if its ai1 is 2, meaning it's down and waiting to go back up, and its ai2 is 0, meaning it just hit the ground.
2)
NPC.spawn(int npcId, number x, number y, int sectionNumber)
Re: Make Thwomps spawn other NPCs?
Posted: Fri May 12, 2017 7:18 am
by loop
Oh. I'll try after school.
Re: Make Thwomps spawn other NPCs?
Posted: Fri May 12, 2017 5:32 pm
by loop
Nope, ain't working because I can't set a simple variable for some reason.
Re: Make Thwomps spawn other NPCs?
Posted: Fri May 12, 2017 8:41 pm
by Quantumenace
Jayce 777 wrote:Nope, ain't working because I can't set a simple variable for some reason.
What do you have written? I can't help you without seeing what you're trying to do.
Re: Make Thwomps spawn other NPCs?
Posted: Fri May 12, 2017 10:04 pm
by loop
That is outdated. I got a new error when trying to use NPC.spawn.
Code: Select all
function onTick()
for _,v in pairs(NPC.get(180,-1)) do
if v.ai1 == 0
then v.ai1 = 1
end
end
for _,v in pairs(NPC.get(180,-1)) do
if v.ai1 == 2
then NPC.spawn(210, lx, ly, player.section, false, true)
end
end
end
WTF?
Re: Make Thwomps spawn other NPCs?
Posted: Fri May 12, 2017 10:34 pm
by Quantumenace
"No matching overload" means your arguments have incorrect types. Unless you defined "lx" and "ly" elsewhere they will be nil, and you can't give that as coordinates here.
Re: Make Thwomps spawn other NPCs?
Posted: Fri May 12, 2017 11:11 pm
by loop
How would I define the Thwomps' coordinates?
Re: Make Thwomps spawn other NPCs?
Posted: Fri May 12, 2017 11:38 pm
by Quantumenace
You can get their coordinates with v.x and v.y. This will be the top-left corner of the NPC. If you want, say, the center of the bottom edge, use:
lx = v.x+0.5*v.width
ly = v.y+v.height