SRB2 Message Board  

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

Reply
 
Thread Tools Search this Thread
Old 06-19-2015   #1
Rumia1
worries too much
 
Rumia1's Avatar
Default Rumia's Lua Abominations

I have decided to make this thread for when I can't figure things out, probably because I did something stupid

First off I'm trying to edit the waiting animation's frame durations for a certain character, however it tells me that I'm trying to index a global variable "state" and I have no clue how to work fix that.

Here is my code:
Code:
addHook("ThinkFrame", do
	for player in players.iterate
		if player.mo.skin == "sonic"
			if player.mo.state == S_PLAY_TAP1
				state.tics = 1
			elseif player.mo.state == S_PLAY_TAP2
				state.tics = 3
				state.nextstate = S_PLAY_STAND
			end
		end
	end
end)
Also please tell me if I'm going about this in the wrong way, I'm just starting LUA and I feel as though I either know exactly what I'm doing or I don't know at all and I can't figure out why
__________________
Quote:
Originally Posted by Cirno
Egguman-senpai...

Last edited by Rumia1; 06-19-2015 at 10:36 AM.
Rumia1 is online now   Reply With Quote
Old 06-19-2015   #2
Zipper
Soulja boy I tell 'em
Judge
 
Zipper's Avatar
Default

Use player.mo.tics and player.mo.nextstate instead. Those variables belong to the player's mobj.

Also in its current state, you'll get stuck at S_PLAY_TAP2, since it'll constantly check itself and set its tics to 3, never advancing to the next state you made, S_PLAY_STND(NOT "STAND").

Code:
addHook("ThinkFrame", do
	for player in players.iterate
		if player.mo.skin == "sonic"
			if player.mo.state == S_PLAY_TAP1
				player.mo.tics = 1
			elseif player.mo.state == S_PLAY_TAP2
				if player.mo.tics > 3
					player.mo.tics = 3
				end
				player.mo.nextstate = S_PLAY_STND
			end
		end
	end
end)
I tried to do some minor modifications to help you, but something tells me this isn't what you want.

(also why not just use SOC to edit the state durations, it's easier)
__________________
Quote:
<MonsterIestyn> surely it's good ass though
Zipper is offline   Reply With Quote
Old 06-20-2015   #3
Rumia1
worries too much
 
Rumia1's Avatar
Default

I would use SOC to edit the durations but then you end up with EVERY character added using the same durrations, and I like my mods to be as compatible with everything else as possible.

And as you said, sticking on frame 2 isn't really what I want, but thank you for fixing the global variable issue. For now, I suppose I can just use SOC.
__________________
Quote:
Originally Posted by Cirno
Egguman-senpai...
Rumia1 is online now   Reply With Quote
Old 07-13-2015   #4
Rumia1
worries too much
 
Rumia1's Avatar
Default

RISE FROM THE GRAVE and such

I have a new challenge, is it possible to get if the player has analog mode enabled and is there a way to turn it on and off using LUA?

From what I've F3'd from the wiki, there is none but hopefully someone could prove me wrong.

EDIT: Also, is there any way to check if the player has just killed an enemy (excluding bosses)?
EDIT2: And one last thing, is there a way to give the player ring attraction without using an attraction shield?
__________________
Quote:
Originally Posted by Cirno
Egguman-senpai...

Last edited by Rumia1; 07-13-2015 at 06:41 AM.
Rumia1 is online now   Reply With Quote
Old 07-13-2015   #5
RedEnchilada
happy, pretty, lovely!
Developer
 
RedEnchilada's Avatar
Default

You can check analog mode by checking (mo.player.pflags & PF_ANALOGMODE), though for setting it it's probably a better idea to use COM_BufInsertText(mo.player, "analog 0/1").
__________________
Quote:
<@toaster> '"sonic robot explosion 2", the hot new sensation for teens looking for a good time, tempts many children away from god each year'
av src
RedEnchilada is offline   Reply With Quote
Old 07-28-2015   #6
Rumia1
worries too much
 
Rumia1's Avatar
Default

On a more practical note, how would you go about making a GFZ3 Eggman laser? Not just the single sausage that everything else fires, but like the smooth, actually laser-like laser that he shoots in 2.1.
__________________
Quote:
Originally Posted by Cirno
Egguman-senpai...
Rumia1 is online now   Reply With Quote
Old 07-28-2015   #7
"Lat'"
AAAAAAAAAAAAAAAAAAA
 
"Lat'"'s Avatar
Default

The Eggmobile uses A_Boss1Laser to do a laser trail and all.
There is no documentation yet on the action, but I think it will be executed every tic of the frame where it is used. (For instance the EggMobile calls this action for 45 tics to fire a continuous laser of 45 tics too.)

Hope that helped.
__________________
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 10-15-2015   #8
Rumia1
worries too much
 
Rumia1's Avatar
Default

I call this thread to rise once again!

This time I have no clue what I'm doing so I haven't the slightest idea what I'm even doing wrong

Code:
addHook("ThinkFrame", do
	for player in players.iterate
		if (player.mo and player.mo.skin == "sonic")
			if not player.mo.hovertimer
				player.mo.hovertimer = 2*TICRATE
			end
			if P_IsObjectOnGround(player.mo)
				player.mo.hovertimer = 2*TICRATE
				player.charability = CA_FLOAT
			end
			if player.mo.hovertimer == 0
				player.charability = CA_NONE
			end
			if  (player.pflags & PF_JUMPED)
			and (player.pflags & PF_JUMPDOWN)
				player.mo.hovertimer = $1 - 1*TICRATE
			end
		end 
	end
end)
I understand that this might be slightly easier to make work if I used AbilitySpecial, but again, I have no clue what I'm doing in the first place. The script is supposed to be a timed hover, making you fall after a short amount of time of using the ability.
__________________
Quote:
Originally Posted by Cirno
Egguman-senpai...
Rumia1 is online now   Reply With Quote
Old 10-15-2015   #9
742mph
I make Sonic look like me
 
742mph's Avatar
Default

"player.mo.hovertimer = $1 - 1*TICRATE"

This will subtract TICRATE from a timer that only has a maximum of 2*TICRATE every tic, meaning you'll only get 2 tics of hovering time. If you want the player to hover for 2 seconds, just subtract 1 from the timer every tic.
__________________
Quote:
<Evilgasm> the opposite of egoraptor is Toa Tahu
742mph is offline   Reply With Quote
Old 10-15-2015   #10
Rumia1
worries too much
 
Rumia1's Avatar
Default

That's pretty much what I wanted but I wanted it to allow the player to float for 2 seconds. However, this code doesn't seem to work at all, like, it still makes the player able to float for as long as they want, and something's telling me that something isn't triggering. Checking if the player had thokked didn't work and this isn't working either, so I'm curious what I'm doing wrong.
__________________
Quote:
Originally Posted by Cirno
Egguman-senpai...
Rumia1 is online now   Reply With Quote
Old 10-16-2015   #11
742mph
I make Sonic look like me
 
742mph's Avatar
Default

I think I've found another problem. "not player.mo.hovertimer" is true both if the hovertimer variable hasn't been initialized yet and if the variable is zero. That means whenever hovertimer runs out, the game resets it to 2*TICRATE before the player can lose the ability to hover. To fix this problem, try replacing "if not player.mo.hovertimer" with "if player.mo.hovertimer == nil".
__________________
Quote:
<Evilgasm> the opposite of egoraptor is Toa Tahu
742mph is offline   Reply With Quote
Old 10-16-2015   #12
Rumia1
worries too much
 
Rumia1's Avatar
Default

Alright, thank you for your help! I eventually found another problem with the script, I was checking if jump was pressed the last tic, making it so that even if you hadn't pressed jump after jumping, the timer would still tick down, making it nearly impossible to actually use the move, I fixed this by using if (player.pflags & PF_JUMPED) and (player.cmd.buttons & BT_JUMP) instead and it works now.
__________________
Quote:
Originally Posted by Cirno
Egguman-senpai...
Rumia1 is online now   Reply With Quote
Old 10-18-2015   #13
Rumia1
worries too much
 
Rumia1's Avatar
Default

Alright, I'm back again and this time I'm asking about something non-lua! This time I'm wondering how to animate MD2 models in misfit 3d since that's what the wiki reccomends for MD2 modeling (I suppose?) however no one's put up a guide for this sort of thing.

First things first I would like to know how to properly rig a model, I've tried in MilkShape and that went nowhere quickly (as most things have). Secondly I'd like to know what sort of rules there are in maybe naming frames and what order they go in, seeing as no one on the internet seems to have this information (or any information at all other than "MD2 is a file type from Quake II.")

Thank you in advance!
__________________
Quote:
Originally Posted by Cirno
Egguman-senpai...
Rumia1 is online now   Reply With Quote
Old 11-22-2015   #14
Rumia1
worries too much
 
Rumia1's Avatar
Default

Hello again!

I'm tryig to make a script that keeps certain non-vanilla characters from breaking while using some new animations, but now it's breaking the script without giving an error message.

here's the code i'm trying to use
Code:
addHook("ThinkFrame", do
	for player in players.iterate
		if player.mo
			if player.mo.state == S_PLAY_FALL1
			and not player.mo.skin == "amy"
			and not player.mo.skin == "jasper"
			and not player.mo.skin == "hinote"
			and not (player.pflags & PF_JUMPED)
			and not (player.pflags & PF_THOKKED)
				player.mo.state = S_PLAY_RUN1
			end
		end
	end
end)
__________________
Quote:
Originally Posted by Cirno
Egguman-senpai...
Rumia1 is online now   Reply With Quote
Old 11-22-2015   #15
742mph
I make Sonic look like me
 
742mph's Avatar
Default

I can't see any problems right off the bat, but to be safe, I would change what you've got to this:
Code:
addHook("ThinkFrame", do
     for player in players.iterate
         if (player.mo) and (player.mo.valid)
             if (player.mo.state == S_PLAY_FALL1)
             and not (player.mo.skin == "amy")
             and not (player.mo.skin == "jasper")
             and not (player.mo.skin == "hinote")
             and not (player.pflags & PF_JUMPED)
             and not (player.pflags & PF_THOKKED)
                 player.mo.state = S_PLAY_RUN1
             end
         end
     end
end)
I added "and (player.mo.valid)" so the script doesn't try to interact with any player objects that have previously been removed, and I sprinkled some extra parentheses around to make sure certain conditions are all evaluated exactly how they should be. Let me know how it works.
__________________
Quote:
<Evilgasm> the opposite of egoraptor is Toa Tahu
742mph is offline   Reply With Quote
Old 11-22-2015   #16
Rumia1
worries too much
 
Rumia1's Avatar
Default

It works perfectly now, thank you!
__________________
Quote:
Originally Posted by Cirno
Egguman-senpai...
Rumia1 is online now   Reply With Quote
Old 12-08-2015   #17
Rumia1
worries too much
 
Rumia1's Avatar
Default

I'm back once again with a new problem

Code:
addHook("ThinkFrame", do
	for player in players.iterate
		if (player.mo) and (player.mo.valid)
		and not (player.mo.skin == "marisa")
		and not (player.mo.skin == "alice")
		and not (player.mo.skin == "mario")
		and not (player.mo.skin == "luigi")
		and not (player.mo.skin == "modernsonic")
		and not (player.mo.skin == "sonicre")
		and not (player.mo.skin == "tailsre")
		and not (player.mo.skin == "knuxre")
				player.thrustfactor = 4 + (1/2)
				player.accelstart = 140
				player.acceleration = 40
				player.spinitem = 0
				player.revitem = 0
				player.mindash = 23 * FRACUNIT
					if (player.mo.skin == "sonic")
						player.charability = CA_NONE
					end
					if gamemap == 24
						player.normalspeed = 36 * FRACUNIT
					end
					if (player.powers[pw_super])
						if (player.mo.skin == "tails")
							player.actionspd = 130 * FRACUNIT
						elseif (player.mo.skin == "knuckles")
							player.actionspd = 40 * FRACUNIT
						end
				if gametype == GT_COOP
				and not gametype == GT_RACE
				and not gametype == GT_MATCH
				and notgametype == GT_TEAMMATCH
				and notgametype == GT_TAG
				and not gametype == GT_HIDEANDSEEK
				and not gametype == GT_CTF
					player.runspeed = 30 * FRACUNIT
					player.normalspeed = 36 * FRACUNIT
					player.maxdash = 50 * FRACUNIT
						if (player.powers[pw_super])
							player.normalspeed = 42 * FRACUNIT
							player.acceleration = 50
							player.thrustfactor = 6
						end
					end
				end
				if gametype == GT_RACE
				or gametype == GT_MATCH
				or gametype == GT_TEAMMATCH
				or gametype == GT_TAG
				or gametype == GT_HIDEANDSEEK
				or gametype == GT_CTF
				and not gametype == GT_COOP
					player.thrustfactor = 4 + (1/2)
					player.accelstart = 140
					player.acceleration = 40
					player.spinitem = 0
					player.revitem = 0
					player.mindash = 25 * FRACUNIT
							if (player.powers[pw_super])
								player.acceleration = 50
								player.thrustfactor = 6
							end
						if (player.mo.skin == "sonic")
							player.runspeed = 30 * FRACUNIT
							player.normalspeed = 40 * FRACUNIT
							player.maxdash = 60 * FRACUNIT
								if (player.powers[pw_super])
									player.normalspeed = 41 * FRACUNIT
								end
						else
							player.runspeed = 26 * FRACUNIT
							player.normalspeed = 30 * FRACUNIT
							player.maxdash = 55 * FRACUNIT
						end
					end
			if (player.mo.state == S_PLAY_FALL1)
             and not (player.mo.skin == "amy")
             and not (player.mo.skin == "hinote")
             and not (player.pflags & PF_JUMPED)
             and not (player.pflags & PF_THOKKED)
                 player.mo.state = S_PLAY_RUN1
            end
		end
	end
end)
For some odd reason, this isn't working properly in multiplayer. When I use this in co-op, it still uses the stats for every other gamemode
__________________
Quote:
Originally Posted by Cirno
Egguman-senpai...
Rumia1 is online now   Reply With Quote
Old 12-08-2015   #18
Monster Iestyn
Friendly Neighbour-Hood
Moderator
 
Monster Iestyn's Avatar
Default

It's because you have "notgametype" twice by mistake in part of your massive (and rather redundant) check for all the other gametypes. And by that I mean you omitted the space between "not" and "gametype" twice

Last edited by Monster Iestyn; 12-08-2015 at 02:58 PM.
Monster Iestyn is offline   Reply With Quote
Old 12-09-2015   #19
Rumia1
worries too much
 
Rumia1's Avatar
Default

Two posts in the same day, woo!

I'm curious about how I would go about implimenting falling damage, the way I've been going about it so far is when the character falls faster than 22 * FRACUNIT, they die, this is impractical but it works as a temporary solution. Does anyone have any ideas on how this could be made more like actual falling damage?
__________________
Quote:
Originally Posted by Cirno
Egguman-senpai...
Rumia1 is online now   Reply With Quote
Old 12-09-2015   #20
742mph
I make Sonic look like me
 
742mph's Avatar
Default

Quote:
Originally Posted by Rumia1 View Post
Two posts in the same day, woo!

I'm curious about how I would go about implimenting falling damage, the way I've been going about it so far is when the character falls faster than 22 * FRACUNIT, they die, this is impractical but it works as a temporary solution. Does anyone have any ideas on how this could be made more like actual falling damage?
You could hurt them with P_DamageMobj instead of killing them.
__________________
Quote:
<Evilgasm> the opposite of egoraptor is Toa Tahu
742mph 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:41 AM.


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