DirtyDan Posted April 27, 2014 Share Posted April 27, 2014 Title pretty much says it all. I'm trying to figure out how to set my brain file up to get my creature to both follow and fight for my character. Any help is appreciated. Link to comment https://forums.kleientertainment.com/forums/topic/35578-how-to-get-custom-creature-to-follow-and-fight-for-you/ Share on other sites More sharing options...
_Q_ Posted April 27, 2014 Share Posted April 27, 2014 You could start with this:http://forums.kleientertainment.com/files/file/377-example-follow-the-leader/ Link to comment https://forums.kleientertainment.com/forums/topic/35578-how-to-get-custom-creature-to-follow-and-fight-for-you/#findComment-463999 Share on other sites More sharing options...
DirtyDan Posted April 28, 2014 Author Share Posted April 28, 2014 You could start with this:http://forums.kleientertainment.com/files/file/377-example-follow-the-leader/Well I tried to decipher that. But I couldn't. I tried copying Chester's brain file to my creature, renamed chester's brain to my creature's, and now I get the error, "Attempt to index field 'Health' (a nil value)" Link to comment https://forums.kleientertainment.com/forums/topic/35578-how-to-get-custom-creature-to-follow-and-fight-for-you/#findComment-464011 Share on other sites More sharing options...
DirtyDan Posted April 28, 2014 Author Share Posted April 28, 2014 Now after MUCH toying and detective work in the data files, I got my creature to successfully follow me. Now I want it to fight for me. How would I do that? Link to comment https://forums.kleientertainment.com/forums/topic/35578-how-to-get-custom-creature-to-follow-and-fight-for-you/#findComment-464033 Share on other sites More sharing options...
Fidooop Posted April 28, 2014 Share Posted April 28, 2014 I made a Tiny Box Tim for my Markiplier mod and had many bugs with him not following me if I left to the caves or died and revived at a touchstone or something... so if you have similar bugs insert this into your creature's prefab file not brain inst:AddComponent("follower")inst:DoPeriodicTask(1/10, function()local player = GetPlayer()if player and player.components.leader thenplayer.components.leader:AddFollower(inst)endend) then further-more write this into your character's prefab name(inside the fn function) inst:AddComponent("leader") unless you are making this creature for all characters then you will want to look into postinits... Link to comment https://forums.kleientertainment.com/forums/topic/35578-how-to-get-custom-creature-to-follow-and-fight-for-you/#findComment-464039 Share on other sites More sharing options...
NikMik Posted April 28, 2014 Share Posted April 28, 2014 Now after MUCH toying and detective work in the data files, I got my creature to successfully follow me. Now I want it to fight for me. How would I do that?Did you give the creature the combat component? And put: ChaseAndAttack(self.inst, 5),in the brain's OnStart() function? Link to comment https://forums.kleientertainment.com/forums/topic/35578-how-to-get-custom-creature-to-follow-and-fight-for-you/#findComment-464040 Share on other sites More sharing options...
NikMik Posted April 28, 2014 Share Posted April 28, 2014 (edited) then further-more write this into your character's prefab name(inside the fn function) inst:AddComponent("leader") unless you are making this creature for all characters then you will want to look into postinits... Nope, all the characters already have the leader component. Don't need to add that anywhere on the character. Edited April 28, 2014 by Mr. Tiddles Link to comment https://forums.kleientertainment.com/forums/topic/35578-how-to-get-custom-creature-to-follow-and-fight-for-you/#findComment-464041 Share on other sites More sharing options...
DirtyDan Posted April 28, 2014 Author Share Posted April 28, 2014 Did you give the creature the combat component? And put: ChaseAndAttack(self.inst, 5),in the brain's OnStart() function?I'm actually using your William mod to decipher which parts control combat, it's a bloody fantastic mod, and I'll try adding those lines. Link to comment https://forums.kleientertainment.com/forums/topic/35578-how-to-get-custom-creature-to-follow-and-fight-for-you/#findComment-464042 Share on other sites More sharing options...
NikMik Posted April 28, 2014 Share Posted April 28, 2014 I'm actually using your William mod to decipher which parts control combat, it's a bloody fantastic mod, and I'll try adding those lines.I've made and am making better. The robots are just a modified Shadow Puppet (minions summoned by playable Maxwell) to have different functions. Looking through their coding would probably help alot. Link to comment https://forums.kleientertainment.com/forums/topic/35578-how-to-get-custom-creature-to-follow-and-fight-for-you/#findComment-464044 Share on other sites More sharing options...
DirtyDan Posted April 28, 2014 Author Share Posted April 28, 2014 I've made and am making better. The robots are just a modified Shadow Puppet (minions summoned by playable Maxwell) to have different functions. Looking through their coding would probably help alot.It seems to work, but it does no damage, I assume I have to set the damage through. Also could I add you on steam if I have other coding questions, and also you seem like a pretty cool guy. Link to comment https://forums.kleientertainment.com/forums/topic/35578-how-to-get-custom-creature-to-follow-and-fight-for-you/#findComment-464046 Share on other sites More sharing options...
NikMik Posted April 28, 2014 Share Posted April 28, 2014 (edited) It seems to work, but it does no damage, I assume I have to set the damage through. Also could I add you on steam if I have other coding questions, and also you seem like a pretty cool guy.If you can handle my unstable brain, sure. And yeah, pretty sure you need to set damage. Also, make sure in the stategraph you have: inst.sg.statemem.target = inst.components.combat.target inst.components.combat:StartAttack() and inst.components.combat:DoAttack(inst.sg.statemem.target) Edited April 28, 2014 by Mr. Tiddles Link to comment https://forums.kleientertainment.com/forums/topic/35578-how-to-get-custom-creature-to-follow-and-fight-for-you/#findComment-464049 Share on other sites More sharing options...
DirtyDan Posted May 4, 2014 Author Share Posted May 4, 2014 Question, how can I get my SG working to have my creature running correctly from all angles, Ex. changing to side running animation when running to the side. And attack animation for side too. Link to comment https://forums.kleientertainment.com/forums/topic/35578-how-to-get-custom-creature-to-follow-and-fight-for-you/#findComment-470602 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