. . . Posted August 24, 2016 Share Posted August 24, 2016 (edited) Hello, I need fixing something. So, I need help with this code. inst:ListenForEvent("keypressed", function(inst, data) if not inst.components.sanity:IsSane() and inst.sg:HasStateTag("taunting") then local x,y,z = inst.Transform:GetWorldPosition() local ents = TheSim:FindEntities(x, y, z, 15, {"_combat"}, {"player", "shadow", "shadowminion"}) for i,v in ipairs(ents) do if inst:HasTag("monster") then v.components.combat:SetTarget(inst) end end end end) So, the plan with this code is when my character goes into "taunting" state monsters will target him, but the problem's that they don't... And I don't know why? If I remove the "if inst:HasTag("monster") then" the only thing he will be able to provoke's beefalo ... So, I need help... Thanks for reading have a great day/night ! Edited August 25, 2016 by SuperDavid Link to comment Share on other sites More sharing options...
Serpens Posted August 24, 2016 Share Posted August 24, 2016 (edited) It seems "inst" is your character. And you do the check "if inst:HasTag("monster")" Now you should know, why it does not work The arguments of the function FindEntities are: TheSim:FindEntities(x, y, z, radius, musttags, canttags, mustoneoftags) So if you want to find things with the monster tag, add "monster" into the musttags or the mustoneoftags. If another modder reads this, I did not understand completely the difference between musttags and mustoneoftags , can someone please explain? Edited August 24, 2016 by Serpens Link to comment Share on other sites More sharing options...
. . . Posted August 25, 2016 Author Share Posted August 25, 2016 (edited) @Serpens Thank you so much! I was really confused but now I understand ! Edited August 25, 2016 by SuperDavid Link to comment Share on other sites More sharing options...
DarkXero Posted August 25, 2016 Share Posted August 25, 2016 4 hours ago, Serpens said: If another modder reads this, I did not understand completely the difference between musttags and mustoneoftags , can someone please explain? For an entity to be included in the table of entites that is returned it must: 1) Be within the radius of the position specified. 2) Have all the tags contained from the table musttags. 3) Don't have any of the tags from the table canttags. 4) Have at least one tag from the table mustoneoftags. 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