Sign in to follow this  
Cunning fox

Spoilage staff

Recommended Posts

Cunning fox    803

Hello! I'm trying to make a staff, that'll spoil food, when used on another player, but I've got some trouble:

  1. How to make it useable only on players
  2. 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!

  • Like 1

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites
Amalleus    13

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)

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
Amalleus    13
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

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this