Jump to content

Spoilage staff


Recommended Posts

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

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

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

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

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
 Share

×
  • Create New...