SRB2 Message Board  

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

Reply
 
Thread Tools Search this Thread
Old 01-29-2017   #41
Rumia1
worries too much
 
Rumia1's Avatar
Default

It works!


... except I need the current level
__________________
Quote:
Originally Posted by Cirno
Egguman-senpai...
Rumia1 is offline   Reply With Quote
Old 01-29-2017   #42
TehRealSalt
Ya Grrl Sal Here (σᴥσ)
Developer
 
TehRealSalt's Avatar
Default

"gamemap" is a global variable that returns the current map's number, so doing "mapheaderinfo[gamemap].typeoflevel" would work.

Also, there's another global variable called "maptol" that is exactly the same as what Zipper described except shorter
__________________
THZ Discord | Twitter | Avatar Source
TehRealSalt is offline   Reply With Quote
Old 01-29-2017   #43
Rumia1
worries too much
 
Rumia1's Avatar
Default

... Ok I'm just an idiot, thank you.
__________________
Quote:
Originally Posted by Cirno
Egguman-senpai...
Rumia1 is offline   Reply With Quote
Old 02-26-2017   #44
Rumia1
worries too much
 
Rumia1's Avatar
Default

Is there a ceiling variant of MFE_JUSTHITFLOOR?

EDIT: Also, is there a way to change the player's height without changing the scale of the player? I've tried player.mo.height but it isn't working for some reason.
__________________
Quote:
Originally Posted by Cirno
Egguman-senpai...

Last edited by Rumia1; 02-26-2017 at 11:41 AM.
Rumia1 is offline   Reply With Quote
Old 02-26-2017   #45
742mph
I make Sonic look like me
 
742mph's Avatar
Default

Unfortunately, there's no version of MFE_JUSTHITFLOOR for ceilings, so you'll have to make your own variable to check that. There's also no way to change a player mobj's height except by changing its scale or forcing it into a state that's hardcoded to have a height of 32*FRACUNIT instead of 48*FRACUNIT, like S_PLAY_PAIN.
__________________
Quote:
<Evilgasm> the opposite of egoraptor is Toa Tahu
742mph is offline   Reply With Quote
Old 02-26-2017   #46
Monster Iestyn
Friendly Neighbour-Hood
Moderator
 
Monster Iestyn's Avatar
Default

The game auto-corrects the player's height every tic; if the player is spinning/in pain/flying then they use spin height, otherwise they use the normal player height. I'm not sure there's a good way around it at all for the time being tbh.
Monster Iestyn is online now   Reply With Quote
Old 02-26-2017   #47
Rumia1
worries too much
 
Rumia1's Avatar
Default

Well that kinda sucks, I guess i'll just try and work around scaling instead.
__________________
Quote:
Originally Posted by Cirno
Egguman-senpai...
Rumia1 is offline   Reply With Quote
Old 03-08-2017   #48
Rumia1
worries too much
 
Rumia1's Avatar
Default

Is there any way to create a timer for a bot to follow player 1 input commands with?
__________________
Quote:
Originally Posted by Cirno
Egguman-senpai...
Rumia1 is offline   Reply With Quote
Old 03-08-2017   #49
Monster Iestyn
Friendly Neighbour-Hood
Moderator
 
Monster Iestyn's Avatar
Default

The Lua hooks "BotTiccmd" and "BotAI" may be of interest to you. ...unless you don't mean the kind of bots vanilla SRB2 provides with, say, Sonic & Tails.
Monster Iestyn is online now   Reply With Quote
Old 03-08-2017   #50
Rumia1
worries too much
 
Rumia1's Avatar
Default

I am working with BotAI, but I don't think you understood my question. I've tried adding a ThinkFrame hook for "sonic" to record button inputs from the player, and then have a time delay for when that button is pressed for "tails" in the BotAI hook but it ended up not working for some reason. I'd post what I made but somehow I accidentally deleted the script I was working on at the time and have no way of getting it back due to saving over it AND the backup that SLADE keeps.
__________________
Quote:
Originally Posted by Cirno
Egguman-senpai...
Rumia1 is offline   Reply With Quote
Old 2 Weeks Ago   #51
Rumia1
worries too much
 
Rumia1's Avatar
Default

Hi there once again, this time I was wondering how to detect when the player is spawning in the level so I can give them a shield when the level starts, and I was wondering how I could make it so Sonic can hang from a flying AI Tails.
__________________
Quote:
Originally Posted by Cirno
Egguman-senpai...

Last edited by Rumia1; 2 Weeks Ago at 07:14 AM.
Rumia1 is offline   Reply With Quote
Old 2 Weeks Ago   #52
Monster Iestyn
Friendly Neighbour-Hood
Moderator
 
Monster Iestyn's Avatar
Default

The "PlayerSpawn" hook is totally the best for spawning a shield when a player spawns ...except that in 2.1.19 it doesn't run for spawning at a checkpoint. I've changed this for future versions but otherwise... maybe some kind of flag set by MobjSpawn for MT_PLAYER that is later detected by a ThinkFrame or MobjThinker hook?

As for a Tails bot flying Sonic, apparently the code for grabbing a flying player is hardcoded not to work if Tails is a bot and using the normal bot AI as opposed to be being conrolled by a player (see here)... so, you'll probably have to recreate the relevant code with a MobjCollide or MobjMoveCollide hook. Most of it looks like it can be translated to Lua at least.
Monster Iestyn is online now   Reply With Quote
Old 2 Weeks Ago   #53
LunarDestroyer
 
LunarDestroyer's Avatar
Default

Actually, it's far easier to just add an if nil check for a player.mobj variable, as those are all wiped each time the player dies or changes level. obviously, you'll want to set the variable to something afterwards.
LunarDestroyer is offline   Reply With Quote
Old 2 Weeks Ago   #54
Rumia1
worries too much
 
Rumia1's Avatar
Default

Are there Lua equivalents to the following?

P_SetTarget
P_UnsetThingPosition
and P_SetThingPosition

if not, how would I go about recreating what they do?
__________________
Quote:
Originally Posted by Cirno
Egguman-senpai...
Rumia1 is offline   Reply With Quote
Old 2 Weeks Ago   #55
toaster
トースタちゃん
Developer
 
toaster's Avatar
Default

The first is handled by just setting mobj.target = some mobj reference or nil. Exposing the function would add more complication when we can just make the direct assignment safe.

The latter two are not safe to expose, and are only done as part of movement. You should call either P_TryMove (checks each spot in the way) or P_TeleportMove (goes directly there) in order to handle the act of unsetting, moving, and then resetting a mobj. If you don't want any movement to happen, you can just set the coordinates of P_TeleportMove to be the current ones - but I don't really get WHY you'd want to do that, anyways.
__________________
Quote:
<MonsterIestyn> surely it's good ass though
Quote:
<MonsterIestyn> watch porm to keep warm
toaster is offline   Reply With Quote
Old 2 Weeks Ago   #56
Monster Iestyn
Friendly Neighbour-Hood
Moderator
 
Monster Iestyn's Avatar
Default

Apologies for repeating what toaster said a little, I feel more has to be clarified on what the functions do and why you don't need to have access to them.

P_SetTarget is a function to do a mobj pointer assignment (usually mobj.target, but is also used for mobj.tracer and other points), while also marking it as a "reference" to the mobj (or removing the reference if it's assigned to a new mobj or nothing), so that when the mobj is removed, it doesn't immediately go away until all "references" to it have been cleared. This prevents certain problems from happening with pointers to mobjs that no longer exist. In Lua, the function is automatically used whenever you assign a new value to mobj.target or mobj.tracer and a bunch of other already existing mobj pointers. Custom Lua variables set to mobj_t meanwhile are automatically cleaned up if said mobjs no longer exist (I think). So you shouldn't need access to that function.

P_UnsetThingPosition and P_SetThingPosition are functions to unlink an object from the blockmap and sector lists, and relink it to them using the current position and flags. Therefore in the game it's only used if the x and y positions were modified, or if you changed whether an object uses the MF_NOBLOCKMAP or MF_NOSECTOR flags or not. Lua only allows you to change x/y using functions like P_TeleportMove/P_TryMove, and automatically uses the functions if you turn on or off those two flags. So you don't need access to those two functions either.

Last edited by Monster Iestyn; 2 Weeks Ago at 01:30 PM.
Monster Iestyn is online now   Reply With Quote
Old 6 Days Ago   #57
Rumia1
worries too much
 
Rumia1's Avatar
Default

Hi again, can somebody please direct me to where the 2D mode is handled within the source code. Thank you.
__________________
Quote:
Originally Posted by Cirno
Egguman-senpai...
Rumia1 is offline   Reply With Quote
Old 2 Days Ago   #58
Monster Iestyn
Friendly Neighbour-Hood
Moderator
 
Monster Iestyn's Avatar
Default

Sorry for being late to respond!

There's no specific place in the source code I can think of that handles 2D mode in general (maybe you need to be more specific about what you want?), but just search for anything involving "MF2_TWOD" or "twodlevel" and you may find what you want.
Monster Iestyn is online now   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 09:18 PM.


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