Rosten Posted November 11, 2013 Share Posted November 11, 2013 [Wip] - Wilson's Friendship StaffThis mod will add 1 new item, the friendship staff!what this item does is whenever you fire it, it turns whatever you shot in the face, into your friend (kind of ironic, isn't it) So, here's the current information Item - Friendship StaffRecipe - 1 Blue gem, 1 Yellow gem, 3 Living logs, 6 Nightmare fuelCrafting tab - Shadow Manipulator, Magic tabDurability - 20 usesDamage - None (you wouldn't want to hurt you're friends would you?) Progress - 100%Left to doUpload! CreditsMain Coder Cannibalizer - @Blazingice26Artist - @MilleniumCountQuotes - @Ortorin--------------------------------------Special Thanks @Malacath - For the tons and tons of help he gave me he pretty much coded most of it @Cheerio - For making the followtheleader script from which this mod is based off of, and helping me edit it to what i needed it to do Known Bugs -Game crashes whenever attacking bee's nest with a follower staff (seriously, why would you even do that?) Original Post So, i've got this idea for a mod to do, but one thing i'd like to know is, could you make it where, when a monster is hit by a projectile fired from a staff it automatically becomes a follower, like pigs do whenever you give them meat, except getting hit by a projectile? Here's the idea for the mod Name - Wilson's Friendship staffPurpose - Adds a new staff that, whenever it strikes an enemy, converts them into a follower until the end of the day Durability - 25 usesCrafting Recipes -Tab Magic Shadow Manipulator - Friendship Wand - 1 blue gem 1 yellow gem 3 living logs 6 nightmare fuelWhat it does - Turns target into a follower for life. Edit - Updated the OP to make it look more like a WIP thread, left the other post in a spoiler if anyone would like to view it, now i just need a moderator to change the title, and credited a few other people Link to comment Share on other sites More sharing options...
Malacath Posted November 11, 2013 Share Posted November 11, 2013 So, i've got this idea for a mod to do, but one thing i'd like to know is, could you make it where, when a monster is hit by a projectile fired from a staff it automatically becomes a follower, like pigs do whenever you give them meat, except getting hit by a projectile?[...] the answer to "Can we do X in a mod?" is almost always "Yes, but it might not be easy." ;PAnd in this case it's probably not even that difficult.*rough outline*I don't have any scripts at hand so I can only guess that there is a way to listen to the event that a projectile hits something thus being able to check that something for a follower component and add loyalty.*rough outline end* Link to comment Share on other sites More sharing options...
Rosten Posted November 11, 2013 Author Share Posted November 11, 2013 So, i've got this idea for a mod to do, but one thing i'd like to know is, could you make it where, when a monster is hit by a projectile fired from a staff it automatically becomes a follower, like pigs do whenever you give them meat, except getting hit by a projectile?[...] the answer to "Can we do X in a mod?" is almost always "Yes, but it might not be easy." ;P Fair enough, maybe i should change the title to, "Any idea how you would go about doing this" Link to comment Share on other sites More sharing options...
Malacath Posted November 11, 2013 Share Posted November 11, 2013 Fair enough, maybe i should change the title to, "Any idea how you would go about doing this" I added a very rough outline to my previous post ; ) Link to comment Share on other sites More sharing options...
Rosten Posted November 11, 2013 Author Share Posted November 11, 2013 I added a very rough outline to my previous post ; )Thanks, i'll look into the game files (and you're mods files, the waverly's familiar looks like it might be a bit helpful)and see what i can come up withnow, im not very proficient in LUA but i might as well take a wild guess as to what it might be along the lines ofsomething like :listen for event("projectileHit") then inst:AddComponent("follower")Well, thats my wild guess P.s - I added a bit of the idea to the OP Link to comment Share on other sites More sharing options...
Malacath Posted November 11, 2013 Share Posted November 11, 2013 I actually think that looking at the fire_projectile.lua file would be more helpful, also the projectile.lua component might give a few hints. And if you are especially unlucky both of those files don't even exist because I just pulled them from my memory and that part of me is a known evil.But I know for sure that staffs.lua exists and the firestaff (or redstaff) in there might be a good startingpoint as well. Good luck ^^ Link to comment Share on other sites More sharing options...
Rosten Posted November 11, 2013 Author Share Posted November 11, 2013 I actually think that looking at the fire_projectile.lua file would be more helpful, also the projectile.lua component might give a few hints. And if you are especially unlucky both of those files don't even exist because I just pulled them from my memory and that part of me is a known evil.But I know for sure that staffs.lua exists and the firestaff (or redstaff) in there might be a good startingpoint as well. Good luck ^^Thanks for all the help, i'll try my best to make this mod a realityi'll probably be using your guide for making the hand-held objects, so, thanks x2 Happy Slurper Approves - P.s. - It seems you've been getting pretty popular around here, what with your involvement in the waverly project, and all the help you've been giving out on the forums Link to comment Share on other sites More sharing options...
Rosten Posted November 11, 2013 Author Share Posted November 11, 2013 I actually think that looking at the fire_projectile.lua file would be more helpful, also the projectile.lua component might give a few hints. And if you are especially unlucky both of those files don't even exist because I just pulled them from my memory and that part of me is a known evil.But I know for sure that staffs.lua exists and the firestaff (or redstaff) in there might be a good startingpoint as well. Good luck ^^Hey, quick question about your guide, i was following it exactly up to the point to see if i can debugspawn the item in, whenever i try to run it on don't starve then it crashes saying it can't find friendstaff.xml or friendstaff.tex, anyway to fix this? Edit - im gonna try using the tex converter to create both files, and see if it works thenEdit2- It seems the tex worked, not sure how to make a xml file for it though Link to comment Share on other sites More sharing options...
seronis Posted November 11, 2013 Share Posted November 11, 2013 Look at the code for the boomerang to see an example projectile that perform an action on contact (specifically it rethrows itself back at its owner). Link to comment Share on other sites More sharing options...
Rosten Posted November 11, 2013 Author Share Posted November 11, 2013 Look at the code for the boomerang to see an example projectile that perform an action on contact (specifically it rethrows itself back at its owner).Wow, thats actually a really good idea, something as seemingly insignificant as the return to you when you throw a boomerang could be exactly what we need Link to comment Share on other sites More sharing options...
Rosten Posted November 11, 2013 Author Share Posted November 11, 2013 So, i took a quick look through the boomerang script, and it looks like the relevant code is this -local function OnHit(inst, owner, target) if owner == target then OnDropped(inst) else ReturnToOwner(inst, owner) end local impactfx = SpawnPrefab("impact") if impactfx then local follower = impactfx.entity:AddFollower() follower:FollowSymbol(target.GUID, target.components.combat.hiteffectsymbol, 0, 0, 0 ) impactfx:FacePoint(inst.Transform:GetWorldPosition()) endend Im thinking maybe something along the lines of ;local function OnHit(target) then inst:AddComponent("follower")-- although im not exactly sure how i would make it apply "follower" to the target, instead of the projectile, like the boomerang does Link to comment Share on other sites More sharing options...
Rosten Posted November 11, 2013 Author Share Posted November 11, 2013 I actually think that looking at the fire_projectile.lua file would be more helpful, also the projectile.lua component might give a few hints. And if you are especially unlucky both of those files don't even exist because I just pulled them from my memory and that part of me is a known evil.But I know for sure that staffs.lua exists and the firestaff (or redstaff) in there might be a good startingpoint as well. Good luck ^^So, i followed all the steps and substituted all the stuff and made the xml and tex files, but whenever i try to run the mod don't starve just crashes, can someone look at this for me and make sure everythings in order?(note "friendstaff" is the prefab name) WilsonsFriendWand(Mediafire) (are we allowed to use mediafire links here? it won't let me attach the .rar file to the attachments) I need this fixed as soon as possible because its a bit hard to make a mod without being able to test whether it works or not :/ Link to comment Share on other sites More sharing options...
Malacath Posted November 11, 2013 Share Posted November 11, 2013 I'll take a look when I get home, so you need to be just a bit more patient. Unless of course someone else comes along ; )Also, you'll usually find a log.txt in your documents folder which contains information about the crash even if the game didn't show a crash screen. Link to comment Share on other sites More sharing options...
Heavenfall Posted November 11, 2013 Share Posted November 11, 2013 This is not possible to do currently without editing the "brain" individually for each creature that you want the staff to work on. Link to comment Share on other sites More sharing options...
Rosten Posted November 11, 2013 Author Share Posted November 11, 2013 This is not possible to do currently without editing the "brain" individually for each creature that you want the staff to work on.Really? I Guess i could limit it to only a few monsters (probably would've had to anyways, having the ancient guardian as your personal destroyer-of-everything would be a bit OP eh?) could you give me a bit of insight unto how i would do this, i don't know how the brains work very well Link to comment Share on other sites More sharing options...
Heavenfall Posted November 11, 2013 Share Posted November 11, 2013 Take a look at the pig and its brain, if you follow the code it is quite easy to understand. Link to comment Share on other sites More sharing options...
Rosten Posted November 11, 2013 Author Share Posted November 11, 2013 Take a look at the pig and its brain, if you follow the code it is quite easy to understand.I'm gonna experiment with this a while, firstly i'd like to try and set a different mob as always being a follower when you meet it, e.g rabbit, or something like that, then try and find out how i can apply that effect to certain mobs via a projectile --Edit: Messing with brains is really difficult, whenever i was looking at the prefabs for items and scripts and such i could tell what was going on, what was making what happen etc. but these brains are way more complicated.. Link to comment Share on other sites More sharing options...
Malacath Posted November 11, 2013 Share Posted November 11, 2013 I'm gonna experiment with this a while, firstly i'd like to try and set a different mob as always being a follower when you meet it, e.g rabbit, or something like that, then try and find out how i can apply that effect to certain mobs via a projectile --Edit: Messing with brains is really difficult, whenever i was looking at the prefabs for items and scripts and such i could tell what was going on, what was making what happen etc. but these brains are way more complicated..Yes, I would suggest not messing with brains unless you feel super confident about coding. The code for different behaviours is actually not very complex on its own but the overall thing confused me back when I started using brains.So I'd say try to stick with all the creatures that already have a follower component. Because those should also have the necessary brain to follow. Since it's your first mod that should be a good starting point. Link to comment Share on other sites More sharing options...
Rosten Posted November 11, 2013 Author Share Posted November 11, 2013 Yes, I would suggest not messing with brains unless you feel super confident about coding. The code for different behaviours is actually not very complex on its own but the overall thing confused me back when I started using brains.So I'd say try to stick with all the creatures that already have a follower component. Because those should also have the necessary brain to follow. Since it's your first mod that should be a good starting point.Hmmm... I'm pretty sure the only mobs with a follower component are pigmen, abigail, chester, and beefalo, right?On second thought, isnt abigail basically a re-skinned ghost with a follower component? interesting,Controller of the dead anyone? Link to comment Share on other sites More sharing options...
Malacath Posted November 11, 2013 Share Posted November 11, 2013 Hmmm... I'm pretty sure the only mobs with a follower component are pigmen, abigail, chester, and beefalo, right?Let me do a quick search.abigailbabybeefalobeefalobishopbunnymancavespiderschesterhoundknightmandrakepigmanrockyrookshadowmaxwellsmallbirdspiderwalrusSome of those might not be of interest. And of course you don't need to copy this list, you can check for the components existence by doing for example thislocal function OnHit(target) if target.components.follower then --Do something here endend Link to comment Share on other sites More sharing options...
Rosten Posted November 11, 2013 Author Share Posted November 11, 2013 Let me do a quick search.abigailbabybeefalobeefalobishopbunnymancavespiderschesterhoundknightmandrakepigmanrockyrookshadowmaxwellsmallbirdspiderwalrus Some of those might not be of interest.Hmm, lets pick a few out of there that seem promisingAbigailKnight Bishop ( I imagine that these two are from the damaged clockworks when you repair them?)Spider/CavespiderHound (Didn't know they had a follower component)----------------------------------------------------------------------------------That seems like a pretty good list of candidates Link to comment Share on other sites More sharing options...
Rosten Posted November 11, 2013 Author Share Posted November 11, 2013 local function OnHit(target) if target.components.follower then - endendSo, quick question about the baby beefalo, since, by default they follow normal beefalo, and overwriting that with a component to follow me would probably mess up its behaviors, is there anyway to keep both leaders but make one have higher priority then the other? Link to comment Share on other sites More sharing options...
seronis Posted November 11, 2013 Share Posted November 11, 2013 I dont know the specifics but thats what the brain does. Its a graph of 'needs' that each creature processes in order. If a need isnt met it does that action. If its met it check the next Need in the list. Pigs for example have a 'run around like headles chicken when on fire' need that is really high priority. It is a higher priority than the 'chase nearby spider' need. This means if a pig is on fire it will be worried about itself and less about nearby enemies which is a logical reaction. Basically if you insert the 'desire to follow player' at a higher priority than the 'desire to follow mother' then the player is the one who will be followed. Link to comment Share on other sites More sharing options...
Malacath Posted November 11, 2013 Share Posted November 11, 2013 Hmm, lets pick a few out of there that seem promisingAbigailKnightBishopSpider/CavespiderHound (Didn't know they had a follower component)----------------------------------------------------------------------------------That seems like a pretty good list of candidatesHounds follow McTusk. Well at least blue hounds, but all hounds share the part of following you. Also, see my previous post updated , I'm sorry that I always update posts five seconds after posting them. It could also happen, that just making a certain prefab a follower won't work. I remember making hounds a follower was quite a hassle because they still target you in that case so it basically needed a rework of the KeepTarget function in hounds.luaSo you should try out for which mobs it works good. So, quick question about the baby beefalo, since, by default they follow normal beefalo, and overwriting that with a component to follow me would probably mess up its behaviors, is there anyway to keep both leaders but make one have higher priority then the other?Uhhmmm I have no clue how the interactions would be. And I'm quite sure you cannot have more than one leader. Link to comment Share on other sites More sharing options...
Rosten Posted November 11, 2013 Author Share Posted November 11, 2013 Hounds follow McTusk. Well at least blue hounds, but all hounds share the part of following you. Also, see my previous post updated , I'm sorry that I always update posts five seconds after posting them. It could also happen, that just making a certain prefab a follower won't work. I remember making hounds a follower was quite a hassle because they still target you in that case so it basically needed a rework of the KeepTarget function in hounds.luaSo you should try out for which mobs it works good. Uhhmmm I have no clue how the interactions would be. And I'm quite sure you cannot have more than one leader.Ill try and keep that in mind when im selecting the candidates for followers, Also, i think i remember seeing one mod where you could have a hound friend, but whenever a pack of hounds came it would become hostile towards you again and when you killed off the rest of the pack it would become friendly again, i forgot what it was, might have been Wulfe, That sounds pretty similar to what im talking about 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.