Beefy Kasplant Posted April 1, 2020 Posted April 1, 2020 Make loot drops 'explode' from the NPC / Player that got killed. Â Instead of all loot falling on one tile, make it possible for loot to drop in all tiles surrounding the killed entity and the one the entity was on. Â Hitz 1
0 Cheshire Posted April 1, 2020 Posted April 1, 2020 I'm fiddling with this between work, but JC mentioned that in Resources.cs on the server there's a method SpawnResourceItems that has a piece of logic that can almost be copied verbatim for this request if anyone feels like taking a crack at it before I can finish it.  EDIT: I've made a patch that does exactly this:  public void SpawnResourceItems(Entity killer) { //Find tile to spawn items var tiles = new List<TileHelper>(); for (var x = X - 1; x <= X + 1; x++) { for (var y = Y - 1; y <= Y + 1; y++) { var tileHelper = new TileHelper(MapId, x, y); if (tileHelper.TryFix()) { //Tile is valid.. let's see if its open var map = MapInstance.Get(tileHelper.GetMapId()); if (map != null) { if (!map.TileBlocked(tileHelper.GetX(), tileHelper.GetY())) { tiles.Add(tileHelper); } else { if (killer.MapId == tileHelper.GetMapId() && killer.X == tileHelper.GetX() && killer.Y == tileHelper.GetY()) { tiles.Add(tileHelper); } } } } } } if (tiles.Count > 0) { TileHelper selectedTile = null; //Prefer the players tile, otherwise choose randomly for (var i = 0; i < tiles.Count; i++) { if (tiles[i].GetMapId() == killer.MapId && tiles[i].GetX() == killer.X && tiles[i].GetY() == killer.Y) { selectedTile = tiles[i]; } } if (selectedTile == null) { selectedTile = tiles[Globals.Rand.Next(0, tiles.Count)]; } // Drop items foreach (var item in Items) { if (ItemBase.Get(item.ItemId) != null) { MapInstance.Get(selectedTile.GetMapId()) .SpawnItem(selectedTile.GetX(), selectedTile.GetY(), item, item.Quantity); } } } Items.Clear(); }  Beefy Kasplant, George and jcsnider 3
Question
Beefy Kasplant
Make loot drops 'explode' from the NPC / Player that got killed.
Â
Instead of all loot falling on one tile, make it possible for loot to drop in all tiles surrounding the killed entity and the one the entity was on.
Â
2 answers to this question
Recommended Posts