beforeidecay96 Posted January 12, 2016 Share Posted January 12, 2016 How exactly would I go about making a follower for my DST character? I want to learn how to make a follower that's similar to Abigail, but I want it to be a human character instead of a ghost, and I'm not sure where to start or how to do something like that. I've tried looking at the lua and brain files for Abigail, but I still can't figure it out (I feel really overwhelmed trying to understand brain files). Is there anyone who knows how to go about making a follower that can help me? Link to comment Share on other sites More sharing options...
beforeidecay96 Posted January 14, 2016 Author Share Posted January 14, 2016 UPDATE: Me and my twin sister figured out how to get a follower on a character, but now we ran into a problem where each time we log in the character starts with another one of that follower. Here's a photo in case my explanation was confusing: And here's the prefab for the item that spawns the follower: Spoiler local assets = { Asset("ANIM", "anim/sukonbu.zip"), Asset("ATLAS", "images/inventoryimages/sukonbu.xml"), Asset("IMAGE", "images/inventoryimages/sukonbu.tex"), } local prefabs = { } --Part of the Eyebone Testing local SPAWN_DIST = 30 local function GetSpawnPoint(pt) local theta = math.random() * 2 * PI local radius = SPAWN_DIST local offset = FindWalkableOffset(pt, theta, radius, 12, true) return offset ~= nil and (pt + offset) or nil end local function SpawnKagura(inst) if not inst.owner then print("Error: Eyebone has no linked player!") return end --print("kagura_eyebone - SpawnKagura") local pt = inst:GetPosition() --print(" near", pt) local spawn_pt = GetSpawnPoint(pt) if spawn_pt ~= nil then --print(" at", spawn_pt) local kagura = SpawnPrefab("summonkagura") if kagura ~= nil then kagura.Physics:Teleport(spawn_pt:Get()) kagura:FacePoint(pt:Get()) if inst.owner then inst.owner.kagura = kagura end return kagura end --else -- this is not fatal, they can try again in a new location by picking up the bone again --print("kagura_eyebone - SpawnKagura: Couldn't find a suitable spawn point for kagura") end end local StartRespawn local function StopRespawn(inst) --print("dogoo_kagura - StopRespawn") if inst.respawntask ~= nil then inst.respawntask:Cancel() inst.respawntask = nil inst.respawntime = nil end end local function RebindKagura(inst, kagura) kagura = kagura or (inst.owner and inst.owner.kagura) if kagura ~= nil then if inst.owner then end inst.AnimState:PlayAnimation("idle", true) inst:ListenForEvent("death", function() if inst.owner then inst.owner.kagura = nil end StartRespawn(inst, TUNING.CHESTER_RESPAWN_TIME) end, kagura ) end end local function RespawnKagura(inst) --print("kagura_eyebone - RespawnKagura") StopRespawn(inst) RebindKagura(inst, (inst.owner and inst.owner.kagura) or SpawnKagura(inst)) end StartRespawn = function(inst, time) StopRespawn(inst) time = time or 0 inst.respawntask = inst:DoTaskInTime(time, RespawnKagura) inst.respawntime = GetTime() + time inst.AnimState:PlayAnimation("dead", true) end local function StopRespawn(inst) --print("kagura_eyebone - StopRespawn") if inst.respawntask ~= nil then inst.respawntask:Cancel() inst.respawntask = nil inst.respawntime = nil end end local function FixKagura(inst) inst.fixtask = nil --take an existing kagura if there is one if inst.components.inventoryitem.owner ~= nil then local time_remaining = 0 local time = GetTime() if inst.respawntime and inst.respawntime > time then time_remaining = inst.respawntime - time end StartRespawn(inst, time_remaining) end end local function OnPutInInventory(inst) if inst.fixtask == nil then inst.fixtask = inst:DoTaskInTime(1, FixKagura) end end local function OnSave(inst, data) --print("kagura_eyebone - OnSave") --data.EyeboneState = inst.EyeboneState if inst.respawntime ~= nil then local time = GetTime() if inst.respawntime > time then data.respawntimeremaining = inst.respawntime - time end end end local function OnLoad(inst, data) if data == nil then return end if data.respawntimeremaining ~= nil then inst.respawntime = data.respawntimeremaining + GetTime() end end local function GetStatus(inst) --print("smallbird - GetStatus") if inst.respawntask ~= nil then return "WAITING" end end local function fn() local inst = CreateEntity() inst.entity:AddTransform() inst.entity:AddAnimState() inst.entity:AddNetwork() MakeInventoryPhysics(inst) inst.AnimState:SetBank("sukonbu") inst.AnimState:SetBuild("sukonbu") inst.AnimState:PlayAnimation("idle") inst:AddTag("_named") if not TheWorld.ismastersim then return inst end inst.persists = false inst.entity:SetPristine() inst:AddComponent("inspectable") inst.components.inspectable.getstatus = GetStatus inst.components.inspectable:RecordViews() inst.components.inspectable.nameoverride = "kagura_eyebone" inst:AddComponent("inventoryitem") inst.components.inventoryitem.keepondeath = true inst.components.inventoryitem.imagename = "sukonbu" inst.components.inventoryitem.atlasname = "images/inventoryimages/sukonbu.xml" inst.components.inventoryitem:SetOnPutInInventoryFn(OnPutInInventory) inst:AddComponent("leader") inst:AddComponent("named") inst.fixtask = inst:DoTaskInTime(1, FixKagura) inst.RebindKagura = RebindKagura return inst end return Prefab("common/inventory/sukonbu", fn, assets, prefabs) Some help would be really nice. Thanks! Link to comment Share on other sites More sharing options...
rons0n Posted January 15, 2016 Share Posted January 15, 2016 (edited) Are you using my caster mod to make this pet? Sadly to say that's really botched up with large chunks of the code smashed from other mods creating some messy goop. The pet doesn't do things as intended and there's a lot of redundancies(code-wise) in it. If I we're you I'd work with the Personal Chester Mod instead and try to figure it out from there rather then work out the mess i've made. If not, then good luck on your endeavors! Edited January 15, 2016 by rons0n Link to comment Share on other sites More sharing options...
beforeidecay96 Posted January 15, 2016 Author Share Posted January 15, 2016 12 hours ago, rons0n said: Are you using my caster mod to make this pet? Sadly to say that's really botched up with large chunks of the code smashed from other mods creating some messy goop. The pet doesn't do things as intended and there's a lot of redundancies(code-wise) in it. If I we're you I'd work with the Personal Chester Mod instead and try to figure it out from there rather then work out the mess i've made. If not, then good luck on your endeavors! We were using the rulebreaker prefab from your caster mod and the rest was from the bear Tibbers from your Annie mod. At first my sister was trying to use the assassin just changing the animation where it looks like her character, but it wouldn't eat or accept items. So she looked around and then found Tibbers and decided to use the stategraph, brains, and Tibbers prefab. That fixed the problems with the follower not eating or accepting items, but now it spawns another each time she logs in. We're going to take a look at the Personal Chester mod now, thank you so much for suggesting it! Your mods are really good, and coding is hard sometimes, so don't get discouraged or feel like you shouldn't make mods. ^^; Link to comment Share on other sites More sharing options...
beforeidecay96 Posted January 15, 2016 Author Share Posted January 15, 2016 UPDATE: My sister was able to fix the spawning issue, all thanks to your suggestion to look at the Personal Chester mod! Thank you so much, rons0n!!<3 Link to comment 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