Jump to content

Recommended Posts

@SuperDavid

So in my character, I have a system of upgrades/buffs whenever you eat a "Soul"

when you eat the red soul, it saves a spawn point, so when you die instead of being a ghost it will teleport you back to that location.

I just want a way so when you eat the soul I can sorta place an animated marker on the ground so people know where they will re spawn.

This is what I want it to look like, obviously i'll make the stuff, just gotta drop something temporary

It'll end up looking something like this, but higher res, on the ground as a marker.

(Maybe make it appear on the map/minimap too would be great and helpful)

local function oneat(inst, food)
	if food:HasTag("soul") then
		local marker = SpawnPrefab("marker")
		marker.Transform:SetPosition(inst.Transform:GetWorldPosition())
		marker.owner = inst.GUID
	end
end

local function ondeath(inst)
	inst:DoTaskInTime(3, function()
		for k,v in pairs(Ents) do
			if k.prefab == "marker" and k.owner and k.owner == inst.GUID then
				inst.Transform:SetPosition(k.Transform:GetWorldPosition())
				inst:PushEvent("respawnfromghost")
				break
			end
		end
	end)
end

inst.components.eater:SetOnEatFn(oneat)
inst:ListenForEvent("death", ondeath)

 

2 hours ago, Aquaterion said:

local function oneat(inst, food)
	if food:HasTag("soul") then
		local marker = SpawnPrefab("marker")
		marker.Transform:SetPosition(inst.Transform:GetWorldPosition())
		marker.owner = inst.GUID
	end
end

local function ondeath(inst)
	inst:DoTaskInTime(3, function()
		for k,v in pairs(Ents) do
			if k.prefab == "marker" and k.owner and k.owner == inst.GUID then
				inst.Transform:SetPosition(k.Transform:GetWorldPosition())
				inst:PushEvent("respawnfromghost")
				break
			end
		end
	end)
end

inst.components.eater:SetOnEatFn(oneat)
inst:ListenForEvent("death", ondeath)

 

Awesome! Sadly I can't try this right now. Would this also make it appear on the map? If not thats fine, probably pretty advanced.

22 hours ago, TheBigDeal said:

Awesome! Sadly I can't try this right now. Would this also make it appear on the map? If not thats fine, probably pretty advanced.

you'd just have to add inst.entity:AddMiniMapEntity() and make a texture for the minimap icon

Edited by Aquaterion
6 hours ago, Aquaterion said:

you'd just have to add inst.entity:AddMiniMapEntity() and make a texture for the minimap icon

Ok, so I added in the code and such, there is no crashes, but nothing seems to show. I have a marker asset in a marker.zip with a anim file (unanimated for now, still gotta learn how to do that) , a bin, and the .tex file with the proper textures. It is probably my mistake here as I am probably missing something big. I have not tested out the map part yet. 

29 minutes ago, TheBigDeal said:

Ok, so I added in the code and such, there is no crashes, but nothing seems to show. I have a marker asset in a marker.zip with a anim file (unanimated for now, still gotta learn how to do that) , a bin, and the .tex file with the proper textures. It is probably my mistake here as I am probably missing something big. I have not tested out the map part yet. 

well do you have a prefab called marker? as in code wise, not just art

On 9/21/2016 at 1:39 PM, Aquaterion said:

well do you have a prefab called marker? as in code wise, not just art

I put it in my modmain in PrefabFiles as marker, and made a marker.lua, but am not sure what should be in the marker.lua since it is just a regular item that can't even be in your inventory. (Sorry for delay on answer, got a bit busy)

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...