Jump to content

LoveBot

Member
  • Posts

    3
  • Joined

  • Last visited

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

LoveBot's Achievements

  1. Thanks. I think I'll go with Events.EveryMinute for now and check if the tile exists. I'll add a flag to make sure it only spawns once. That's what I'll probably do until I find a better option. Thanks for your feedback, mate. Your suggestion led me in a good direction. At least now I have an almost perfect solution I'll post my solution here later as reference for anyone who finds the same problem. If anyone else has any better ideas, please let me know.
  2. Thanks for the reply. The problem with Events.EveryHours, I assume, is that if the player goes to that location after the tile loads but before the hour "ticks", the item will not be there. But I can test for that. I'll check the mods you suggested. But aren't there any mods that simply spawn items on a place at the beginning of the game? I tried to find a mod that does this and use it as example, but I could find none.
  3. Hello everyone. I'm trying to spawn an item at a very specific location in the world (x: 5548, y: 12469, z: 0) when the game starts, but strangely, I'm unable to. I saw a lot of posts in this forum, and only found two "solutions". This one: Which makes use of getOrCreateGridSquare() which sounds great but doesn't work. With this solution, I tried a lot of hooks from this list: https://pzwiki.net/wiki/Category:Lua_Events But the problem is, it only works for grid squares that are near the player (I'm assuming the system only loads the grid squares as needed, which makes sense. But then again, getOrCreateGridSquare() should work anyways, because I'm forcing the creation of the grid square, right?). I also tried this solution: Which seems to check coordinates every time a grid square is spawned, which is honestly crazy and very bad for performance. How do you usually do something like this? Shouldn't it be very simple? What am I getting wrong? Sorry for not posting my code. That is because I tried a lot of different solutions. But in case you really need something, here's a simplified version of one fo my attempts: CVM.spawn = function() local x, y, z = 5548, 12469, 0; local sq = getCell():getOrCreateGridSquare(x, y, z); sq:AddWorldInventoryItem("Base.Axe", 0, 0, 0); end Events.OnCGlobalObjectSystemInit.Add(CVM.spawn) Thank you for your help.
×
×
  • Create New...