SRB2 Message Board  

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

Reply
 
Thread Tools Search this Thread
Old 3 Days Ago   #1
Pizza
 
Pizza's Avatar
Default Charging System Not working

Been trying to get this to work, what am i doing wrong
Code:
local kicharge 

addHook("ThinkFrame", function(player)
	for player in players.iterate do
		if player.mo.skin ~= "songoku" then
			continue
		end
		
		if not (player.cmd.buttons & BT_CUSTOM1) and kimeter == 118
		        kicharge = false
			kitimer = 0
                elseif kimeter < 118
		        kicharge = true
			kitimer = TICRATE*2
       end
   end
end)
Pizza is offline   Reply With Quote
Old 2 Days Ago   #2
Shapeshifter Boi
Call me Neon
 
Shapeshifter Boi's Avatar
Default

A lot of this syntax is hard for me to understand, but many errors are present, first of all flag tables like cmd.buttons, are a series of bits, if you want to check for the buttons being pressed you should use this;
Code:
if player.cmd.buttons == player.cmd.buttons | BT_JUMP then
I don't think ill ever wrap my head around putting functions inside the playerthink hook either, which is theoretically correct, but uses the wrong hook string, and if i've missed anything, you can check the wiki for everything, trust me.

---------- Post added at 10:14 PM ---------- Previous post was at 10:12 PM ----------

Oh yea kicharge is outside the playerthink hook and is a local, so it's effective accross all players, and the first instruction with ktimer is to check it for something that isn't nil
Shapeshifter Boi is offline   Reply With Quote
Old 2 Days Ago   #3
Pizza
 
Pizza's Avatar
Default

Thanks I'll get back to you if it works
Pizza is offline   Reply With Quote
Old 2 Days Ago   #4
Pizza
 
Pizza's Avatar
Default

Never mind it works now

Last edited by Pizza; 2 Days Ago at 01:50 AM.
Pizza 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 02:16 AM.


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