BakaSchwarz Posted September 17, 2018 Share Posted September 17, 2018 Greetings! I try to get the following to work: I have an item that should have an effect around it. It's an orb and wherever it is, a fog should surround it. So if a player takes the orb, the fog is around the player, if the orb is in a chest, it should surround the chest, etc. I get the entity that has the orb (if any) by calling inst.inventoryitem:GetGrandOwner() In the case of nil, there simply is no owner and i use the coordinates of the orb itself instead. A workaround for backpacks is in the works (as they do not count as GrandOwner when placed on the ground), but that's not the issue here. My problem is, that i do not know how to bind the location of the fog to another entity. As of now, i know the following (not ideal) solutions: 1. Use SetParent to attach the fog to the relevant entity (player, chest, orb, etc.). This is not ideal, because the fog changes directions, when a player turns around, which looks stupid. Also if the player scales (like wolfgang getting mighty) then the fog increases in size as well, which is problematic, because the fog indicates the range in which the orb functions. 2. Use a DoPeriodicTask(0, function) and make use of Transform:SetPosition to set the fog coordinates. This works well if nothing is going on in the world, but if you play with lots of entities, it is often the case, that the fog lags behind the holder of the orb. I don't know of any other way to solve the problem at hand. In the best case it works like SetParent, but it does not scale and changes direction, when the parent does so. Any ideas? Link to comment Share on other sites More sharing options...
sanydade Posted July 18, 2020 Share Posted July 18, 2020 hy seems like you know how make a new placeable structure, may you help me with my mod ? Link to comment Share on other sites More sharing options...
Developer zarklord_klei Posted July 19, 2020 Developer Share Posted July 19, 2020 Do a combination of 1 and 2, do the periodic task, but set the rotation to -rotation of the parent object, same with scale, set it to 1/parentscale. 1 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