Cunning fox Posted February 28, 2017 Share Posted February 28, 2017 Hello! I'm trying to make a staff, that'll spoil food, when used on another player, but I've got some trouble: How to make it useable only on players It's not working Yeah, when it used, character says that he can't do it, and nothing happens :\ . My prefab is here: staffs.lua Thanks everyone for your replies! If you'll help me, I can give you Striking Tuxedo! 1 Link to comment Share on other sites More sharing options...
RedHairedHero Posted March 2, 2017 Share Posted March 2, 2017 Are you using this in PvP? I don't know if you can target other characters outside of PvP. A good example of this would be The Medic mod on Steam since he uses Health Darts on other players, but it can only be used in PvP. Link to comment Share on other sites More sharing options...
Amalleus Posted March 2, 2017 Share Posted March 2, 2017 1. Get entity under your cursor and if it will be player then do stuff which you need. (Point) 2. Get your cursor position and find entities in these position in some radius. Filter these entities and if it will be player then do stuff which you need. (AoE) Link to comment Share on other sites More sharing options...
RedHairedHero Posted March 2, 2017 Share Posted March 2, 2017 7 hours ago, Amalleus said: 1. Get entity under your cursor and if it will be player then do stuff which you need. (Point) 2. Get your cursor position and find entities in these position in some radius. Filter these entities and if it will be player then do stuff which you need. (AoE) Only problem I could see with the entity under cursor would be if the player is using a controller or if the staff is created like a weapon and you're using Control + F to force attack. AoE would be nice, if it hit multiple targets you could just count the amount hit by it and subtract the staff's uses by that amount, seems like it would be an easier approach. Link to comment Share on other sites More sharing options...
Amalleus Posted March 2, 2017 Share Posted March 2, 2017 14 minutes ago, RedHairedHero said: Only problem I could see with the entity under cursor would be if the player is using a controller or if the staff is created like a weapon and you're using Control + F to force attack. AoE would be nice, if it hit multiple targets you could just count the amount hit by it and subtract the staff's uses by that amount, seems like it would be an easier approach. AoE will be something like that: local pt = TheInput:GetWorldPosition() local ents = TheSim:FindEntities(pt, 4) for k, v in pairs(ents) do --filtering entities by your choise --and applying your spell end this is in Spell function 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