Proc Posted September 13, 2019 Share Posted September 13, 2019 Hello all, I'm making a character for a friend, and he has a hard time kiting monsters, specially the bosses, so I thought his custom character could have his own exclusive ranged weapon to alleviate the issure: a boomerang with infinite uses that doesnt deal damage if he fails to catch it. Auto catching it would be better, but i imagine that would be much more complicated. I'll be happy with simply reducing the damage on failure to zero But how would I go about this? Link to comment Share on other sites More sharing options...
Ultroman Posted September 13, 2019 Share Posted September 13, 2019 Check out this mod. It's a boomerang with built-in auto catch. You can remove the extra stuff. When you get the item working on its own, you can always make his character spawn with it and/or make only that character able to craft it and/or only his character be able to pick it up. This post shows you how to make a recipe character-specific and how to make other characters unable to pick it up. Link to comment Share on other sites More sharing options...
Proc Posted September 22, 2019 Author Share Posted September 22, 2019 (edited) alright, scriptwise the boomerang works perfectly, and i could add new artwork for the inventory as well as ground and swap models. the only problem is that the weapon goes invisible while flying to and from targets. I figure i need to make an animation for this and add it to the "myboomerang" zip file somehow, but I realy don't know how to go about this? I think i should add the animation in spriter but im blanking out on shich file to edit or where to put it. Oh, and i tried the script to make others unable to pick it up but the game turns an error, says the variable "inst" is not declared in the first line of that code. Edited September 22, 2019 by Proc Link to comment Share on other sites More sharing options...
Ultroman Posted September 22, 2019 Share Posted September 22, 2019 1 hour ago, Proc said: alright, scriptwise the boomerang works perfectly, and i could add new artwork for the inventory as well as ground and swap models. the only problem is that the weapon goes invisible while flying to and from targets. I figure i need to make an animation for this and add it to the "myboomerang" zip file somehow, but I realy don't know how to go about this? I think i should add the animation in spriter but im blanking out on shich file to edit or where to put it. Check out this thread. 1 hour ago, Proc said: tried the script to make others unable to pick it up but the game turns an error, says the variable "inst" is not declared in the first line of that code. Without seeing the code you have, I cannot help. It sounds like you've put it in the wrong place. Link to comment Share on other sites More sharing options...
Proc Posted September 22, 2019 Author Share Posted September 22, 2019 (edited) You are right, i should post the code i have so far. this is the trimmed down code of the super boomerang mod i started from, i believe i removed all the extra stuff other than the auto catch utility. While at it, there is one bit of code that confuses me: if owner.components.health and owner.components.health:GetPercent() < 1 and not target:HasTag("wall") then owner.components.health:DoDelta(TUNING.BATBAT_DRAIN,false,"batbat") owner.components.sanity:DoDelta(-TUNING.BATBAT_DRAIN * 0) end what is this BATBAT stuff? I'm not sure if i should remove it or not since I don't really understand it. for now i'm leaving it be. Thanks for linking me the boomerang animation guide, i will try it out and post back with results later. lylerang.lua UPDATE: I tried making the spin_loop animation according to that thread, and it worked! I was a little intimidated at the idea of making an animation on spriter but it turned out to be pretty intuitive. Just gotta make the weapon untouchable to other characters and i'll be pretty happy with it. Edited September 22, 2019 by Proc Link to comment Share on other sites More sharing options...
Ultroman Posted September 22, 2019 Share Posted September 22, 2019 (edited) 13 hours ago, Proc said: While at it, there is one bit of code that confuses me: if owner.components.health and owner.components.health:GetPercent() < 1 and not target:HasTag("wall") then owner.components.health:DoDelta(TUNING.BATBAT_DRAIN,false,"batbat") owner.components.sanity:DoDelta(-TUNING.BATBAT_DRAIN * 0) end what is this BATBAT stuff? I'm not sure if i should remove it or not since I don't really understand it. for now i'm leaving it be. What this code says, is if the owner has less than maximum health and the thing that was hit is not a wall, the owner RECEIVES health equal to the damage of a Batbat (it's a weapon) which deals (34 * 0.2 = 6.8) damage, and the owner then LOSES sanity equal to (6.8 * 0 = 0) I'm guessing this was some random numbers put in there for some reason, perhaps for testing? I don't know. I would never use TUNING variables like this, because any mod can just change them, and then your whole mod gets changed as well. Just remove that if-statement. 13 hours ago, Proc said: UPDATE: I tried making the spin_loop animation according to that thread, and it worked! I was a little intimidated at the idea of making an animation on spriter but it turned out to be pretty intuitive. Just gotta make the weapon untouchable to other characters and i'll be pretty happy with it. That's awesome! Could you maybe post a zip of the resulting animation files here for others to find as an example? Not the compiled animations, but the files you edited. That would be a nice contribution to the community. 13 hours ago, Proc said: Just gotta make the weapon untouchable to other characters and i'll be pretty happy with it. Put this code at the bottom of your master_postinit function and change the character prefab name, and you should be happy. This code should make it so the first player with the right character prefab is made the sole owner of that item, and no one else, not even other players using the same character, can pick it up. local oldOnPickup = inst.components.inventoryitem.OnPickup inst.components.inventoryitem.OnPickup = function(self, pickupguy) if pickupguy.prefab == "YOUR_CHARACTER_PREFAB_NAME" then if not self.inst.itemowner then self.inst.itemowner = pickupguy end if pickupguy == self.inst.itemowner then oldOnPickup(self, pickupguy) elseif pickupguy.components.talker then pickupguy.components.talker:Say("That item is not mine.") end elseif pickupguy.components.talker then pickupguy.components.talker:Say("I cannot wield that.") end end Edited September 22, 2019 by Ultroman 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