Cuberite Forum
Random spwn items - Printable Version

+- Cuberite Forum (https://forum.cuberite.org)
+-- Forum: Plugins (https://forum.cuberite.org/forum-1.html)
+--- Forum: Plugin Requests (https://forum.cuberite.org/forum-3.html)
+--- Thread: Random spwn items (/thread-2926.html)

Pages: 1 2


Random spwn items - Boo - 03-22-2017

Hello, i need a plugin to random spawn items in the zones of the world


RE: Random spwn items - Boo - 05-14-2017

can any help ? need to make random spawner items, how to do this ??


RE: Random spwn items - Seadragon91 - 05-14-2017

You can use cWorld:SpawnItemPickups to spawn items at passed coords.
When do you want to spawn the items? Command, hook, scheduler?


RE: Random spwn items - Boo - 05-14-2017

i want to spawn random item list in random places of the world. where i set random spawner item


RE: Random spwn items - xoft - 05-14-2017

There's nothing in Cuberite that would spawn random items at regular intervals. You need to implement that. So you need to:
1. Create a function that is called regularly, using cWorld:ScheduleTask()
2. In that function, decide on the random coords and item type (math.random()) and spawn the pickup (cWorld:SpawnItemPickups())


RE: Random spwn items - Seadragon91 - 05-14-2017

@xoft I just see that SpawnItemPickups doesn't return anything. Could be useful for minigames.
Returning a table of entity ids should be okay.  This could be useful for plugin that wants to know when a player collects a pickup with a specific item. Also for example changing the life time of a pickup.

Edit: Just see that there is a hook named HOOK_COLLECTING_PICKUP that is triggered when a pickup is collected.

@Boo If you want I could write that plugin.


RE: Random spwn items - Boo - 05-14-2017

(05-14-2017, 05:17 AM)Seadragon91 Wrote: @Boo If you want I could write that plugin.

Please, can you? i dont know programmins, and lua :-( i newer work with api... Undecided


RE: Random spwn items - Seadragon91 - 05-15-2017

Okay a few questions.
When should the pickup spawn?
  • A specific event occurred
  • Every few seconds
  • Command called
Where should it spawn?:
  • In a area
  • Around a area, like x = 0, y = 64, z = 0, randomly inside of a radius with 50 blocks



RE: Random spwn items - Boo - 05-16-2017

1 -Every few seconds
2 - Can you make an item named "Random Spawner" and spawn items around some radius of blocks?


RE: Random spwn items - Seadragon91 - 05-16-2017

A sign could be used as center or a command that creates the info. The plugin can then store the position and the info from the sign
Example inf on sign. Lines:
1 = [ItemSpawn]
2 = <radius>

There would be two lines left for more info.

Another question, the items:
  • A list of possible items, randomly picked from it
  • Read from a Ini file