Ambush/Float flag with custom objects

Status
Not open for further replies.

MikeTheDigiFloof

Creator of Online+
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
 
Last edited:
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:
Code:
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
	end
end
end)
This does not account for flipped objects.
 
Last edited:
Status
Not open for further replies.

Who is viewing this thread (Total: 1, Members: 0, Guests: 1)

Back
Top