SRB2 Message Board  

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

Reply
 
Thread Tools Search this Thread
Old 05-26-2015   #1
SSG3
Oh, THAT Youtuber...
 
SSG3's Avatar
Default custom "screw jump" doesn't scale correctly

I'm trying to make a "Screw Jump" for a custom character, but it doesn't scale correctly. how can I get it to scale to the player's current size?

Here's the code extract:
Code:
if not (P_IsObjectOnGround(player.mo))
			and (player.canscrew == 1)
			and (player.justscrewed == 0)
			and (player.cmd.buttons & BT_CUSTOM2)
			and not (player.spectator)
			and not (player.pflags & PF_NIGHTSMODE)
			and not (player.mo.tracer and player.mo.tracer.type == MT_TUBEWAYPOINT)
			and not (player.mo.state == S_PLAY_DIE) then
				if (player.mo.flags2 & MF2_OBJECTFLIP)
					player.mo.momz = -10*FRACUNIT
				else
					player.mo.momz = 10*FRACUNIT
				end
				S_StartSound(player.mo, sfx_jump)
				S_StartSound(player.mo, sfx_fre001)
				P_SpawnGhostMobj(player.mo)
				player.cansrew = 2
				player.justscrewed = 1
			end
__________________
Quote:
<Lat'> people thought moonjump and chaos control were OP
<Lat'> screw jump is the new meta

Last edited by SSG3; 05-26-2015 at 12:43 PM. Reason: Some Grammar stuff...
SSG3 is offline   Reply With Quote
Old 05-26-2015   #2
Monster Iestyn
Fangtastic
Administrator
 
Monster Iestyn's Avatar
Default

Replace the following code:

Code:
				if (player.mo.flags2 & MF2_OBJECTFLIP)
					player.mo.momz = -10*FRACUNIT
				else
					player.mo.momz = 10*FRACUNIT
				end
with this:

Code:
				P_SetObjectMomZ(player.mo, 10*FRACUNIT, false)
P_SetObjectMomZ is a special function that sets an object's momz for you, as well as automatically flipping it for reverse gravity and scaling it with the object's own scale.

For future reference purposes though, you COULD also have done this to scale your "Screw jump":

Code:
				if (player.mo.eflags & MFE_VERTICALFLIP)
					player.mo.momz = -FixedMul(10*FRACUNIT, player.mo.scale)
				else
					player.mo.momz = FixedMul(10*FRACUNIT, player.mo.scale)
				end
(I also note that you should check for MFE_VERTICALFLIP rather than MF2_OBJECTFLIP to determine whether an object is in reverse gravity. MFE_VERTICALFLIP controls flipping of physics and sprites, MF2_OBJECTFLIP merely forces flipped physics on but can be negated by other sources of reverse gravity)
__________________
My page stuffed full of MIDI goodness!
The Hitchhiker's Guide to the Robo-Hoodiverse
Timeline of Sonic Robo Blast History!

That's an uppercase i, not a lowercase L, for the record. Also, it's pronounced "Yes-tin".

Last edited by Monster Iestyn; 05-26-2015 at 12:56 PM.
Monster Iestyn is online now   Reply With Quote
Old 05-26-2015   #3
SSG3
Oh, THAT Youtuber...
 
SSG3's Avatar
Default

Thanks. it worked! Also, I'm just making my own version of a "Metroid Sonic (samus clone)" which has gone on over about a few months, maybe more. just a double jump with custom 2... might make it more "Screw" like when i can (similar to the one i saw on you youtube with the prologue thing on CB)

That was just if you was wondering, that's all. Again, thanks for the help!

EDIT:
Sorry for bothering you again (and this part is more off-topic) , but the death message doesn't print when i kill someone with a projectile. instead, it print the hit message. here's the code:
Code:
addHook("HurtMsg", function(player, inflictor, source)
	if not inflictor then
		return false
	else
		source = inflictor.target
	end
	if source and source.player then
		if player.health >= 0 then
			if inflictor.type == MT_JETTBULLET then
				print(source.player.name.."'s fired bullet hit "..player.name..".")
				return true
			elseif inflictor.type == MT_TORPEDO then
				print(source.player.name.."'s super torpedo hit "..player.name..".")
				return true
			end
		elseif player.health <= 0
			if inflictor.type == MT_JETTBULLET then
				print(source.player.name.."'s fired bullet killed "..player.name..".")
				return true
			elseif inflictor.type == MT_TORPEDO then
				print(source.player.name.."'s super torpedo killed "..player.name..".")
				return true
			end
		end
	end
	return false
end)
__________________
Quote:
<Lat'> people thought moonjump and chaos control were OP
<Lat'> screw jump is the new meta

Last edited by SSG3; 05-26-2015 at 05:37 PM. Reason: Hit and death messages
SSG3 is offline   Reply With Quote
Old 05-27-2015   #4
SSG3
Oh, THAT Youtuber...
 
SSG3's Avatar
Default

Sorry for the double post... just bumping this thread go get some attention to the last post
__________________
Quote:
<Lat'> people thought moonjump and chaos control were OP
<Lat'> screw jump is the new meta
SSG3 is offline   Reply With Quote
Old 05-27-2015   #5
fickleheart
ms reflec beat stan
 
fickleheart's Avatar
Default

IIRC the HurtMsg hook is run before the damage is actually applied. So what you wanna do to test for hurt vs killed is:

Code:
if damage >= 10000 or player.mo.health == 1 then
    -- Damage kills the player
else
    -- Merely a flesh wound!
end
__________________
Quote:
Originally Posted by Arf View Post
Stop trying to make slopes, guys.
fickleheart is offline   Reply With Quote
Old 05-30-2015   #6
SSG3
Oh, THAT Youtuber...
 
SSG3's Avatar
Default

I tried that method, and the console printed "attampt to compare argument with nil" on the line of "if damage >=1000 or player.mo.health == 1 then"... I think I've done it wrong... I replaced this:

Code:
if player.health >= 0 then
... with this:

Code:
if damage >=1000 or player.mo.health == 1 then
Am I supposed to do that?

And yeah... sorry for my noobishness. I'm just learning the code myself, so don't expect me to know what I'm doing. And what does IIRC stand for? I can't work it out myself.
__________________
Quote:
<Lat'> people thought moonjump and chaos control were OP
<Lat'> screw jump is the new meta

Last edited by SSG3; 05-30-2015 at 10:00 AM. Reason: Putting it into better words...
SSG3 is offline   Reply With Quote
Old 05-30-2015   #7
SSG3
Oh, THAT Youtuber...
 
SSG3's Avatar
Default

Sorry again for the double post... gotta bump this topic again...

Due to the "Spam", I've gotta add more content... so, I've made a typo with the screw jump...

Code:
... from first post, with the IF statements..

                        and (player.cmd.buttons & BT_CUSTOM2)
			and not (player.spectator)
			and not (player.pflags & PF_NIGHTSMODE)
			and not (player.mo.tracer and player.mo.tracer.type == MT_TUBEWAYPOINT)
			and not (player.mo.state == S_PLAY_DIE) then
				if (player.mo.flags2 & MF2_OBJECTFLIP)
					player.mo.momz = -10*FRACUNIT
				else
					player.mo.momz = 10*FRACUNIT
				end
				S_StartSound(player.mo, sfx_jump)
				S_StartSound(player.mo, sfx_fre001)
				P_SpawnGhostMobj(player.mo)
				player.cansrew = 2
				player.justscrewed = 1
I've now fixed that with player.canscrew = 2... That should adjust correctly now.

(SSG3 received an infraction for this post: Do not spam. Put actual content in your posts.)
__________________
Quote:
<Lat'> people thought moonjump and chaos control were OP
<Lat'> screw jump is the new meta

Last edited by SSG3; 05-30-2015 at 06:55 PM. Reason: Spam removal... gotta add more content.
SSG3 is offline   Reply With Quote
Old 06-03-2015   #8
SSG3
Oh, THAT Youtuber...
 
SSG3's Avatar
Default

sorry for posting once again... this time it's the momentum of the attack that players instantly get, as if they performed an air drill... but i'm not sure if the variable P_INSTATHRUST should be used:

Code:
if not (P_IsObjectOnGround(player.mo)) and (player.jumping)
			and (player.canscrew ~= 2)
			and (player.isscrewing ~= 2)
			and (player.screwjumps ~= 5)
			and (player.screwjumping)
			and not (player.spectator)
			and not (player.pflags & PF_NIGHTSMODE)
			and not (player.mo.tracer and player.mo.tracer.type == MT_TUBEWAYPOINT)
			and not (player.mo.state == S_PLAY_DIE) then
				if (player.mo.eflags & MFE_UNDERWATER)
					P_SetObjectMomZ(player.mo, 5*FRACUNIT, false)
				else
					P_SetObjectMomZ(player.mo, 10*FRACUNIT, false)
					end
				S_StartSound(player.mo, sfx_fre800)
				player.screwjumps = $1 + 1
				player.isscrewing = 1
				if player.screwjumps >= 5
					player.canscrew = 2
					player.isscrewing = 2
				end
				player.stillscrewing = true
			end
			
			if (player.stillscrewing == true)
				P_SpawnGhostMobj(player.mo)
			end
If P_INSTATHRUST has to be used and I want it to make the player, at whatever speed or momentum they've gained, go at 20 FASTS/H constantly, where should I place it at?
__________________
Quote:
<Lat'> people thought moonjump and chaos control were OP
<Lat'> screw jump is the new meta

Last edited by SSG3; 06-04-2015 at 08:18 PM. Reason: Typo Spotted
SSG3 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 10:09 AM.


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