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 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 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 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 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 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 Share on other sites More sharing options...
NikMik Posted April 28, 2014 Share Posted April 28, 2014 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. Link to comment 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 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 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 Share on other sites More sharing options...
NikMik Posted April 28, 2014 Share Posted April 28, 2014 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) Link to comment 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 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.
Please be aware that the content of this thread may be outdated and no longer applicable.