SRB2 Message Board  

Go Back   SRB2 Message Board > Sonic Robo Blast 2 > Editing > Editing Help

Reply
 
Thread Tools Search this Thread
Old 12-09-2015   #21
Rumia1
worries too much
 
Rumia1's Avatar
Default

That's what I've been doing, but the problem is the thing I'm working on relies on the fact that you only have 1 HP, also I want the character to die when they hit the ground too hard or something like that, is that even possible with lua though?
__________________
Quote:
Originally Posted by Cirno
Egguman-senpai...
Rumia1 is offline   Reply With Quote
Old 12-09-2015   #22
742mph
I make Sonic look like me
 
742mph's Avatar
Default

Quote:
Originally Posted by Rumia1 View Post
That's what I've been doing, but the problem is the thing I'm working on relies on the fact that you only have 1 HP, also I want the character to die when they hit the ground too hard or something like that, is that even possible with lua though?
Well, if the character has only 1 HP, then how can they take any falling damage without dying? As for damaging them when they actually hit the ground rather than when they accelerate past a certain speed, you could store variables in the player mobj - let's call them mo.lastonground and mo.lastmomz - that record P_IsObjectOnGround(mo) and mo.momz and update themselves only at the end of your hook, so they're effectively copies of those values from one tic ago. Then, you could check if P_IsObjectOnGround(mo) is true this tic, mo.lastonground is false (so the player was in the air last tic), and mo.lastmomz is a large negative number, and if they are, damage the player.
__________________
Quote:
<Evilgasm> the opposite of egoraptor is Toa Tahu
742mph is offline   Reply With Quote
Old 12-09-2015   #23
"Lat'"
AAAAAAAAAAAAAAAAAAA
 
"Lat'"'s Avatar
Default

I think you can also use MFE_JUSTHITFLOOR as eflag (it does... its name, it's only present when the object just hit the floor and gets removed next tic); and do what 742mph said about mo.lastmomz.
__________________
Quote:
Originally Posted by Bronydude2k5 View Post
If you make me a Sash Lilac wad, I'll make you a sonic sprite hack of any choice.
"Lat'" is offline   Reply With Quote
Old 12-09-2015   #24
Rumia1
worries too much
 
Rumia1's Avatar
Default

Quote:
Originally Posted by 742mph View Post
Well, if the character has only 1 HP, then how can they take any falling damage without dying?
Spoiler:
What if I told you that that was the whole point? *Insert evil laugh here*



Also it works flawlessly, thank you both!
__________________
Quote:
Originally Posted by Cirno
Egguman-senpai...

Last edited by Rumia1; 12-09-2015 at 03:00 PM.
Rumia1 is offline   Reply With Quote
Old 02-22-2016   #25
Rumia1
worries too much
 
Rumia1's Avatar
Default

With the advent of Zone Builder, I am now able to create maps! Seeing as I have no experience with mapping (Though I am slowly learning how things work), I require assistance with lua in mapping.

How would I go about making something that triggers the level to end if your health is below a certain amount?
__________________
Quote:
Originally Posted by Cirno
Egguman-senpai...
Rumia1 is offline   Reply With Quote
Old 02-22-2016   #26
"Lat'"
AAAAAAAAAAAAAAAAAAA
 
"Lat'"'s Avatar
Default

Use G_ExitLevel().

You might find this page useful, too.
https://wiki.srb2.org/wiki/Lua/Functions
__________________
Quote:
Originally Posted by Bronydude2k5 View Post
If you make me a Sash Lilac wad, I'll make you a sonic sprite hack of any choice.
"Lat'" is offline   Reply With Quote
Old 04-04-2016   #27
Rumia1
worries too much
 
Rumia1's Avatar
Default

I'm back and with yet more questions, yaaaaay!

Is there a way to turn off water skimming while spinning into water, and if so, how?

and secondly, is there a way to turn off super flight as Sonic? I have a feeling that turning off the SF_SUPER flag would be involved.
__________________
Quote:
Originally Posted by Cirno
Egguman-senpai...
Rumia1 is offline   Reply With Quote
Old 04-05-2016   #28
Wolfy
Lumberjack Yandere
Developer
 
Wolfy's Avatar
Default

For the first question, to my knowledge there is no way to do this, save for recoding spindash in Lua completely.

For the second, you could try to use the JumpSpinSpecial hook to overwrite that ability when super. Not sure if it'll work, but worth a shot.
__________________
Quote:
[23:56:36] <SM-MaxX> prisma illya is a gift to this impure earth and a shining beacon for all anime
Wolfy is offline   Reply With Quote
Old 04-05-2016   #29
Monster Iestyn
Friendly Neighbour-Hood
Moderator
 
Monster Iestyn's Avatar
Default

Quote:
Originally Posted by Wolfy View Post
For the second, you could try to use the JumpSpinSpecial hook to overwrite that ability when super. Not sure if it'll work, but worth a shot.
It won't. JumpSpinSpecial won't overwrite it because it's in the wrong part of the source code for that to be possible.
Monster Iestyn is offline   Reply With Quote
Old 05-01-2016   #30
Rumia1
worries too much
 
Rumia1's Avatar
Default

So I'm trying to make a script that allows the player to fire the boss laser with A_Boss1Laser. However, every time I run the code here:
Code:
addHook("ThinkFrame", do
	for player in players.iterate
		if player.mo.skin ==  "sonic"
			player.ability2 = CA2_NONE
			if (player.cmd.buttons & BT_USE)
				"A_Boss1Laser(MT_LASER)"
			end
		end
	end
end)
it comes up with WARNING: lasertest.lua:6: attempt to call a number value
Hook removed.

clearly this script has no numbers in it, except MT_LASER which has a thing number but MT_LASER is supposed to substitute for that.

If I remove the quotes around A_Boss1Laser, it ends up spitting out the same error and depending on which version of the script I use when trying to impliment it into the megamari level lua code (from S_Quickman2 edited by me to specifically use this), it either breaks EVERY mobj in the game as soon as I try using the key (when using no quotes), or it gives the same error as before when using it (when using quotes).
__________________
Quote:
Originally Posted by Cirno
Egguman-senpai...
Rumia1 is offline   Reply With Quote
Old 05-01-2016   #31
Zwip-Zwap Zapony
Please just call me Zappy.
 
Zwip-Zwap Zapony's Avatar
Default

Quote:
Originally Posted by Rumia1 View Post
clearly this script has no numbers in it, except MT_LASER
Exactly. MT_LASER is just a simple number. You should replace MT_LASER with the player's object, so it should look something like this:
Code:
addHook("MobjThinker", function(playermobj)
    local player = playermobj.player
    if playermobj.skin == "sonic"
        player.ability2 = CA2_NONE
        if player.cmd.buttons & BT_USE
            A_Boss1Laser(playermobj)
        end
    end
end, MT_PLAYER)
Untested, but I don't see why it shouldn't work. Though if you only plan on doing something for when holding spin, you might want to try out the SpinSpecial hook instead.
Edit: Also, looking at the source code for A_Boss1Laser, make sure to set the player's object's "target" variable to an object first, otherwise it won't do anything.

Last edited by Zwip-Zwap Zapony; 05-01-2016 at 12:53 PM.
Zwip-Zwap Zapony is offline   Reply With Quote
Old 05-03-2016   #32
Monster Iestyn
Friendly Neighbour-Hood
Moderator
 
Monster Iestyn's Avatar
Default

Heh, I thought people had stopped using MT_ constants as mobj_t arguments ages ago...

From the wiki description for mobj_t:

"This is not to be confused with an Object type (e.g. MT_PLAYER) – these are just constants representing Object type numbers, and will not be accepted in functions requiring mobj_t variables (e.g. P_SpawnGhostMobj(MT_PLAYER) will cause Lua to give an error)."

Also, why are you trying to put quotes around A_Boss1Laser and everything you put in it anyway? If you're thinking of THIS bug report, the quotes fix I mentioned there only applies to assigning an action to a state, which accepts strings and can then convert them to the actual action functions themselves. It doesn't work for calling A_Boss1Laser on its own, because then it suddenly stops being an action and now you're just trying to call a string with the contents "A_Boss1Laser"! (or rather, you made a string with the contents "A_Boss1Laser(MT_LASER)" which means it does absolutely nothing even without the wrong type argument problem =V)

Either way, you're kind of stumped, A_Boss1Laser was just not meant to be used as a standalone thing anyway, it's meant to be a state's action in the first place.

Last edited by Monster Iestyn; 05-03-2016 at 09:38 AM.
Monster Iestyn is offline   Reply With Quote
Old 05-04-2016   #33
Rumia1
worries too much
 
Rumia1's Avatar
Default

Alright, this clears a lot of things that I was confused about up, thank you.
__________________
Quote:
Originally Posted by Cirno
Egguman-senpai...
Rumia1 is offline   Reply With Quote
Old 09-17-2016   #34
Rumia1
worries too much
 
Rumia1's Avatar
Default

Hello again! I'm having trouble with SLADE, I'm using version 3.1.1.3 and I just upgraded to Windows 10 not too long ago. When I installed the latest version, I started getting asked every time where the main iWAD would be located and also asking where to store temp files. I can not find a single bit of information inside the editor's preferences, settings, or otherwise on how to fix this. Does anybody know of a solution?
__________________
Quote:
Originally Posted by Cirno
Egguman-senpai...
Rumia1 is offline   Reply With Quote
Old 09-17-2016   #35
Zwip-Zwap Zapony
Please just call me Zappy.
 
Zwip-Zwap Zapony's Avatar
Default

I think the IWAD for SRB2 is srb2.srb, and simply just tell it where to store temporary files when it asks for it. (Like a "temp" folder inside Slade's installation directory, perhaps. Be warned that it deletes all files in the folder when cleaning up temporary files or something like that, so I'd advice making a new "temp" folder just for Slade.)
Zwip-Zwap Zapony is offline   Reply With Quote
Old 09-17-2016   #36
Rumia1
worries too much
 
Rumia1's Avatar
Default

I've done this, the thing is, it asks for it any time I reopen the program no matter how many times I direct it.
__________________
Quote:
Originally Posted by Cirno
Egguman-senpai...
Rumia1 is offline   Reply With Quote
Old 09-17-2016   #37
Zwip-Zwap Zapony
Please just call me Zappy.
 
Zwip-Zwap Zapony's Avatar
Default

Then it might be time to un-install and re-install it (whether it be from the installer or the 7z archive, preferably try both if the one you try first doesn't work). If that doesn't fix it either, perhaps try installing an older version.
Zwip-Zwap Zapony is offline   Reply With Quote
Old 09-17-2016   #38
Rumia1
worries too much
 
Rumia1's Avatar
Default

Okay so for some reason, there was a file named "portable" in the installation folder and after deleting the file, SLADE stopped asking for first-time setup details every time it was opened, I have no clue why that was there but ok.
__________________
Quote:
Originally Posted by Cirno
Egguman-senpai...
Rumia1 is offline   Reply With Quote
Old 01-29-2017   #39
Rumia1
worries too much
 
Rumia1's Avatar
Default

How do I properly call the type of level userdata in lua?
__________________
Quote:
Originally Posted by Cirno
Egguman-senpai...
Rumia1 is offline   Reply With Quote
Old 01-29-2017   #40
Zipper
Soulja boy I tell 'em
Judge
 
Zipper's Avatar
Default

mapheaderinfo[gamemap].typeoflevel, I think?
__________________
Quote:
<MonsterIestyn> surely it's good ass though
Zipper is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 06:46 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2017, vBulletin Solutions, Inc.