. . . Posted May 2, 2019 Share Posted May 2, 2019 Hello, I need help because I am dumb and can't figure this out. I'm trying to make a mod prefab show up on the map always like the moonlens, but it doesn't seem to work? I copy pasted code from the moonlens which I thought is what makes it appear on the map always, but it doesn't seem to do anything .. Spoiler local function fn() local inst = CreateEntity() inst.entity:AddTransform() inst.entity:AddAnimState() inst.entity:AddSoundEmitter() inst.entity:AddNetwork() inst.entity:AddMiniMapEntity() MakeObstaclePhysics(inst, .75) inst:AddTag("structure") inst:AddTag("grand_totem") inst.AnimState:SetBank("grand_totem") inst.AnimState:SetBuild("grand_totem") inst.AnimState:PlayAnimation("idle") inst.MiniMapEntity:SetIcon("grand_totem.tex") inst.MiniMapEntity:SetCanUseCache(false) --from moonlens inst.MiniMapEntity:SetDrawOverFogOfWar(true) --from moonlens inst.entity:SetPristine() if not TheWorld.ismastersim then return inst end --from moonlens inst.icon = nil if inst.icon == nil then inst.icon = SpawnPrefab("globalmapicon") inst.icon:TrackEntity(inst) end Thanks for your time and any help, have a great day ! Link to comment https://forums.kleientertainment.com/forums/topic/105650-how-to-make-prefab-show-up-on-map-always-like-moonlens/ Share on other sites More sharing options...
YakumoYukari Posted May 4, 2019 Share Posted May 4, 2019 I don't really understand what you're trying to do but seems this code works. local assets = { Asset("ANIM", "anim/sentryward.zip"), } local function OnInit(inst) inst.icon = SpawnPrefab("globalmapicon") inst.icon:TrackEntity(inst) end local function fn() local inst = CreateEntity() inst.entity:AddTransform() inst.entity:AddAnimState() inst.entity:AddSoundEmitter() inst.entity:AddNetwork() inst.entity:AddMiniMapEntity() MakeObstaclePhysics(inst, .75) inst:AddTag("structure") inst.MiniMapEntity:SetIcon("sentryward.png") inst.MiniMapEntity:SetCanUseCache(false) inst.MiniMapEntity:SetDrawOverFogOfWar(true) inst.AnimState:SetBank("sentryward") inst.AnimState:SetBuild("sentryward") inst.AnimState:PlayAnimation("idle_full_loop", true) inst.entity:SetPristine() if not TheWorld.ismastersim then return inst end inst:AddComponent("inspectable") inst:DoTaskInTime(0, OnInit) return inst end return Prefab("teststructure", fn, assets) It's kind of full script because I have to test it. I think I should explain this after confirming your answer if this is what you were trying to do or not. Link to comment https://forums.kleientertainment.com/forums/topic/105650-how-to-make-prefab-show-up-on-map-always-like-moonlens/#findComment-1189204 Share on other sites More sharing options...
. . . Posted May 4, 2019 Author Share Posted May 4, 2019 Thank you! it works fine now !! I guess the thing I did wrong was making not exactly like the moonlens code lol Link to comment https://forums.kleientertainment.com/forums/topic/105650-how-to-make-prefab-show-up-on-map-always-like-moonlens/#findComment-1189223 Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now