Jump to content

Character Specific Map Icon


Recommended Posts

Hello

Say I want Klaus' bag to appear on the map from anywhere, like a Ocuvigil, I do this

if GLOBAL.TheNet and GLOBAL.TheNet:GetIsServer() then
AddPrefabPostInit("klaus_sack", function(inst)
	inst.icon = GLOBAL.SpawnPrefab("globalmapicon")
    inst.icon:TrackEntity(inst)
    inst.MiniMapEntity:SetCanUseCache(false)
    inst.MiniMapEntity:SetDrawOverFogOfWar(true)
  end)
end

However, I'm wondering how would one achieve this so it only shows up for one specific character? Is this even possible or supported?

Link to comment
Share on other sites

Working with map-related code is awful. Good luck.

With that being said, you might be able to do this by using the same method that the Ancient Key and Thulecite Medallion use. 
The gist is that the icon only shows to players who have a certain tag by setting an icon restriction, so you can give this character the tag and it'll show up only for them.

I would look at the "atrium_key" and "nightmare_timepiece" prefabs to start off (Ancient Key and Thuelcite Medallion, respectively).

 

Edited by penguin0616
  • Like 2
Link to comment
Share on other sites

yep nailed it

if GLOBAL.TheNet and GLOBAL.TheNet:GetIsServer() then
AddPrefabPostInit("rock_moon", function(inst)
	inst.icon = GLOBAL.SpawnPrefab("globalmapicon")
    inst.MiniMapEntity:SetCanUseCache(false)
    inst.MiniMapEntity:SetDrawOverFogOfWar(true)
	inst:AddComponent("maprevealable")
    inst.components.maprevealable:AddRevealSource(inst, "moontracker")
    inst.components.maprevealable:SetIconPriority(15)
	inst.icon.MiniMapEntity:SetRestriction("moontracker")
  end)
end

then I just put inst:AddTag("moontracker") to any character I need

  • Sanity 1
Link to comment
Share on other sites

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
 Share

×
  • Create New...