SRB2 Message Board  

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

Thread Tools Search this Thread
Old 08-03-2018   #1
Lion Sora
SRB2 Freeplay Owner
Lion Sora's Avatar
Default Ambush/Float flag with custom objects

is there a way to make the ambush flag make my own custom objects float? because i made a few custom pickups and i would like them to use the ambush/float flag like rings do
Creator of SRB2 FreePlay, the SRB2 server for anyone and everyone
Mod is being publicly tested

Last edited by Lion Sora; 08-03-2018 at 12:19 PM.
Lion Sora is offline   Reply With Quote
Old 08-03-2018   #2
Rookie modder
Rapidgame7's Avatar

One way to do it is through the MapLoad hook:
Iterate through all mapthings (for mapthing in mapthings.iterate do), find the map things that pertain to your object, and check that mapthing.options has the MTF_AMBUSH bit set to 1. If it is, teleport mapthing.mobj upwards by as much as you want it to float.

An example on how to achieve this:
addHook("MapLoad", function()
// For every thing (not object) in the map
for mapthing in mapthings.iterate do
	// Check that the thing's type is 300 (this example is for the default ring, change 300 to your thing type)
	// Also check that the thing has the Ambush flag set
	if mapthing.type == 300 and (mapthing.options & MTF_AMBUSH) then
		// If it is...
		local m = mapthing.mobj
		P_TeleportMove(m.x, m.y, m.z+(48*FRACUNIT))
		// It can be anything else other than 48, try experimenting
This does not account for flipped objects.
Lost interest on modding for a while...

Last edited by Rapidgame7; 08-03-2018 at 04:49 PM. Reason: wHOOPS
Rapidgame7 is offline   Reply With Quote

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 04:03 AM.

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