grimmsdottir Posted May 15, 2015 Share Posted May 15, 2015 Hello, I created what is basically a staff for my character. It currently is able to fire bolts of energy at a target. However, I would like to know if it would be possible to make it so that the staff can also be used a melee weapon. A little bit like how Gandalf can shoot magic from his stick then beat someone else with it. Attached is my blasting stick. Thanks in advance for anyone able to chip initem_blaster.lua Link to comment https://forums.kleientertainment.com/forums/topic/53992-how-to-create-a-melee-capable-staff/ Share on other sites More sharing options...
DarkXero Posted May 15, 2015 Share Posted May 15, 2015 You make the staff as if it is a weapon, like a spear. So you can melee with it. Then you attach a component to it, like how the orange staff has blinkstaff. Then you useAddComponentAction("SCENE", myredcomponent, function(inst, doer, actions, right) if right and doer:CanDoAction(ACTIONS.ATTACK) and inst.replica.health ~= nil and not inst.replica.health:IsDead() and inst.replica.combat ~= nil and inst.replica.combat:CanBeAttacked(doer) then table.insert(actions, ACTIONS.THROWFIREBALL) endend)Then you implement THROWFIREBALL as an action that makes you go into the attack state with the cane, but spawns a fire projectile to the face of the enemy. Now you attack with left click, and throw fireballs with right click. Link to comment https://forums.kleientertainment.com/forums/topic/53992-how-to-create-a-melee-capable-staff/#findComment-637698 Share on other sites More sharing options...
grimmsdottir Posted May 16, 2015 Author Share Posted May 16, 2015 @DarkXero, thanks for responding, but I am at a complete loss as to how to work with what you said, could you explain a little as to how components work? Link to comment https://forums.kleientertainment.com/forums/topic/53992-how-to-create-a-melee-capable-staff/#findComment-637929 Share on other sites More sharing options...
Seiai Posted May 16, 2015 Share Posted May 16, 2015 (edited) @grimmsdottir, http://forums.kleientertainment.com/topic/28021-getting-started-guides-tutorials-and-examples/ Edited May 16, 2015 by Seiai Link to comment https://forums.kleientertainment.com/forums/topic/53992-how-to-create-a-melee-capable-staff/#findComment-637951 Share on other sites More sharing options...
DarkXero Posted May 16, 2015 Share Posted May 16, 2015 @grimmsdottirexample.zip Link to comment https://forums.kleientertainment.com/forums/topic/53992-how-to-create-a-melee-capable-staff/#findComment-637991 Share on other sites More sharing options...
Orim Posted June 7, 2015 Share Posted June 7, 2015 Hello,Sorry for necro'ing this but I have the exact same issue. I used the files that DarkXero provided and made the appropriate changes (spear, wilson) to fit my character. The "Cast Fireball" shows up on the item and the character gets in range of his target but nothing else happens.I clearly missed something but I cannot see what exactly. Link to comment https://forums.kleientertainment.com/forums/topic/53992-how-to-create-a-melee-capable-staff/#findComment-644692 Share on other sites More sharing options...
DarkXero Posted June 7, 2015 Share Posted June 7, 2015 @Orim, zip your mod and post it. Link to comment https://forums.kleientertainment.com/forums/topic/53992-how-to-create-a-melee-capable-staff/#findComment-644711 Share on other sites More sharing options...
Orim Posted June 7, 2015 Share Posted June 7, 2015 (edited) How silly of me. I totally forgot to do that. Here it is. This is the default, unedited version so you have something cleaner to work with.The staff is purely a ranged weapon at the moment. Flings fireballs but cannot be used in melee nor does the little fireball shows any "fire" effect upon landing. Kind of dug into the default prefabs and created a mishmash of code.char_mod.zip Edited June 7, 2015 by Orim Link to comment https://forums.kleientertainment.com/forums/topic/53992-how-to-create-a-melee-capable-staff/#findComment-644714 Share on other sites More sharing options...
DarkXero Posted June 7, 2015 Share Posted June 7, 2015 @Orim, here. Bone Thing.zip Link to comment https://forums.kleientertainment.com/forums/topic/53992-how-to-create-a-melee-capable-staff/#findComment-644724 Share on other sites More sharing options...
Orim Posted June 7, 2015 Share Posted June 7, 2015 @DarkXeroThank you very, VERY MUCH! I see how you did it and it makes perfect sense. I had the biggest problems making ranged weapons but thanks to you, it is much clearer now Link to comment https://forums.kleientertainment.com/forums/topic/53992-how-to-create-a-melee-capable-staff/#findComment-644727 Share on other sites More sharing options...
DarkXero Posted June 7, 2015 Share Posted June 7, 2015 @Orim,there are two ways to make ranged weapons. You can make them like a staff, where you attach a projectile to the attack.Or you make it like a boomerang, where you make the weapon the projectile. What I did is add a third way, I added a ranged functionality to a melee weapon, to have a melee/ranged weapon. Link to comment https://forums.kleientertainment.com/forums/topic/53992-how-to-create-a-melee-capable-staff/#findComment-644729 Share on other sites More sharing options...
Orim Posted June 7, 2015 Share Posted June 7, 2015 Sheesh! Ranged weapons are so much more complicated than melee! Thanks for the insight ; I'll keep on learning ^^ Link to comment https://forums.kleientertainment.com/forums/topic/53992-how-to-create-a-melee-capable-staff/#findComment-644733 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