SRB2 Message Board  

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

Reply
 
Thread Tools Search this Thread
Old 08-25-2014   #1
"Lat'"
Stop it
 
"Lat'"'s Avatar
Default Lat's Lua catastrophes...

I am soooo pro in Lua, I got a 11/10 of IGN :O

Anyways, I am currently editing my Buffgauge for reasons that you may know if you spent 2 seconds of watching the last image but meh, I cannot get it work properly.

The Hud Drawing functions works properly, but the problem is actually the buffes themselves. The buffes do not affect the player stats. I firstly thought that this was because of repeating some "addHook" thingies, so I put them in separates lumps but meh.

Here are the codes, for each level...

Lvl 1
Code:
addHook("ThinkFrame", do
	for player in players.iterate
		if not player.mo continue end
		if stplyr.mo.health >= 16
		and stplyr.mo.health < 31
		
			local pa = player.charability
			if pa == CA_THOK
			or pa == CA_HOMINGTHOK
			or pa == CA_JUMPBOOST
			or pa == CA_AIRDRILL
			or pa == CA_FALLSWITCH
			and not stplyr.powers [pw_super]
				player.acceleration = 43
				player.accelstart = 103
			elseif pa == CA_FLY
			or pa == CA_SWIM
			or pa == CA_SLOWFALL
			or pa == CA_FLOAT
			or pa == CA_DOUBLEJUMP
			or pa == CA_TELEKINESIS
			or pa == CA_NONE
			and not stplyr.powers [pw_super]
				player.jumpfactor = 78643
			elseif pa == CA_GLIDEANDCLIMB
			and not stplyr.powers [pw_super]
				player.actionspd = 32 * FRACUNIT
			end
		else
			local pa = player.charability
			if pa == CA_THOK
			or pa == CA_HOMINGTHOK
			or pa == CA_JUMPBOOST
			or pa == CA_AIRDRILL
				player.normalspeed = skins[player.mo.skin].normalspeed
				player.acceleration = skins[player.mo.skin].acceleration
				player.accelstart = skins[player.mo.skin].accelstart
			elseif pa == CA_FLY
			or pa == CA_SWIM
			or pa == CA_SLOWFALL
			or pa == CA_FLOAT
			or pa == CA_DOUBLEJUMP
			or pa == CA_TELEKINESIS
				player.jumpfactor = skins[player.mo.skin].jumpfactor
				player.acceleration = skins[player.mo.skin].acceleration
				player.accelstart = skins[player.mo.skin].accelstart
			elseif pa == CA_GLIDEANDCLIMB
				player.actionspd = skins[player.mo.skin].actionspd
				player.normalspeed = skins[player.mo.skin].normalspeed
			end	
		end
	end
end)
Lvl2
Code:
addHook("ThinkFrame", do
	for player in players.iterate
		if not player.mo continue end
		
		if stplyr.mo.health >= 31
		and stplyr.mo.health < 61
			local pa = player.charability
			if pa == CA_THOK
			or pa == CA_HOMINGTHOK
			or pa == CA_JUMPBOOST
			or pa == CA_AIRDRILL
			or pa == CA_FALLSWITCH
			and not stplyr.powers [pw_super]
				player.normalspeed = 42 * FRACUNIT
				player.acceleration = 43
				player.accelstart = 103
			elseif pa == CA_FLY
			or pa == CA_SWIM
			or pa == CA_SLOWFALL
			or pa == CA_FLOAT
			or pa == CA_DOUBLEJUMP
			or pa == CA_TELEKINESIS
			or pa == CA_NONE
			and not stplyr.powers [pw_super]
				player.jumpfactor = 72643
				player.acceleration = 55
				player.accelstart = 210
			elseif pa == CA_GLIDEANDCLIMB
			and not stplyr.powers [pw_super]
				player.actionspd = 32 * FRACUNIT
				player.normalspeed = 40 * FRACUNIT
			end
		else
			local pa = player.charability
			if pa == CA_THOK
			or pa == CA_HOMINGTHOK
			or pa == CA_JUMPBOOST
			or pa == CA_AIRDRILL
				player.normalspeed = skins[player.mo.skin].normalspeed
				player.acceleration = skins[player.mo.skin].acceleration
				player.accelstart = skins[player.mo.skin].accelstart
			elseif pa == CA_FLY
			or pa == CA_SWIM
			or pa == CA_SLOWFALL
			or pa == CA_FLOAT
			or pa == CA_DOUBLEJUMP
			or pa == CA_TELEKINESIS
				player.jumpfactor = skins[player.mo.skin].jumpfactor
				player.acceleration = skins[player.mo.skin].acceleration
				player.accelstart = skins[player.mo.skin].accelstart
			elseif pa == CA_GLIDEANDCLIMB
				player.actionspd = skins[player.mo.skin].actionspd
				player.normalspeed = skins[player.mo.skin].normalspeed
			end
		end
	end
end)
LVL 3
Code:
addHook("ThinkFrame", do
	for player in players.iterate
		if not player.mo continue end

		if stplyr.mo.health >= 61		
			local pa = player.charability
			if pa == CA_THOK
			or pa == CA_HOMINGTHOK
			or pa == CA_JUMPBOOST
			or pa == CA_AIRDRILL
			or pa == CA_FALLSWITCH
			and not stplyr.powers [pw_super]
				player.normalspeed = 46 * FRACUNIT
				player.acceleration = 43
				player.accelstart = 103
			elseif pa == CA_FLY
			or pa == CA_SWIM
			or pa == CA_SLOWFALL
			or pa == CA_FLOAT
			or pa == CA_DOUBLEJUMP
			or pa == CA_TELEKINESIS
			or pa == CA_NONE
			and not stplyr.powers [pw_super]
				player.jumpfactor = 78643
				player.acceleration = 55
				player.accelstart = 210
			elseif pa == CA_GLIDEANDCLIMB
			and not stplyr.powers [pw_super]
				player.actionspd = 37 * FRACUNIT
				player.normalspeed = 40 * FRACUNIT
			end
		else
			local pa = player.charability
			if pa == CA_THOK
			or pa == CA_HOMINGTHOK
			or pa == CA_JUMPBOOST
			or pa == CA_AIRDRILL
				player.normalspeed = skins[player.mo.skin].normalspeed
				player.acceleration = skins[player.mo.skin].acceleration
				player.accelstart = skins[player.mo.skin].accelstart
			elseif pa == CA_FLY
			or pa == CA_SWIM
			or pa == CA_SLOWFALL
			or pa == CA_FLOAT
			or pa == CA_DOUBLEJUMP
			or pa == CA_TELEKINESIS
				player.jumpfactor = skins[player.mo.skin].jumpfactor
				player.acceleration = skins[player.mo.skin].acceleration
				player.accelstart = skins[player.mo.skin].accelstart
			elseif pa == CA_GLIDEANDCLIMB
				player.actionspd = skins[player.mo.skin].actionspd
				player.normalspeed = skins[player.mo.skin].normalspeed
			end
		end
	end
end)
They are basically edits of each others.
Also note that the script worked properly when there was only one level set up
And again, sorry if I made a stupid misstake, but we learn from our fail...

(I will keep this thread for my other Lua cataclysms...
__________________
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 08-26-2014   #2
Wolfy
wolfs
Developer
 
Wolfy's Avatar
Default

stplyr isn't defined in a single one of those code blocks. Swap it for player and it should fix most of the issues you're running into.
__________________
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
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 03:23 PM.


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