SRB2 Message Board  

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

Reply
 
Thread Tools Search this Thread
Old 10-13-2017   #1
Simon_T
Pyro the Hedgehog
 
Simon_T's Avatar
Default Problem with Lua scripting

I'm trying to make an Whirlwind Shield-like second ability for an Super Tails character WAD (it's a private project), but I don't know how to use the P_DoJumpShield function (idk what is "player_t")

This is my example code, what I'm doing wrong? :'V

Code:
addHook("ThinkFrame", do
	for player in players.iterate
		if player.mo and player.mo.skin == "testchar"
			if player.cmd.buttons & BT_USE
			and (player.pflags & PF_JUMPED)
			and not player.exiting
				P_DoJumpShield(player.mo)
			end
		end
	end
end)
__________________
O kurwa!
Simon_T is offline   Reply With Quote
Old 10-13-2017   #2
Monster Iestyn
Friendly Neighbour-Hood
Moderator
 
Monster Iestyn's Avatar
Default

You probably want to use "player" instead of "player.mo" in the P_DoJumpShield function, as the former is player_t and the latter is mobj_t.

If you want an explanation of why you do the above, player_t and mobj_t etc just refer to the types of userdata you're dealing with. Because your "player" variable comes from the "for player in players.iterate" line, that means "player" is assigned a player_t userdata value, which means it represents data for a player. "player.mo" meanwhile gets the player's corresponding Object, which has the mobj_t userdata type (mobj = map object).

Some day I need to sort out making a tutorial to clear up this kind of confusion once and for all, bleh. x_x
__________________
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.

Last edited by Monster Iestyn; 10-13-2017 at 08:09 PM.
Monster Iestyn is offline   Reply With Quote
Old 10-13-2017   #3
Simon_T
Pyro the Hedgehog
 
Simon_T's Avatar
Default

Thanks, it's working now :)
__________________
O kurwa!
Simon_T 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 12:12 PM.


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