Jump to content

Recommended Posts

-- In the prefab
function StartQuake(inst)
	for _, player in ipairs(AllPlayers) do
		player:PushEvent("manmadequake", { causer = inst })
	end
end

-- modmain
AddPlayerPostInit(function(inst)
	inst:ListenForEvent("manmadequake", function(inst, data)
		if GLOBAL.TheWorld:HasTag("cave") then
			GLOBAL.TheWorld:PushEvent("ms_miniquake", { rad = 10, num = 15, duration = 5, target = inst })
		end
	end)
end)

The code has not been tested, good luck!

Use shard RPC.

-- define the RPC
AddShardModRPCHandler(YOUR_MOD_NAME, "cause_earthquake", function()
  GLOBAL.TheWorld:PushEvent("ms_forcequake")
end)

-- call the RPC
SendModRPCToShard(GetShardModRPC(YOUR_MOD_NAME, "cause_earthquake"))

 

1 hour ago, LeafyFly said:

Use shard RPC.

-- define the RPC
AddShardModRPCHandler(YOUR_MOD_NAME, "cause_earthquake", function()
  GLOBAL.TheWorld:PushEvent("ms_forcequake")
end)

-- call the RPC
SendModRPCToShard(GetShardModRPC(YOUR_MOD_NAME, "cause_earthquake"))

 

Where do I put these?

6 hours ago, JaccK1618 said:

Where do I put these?

The first one possibly in modmain, the second one where you want the quake trigger to be called from (e.g. put in a function that triggers the RPC on item use)

Not sure if that'll work, I have to learn more of the RPCs myself.

  • Like 1

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
  • Create New...