TheBigDeal Posted September 20, 2016 Share Posted September 20, 2016 Hello! So I was just wondering a pretty simple question, After eating something I was wondering how to drop a prefab, like I guess when you plant butterfly's and you get a flower, and will disappear on death. Link to comment https://forums.kleientertainment.com/forums/topic/70272-drop-prefabs-on-consumption/ Share on other sites More sharing options...
. . . Posted September 20, 2016 Share Posted September 20, 2016 Can you be more specific on what you want? Maybe I can help. Link to comment https://forums.kleientertainment.com/forums/topic/70272-drop-prefabs-on-consumption/#findComment-815820 Share on other sites More sharing options...
TheBigDeal Posted September 20, 2016 Author Share Posted September 20, 2016 @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. 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) Link to comment https://forums.kleientertainment.com/forums/topic/70272-drop-prefabs-on-consumption/#findComment-815822 Share on other sites More sharing options...
. . . Posted September 20, 2016 Share Posted September 20, 2016 Wow, that's too advanced for me... I'm sorry I can't help ... Link to comment https://forums.kleientertainment.com/forums/topic/70272-drop-prefabs-on-consumption/#findComment-815828 Share on other sites More sharing options...
TheBigDeal Posted September 20, 2016 Author Share Posted September 20, 2016 8 minutes ago, SuperDavid said: Wow, that's too advanced for me... I'm sorry I can't help ... Damn, I thought it would be sorta simple xD thanks anyway Link to comment https://forums.kleientertainment.com/forums/topic/70272-drop-prefabs-on-consumption/#findComment-815829 Share on other sites More sharing options...
Aquaterion Posted September 20, 2016 Share Posted September 20, 2016 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) Link to comment https://forums.kleientertainment.com/forums/topic/70272-drop-prefabs-on-consumption/#findComment-815931 Share on other sites More sharing options...
TheBigDeal Posted September 20, 2016 Author Share Posted September 20, 2016 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. Link to comment https://forums.kleientertainment.com/forums/topic/70272-drop-prefabs-on-consumption/#findComment-815961 Share on other sites More sharing options...
Aquaterion Posted September 21, 2016 Share Posted September 21, 2016 (edited) 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 September 21, 2016 by Aquaterion Link to comment https://forums.kleientertainment.com/forums/topic/70272-drop-prefabs-on-consumption/#findComment-816288 Share on other sites More sharing options...
TheBigDeal Posted September 21, 2016 Author Share Posted September 21, 2016 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. Link to comment https://forums.kleientertainment.com/forums/topic/70272-drop-prefabs-on-consumption/#findComment-816379 Share on other sites More sharing options...
Lumina Posted September 21, 2016 Share Posted September 21, 2016 you need a minimap folder, with a .tex and .xml files. Also, you should probably need a line like this in the modmain AddMinimapAtlas("minimap/marker.xml") Link to comment https://forums.kleientertainment.com/forums/topic/70272-drop-prefabs-on-consumption/#findComment-816385 Share on other sites More sharing options...
Aquaterion Posted September 21, 2016 Share Posted September 21, 2016 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 Link to comment https://forums.kleientertainment.com/forums/topic/70272-drop-prefabs-on-consumption/#findComment-816388 Share on other sites More sharing options...
TheBigDeal Posted September 23, 2016 Author Share Posted September 23, 2016 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) Link to comment https://forums.kleientertainment.com/forums/topic/70272-drop-prefabs-on-consumption/#findComment-817358 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