Berdryn Posted October 13, 2016 Share Posted October 13, 2016 Is it possible to have a dropped item, for example a container, to go to the center of the iso tile? Some sort of snap or push method to effect the x and y dynamically. I'm sure its possible but I haven't done much editing in lua, just scripts so far. Link to comment Share on other sites More sharing options...
Berdryn Posted October 17, 2016 Author Share Posted October 17, 2016 Does anyone know what the missing pieces are here? I feel like you should get the player's x, y because they are dropping the item, giving it their x and y values at the time of dropping. I couldn't find anything like OnDrop. I think if you can find the player x, y and detect the isoGrid it could be down with Round? Like if the player is at x 33 , y 43 then the code should detect this and round down to x 30, y 40 then write that new data to the on ground item's x and y.. I just don't really know how to continue; its like stabbing in the dark as far as testing goes. I used SciTE to test the lua, no errors so far but of course its not really doing anything yet. Anyone have any advice? Does it need a grid initialization to work off of? Here's what I have so far: CenterOnDrop = {} function CenterOnDrop(wx, wy) local wx, wy = getPlayer():getX(), getPlayer():getY(); local cell = getWorld():getCell(); local sq = cell:getGridSquare(wx, wy); end Link to comment Share on other sites More sharing options...
nolanri Posted October 19, 2016 Share Posted October 19, 2016 sq:AddWorldInventoryItem(item,0.5,0.5,0); item can be a name like "Base.Axe" or a class instance like: local item = getPlayer():getPrimaryHandItem(); the 0.5 and 0.5 are what makes it drop in the center of the tile. Link to comment Share on other sites More sharing options...
Berdryn Posted October 19, 2016 Author Share Posted October 19, 2016 14 hours ago, nolanri said: sq:AddWorldInventoryItem(item,0.5,0.5,0); item can be a name like "Base.Axe" or a class instance like: local item = getPlayer():getPrimaryHandItem(); the 0.5 and 0.5 are what makes it drop in the center of the tile. Wow thanks nolanri, is there an easier way to have this effect all dropped items? Maybe list all the items I want to drop and center in a table? I'm still learning how they work but they seem powerful. Link to comment Share on other sites More sharing options...
nolanri Posted October 20, 2016 Share Posted October 20, 2016 On 2016-10-19 at 11:13 AM, Berdryn said: Wow thanks nolanri, is there an easier way to have this effect all dropped items? Maybe list all the items I want to drop and center in a table? I'm still learning how they work but they seem powerful. No way to change the way items are dropped by default without editing base game lua. 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