Unique Spawn Logging

I made a list of the events for a reason.

EVENT_UNIQUE_SPAWN = 0 # data = monster name
EVENT_HUNTER_SPAWN = 1 # data = player name (includes traders)
EVENT_THIEF_SPAWN = 2 # data = player name
EVENT_TRANSPORT_DIED = 3 # data = transport id (includes horses)
EVENT_PLAYER_ATTACKING = 4 # data = player name
EVENT_RARE_DROP = 5 # data = item model (equippable only)
EVENT_ITEM_DROP = 6 # data = item model (equippable only)
EVENT_DIED = 7 # data = empty string
EVENT_ALCHEMY_FINISHED = 8 # data = empty string

def handle_event(t, data):
		log('%s spawned' % (data))

Well been running this now for 35min and not a single log yet … even tho a lot of uniques appeared already. What am I doing wrong?

from phBot import *

# Called for specific events. data field will always be a string.
def handle_event(t, data):
		log('%s spawned' % (data))

log('Loaded plugin!')

From my experience the event is only triggered if a unique spawns close to you.

Correct. It’s not based off the notice.

So you are looking for something like this?

from phBot import *


# All packets received from Silkroad will be passed to this function
# Returning True will keep the packet and False will not forward it to the game server
def handle_joymax(opcode, data):
		byte type
		if type == 5:
			byte unkByte
			uint uniqueModelID
			// Do stuffs
			unique = get_monster(int(uniqueModelID))
			log("["+unique['name']+"] appeared.")
		elif type == 6:
			byte unkByte
			uint uniqueModelID
			ushort killerNameLength
			ascii killerName
			// Do stuffs
			unique = get_monster(int(uniqueModelID))
			log("["+unique['name']+"] killed by ["+killerName+"]")
	return True

It doesn’t work actually, but you will figure out all the rest, I left at my sources examples about how to.


I got it working - thanks!

However the next step is sending it to Discord via a webhook.
Somehow whenever I wanna import anything within my script then it is not loading anymore by phbot.

For example if i write import aiohttp on top of the script then it is failing to load

I guess aiohttp is not available in the phbot python lib.
If it is not available, you need to install it yourself.
Check the following post of lucius, may it helps you.

I have done that already. However I still can’t load the script if i import aiohttp.

this is my phBot Testing\Plugins\python34\Lib directory

Plugin: uniques.py has failed to load

I tried to remove the json folder from python34/Libs and then import json in a plugin file.
It is still loading … how can that be?

Sorry, I just started with python as well. I can´t help you further anymore :frowning:

It is working - forgot to check back :smiley:

Logging Globals:

Logging Unique Kills and Unique Spawns:

Logging WTT-WTS-WTB from Globals:

Logging Job (also ingame pm)

This is unique af - took me quite a while to code it


It shows exact spot where unique spawns?

Looks great!


The cool thing is that it works in literally every server <3

hello :slight_smile:
How you do this ? for log job ? it’s your specific plugin ?

Dostum, tam olarak nasıl çalışıyor. Mesela: UNiq, olarak Demon keseceksin o bölgede olduğun sürece sana bildirimi geliyor. Yoksa haritayı açtığında her zaman UNİQ bulunduğu noktayı gösteriyor mu? Birde illa discord kullanmak mı gerek. Cevab verirsen. Sevinirim.

Dude, how exactly does it work? As UNiq, you will cut Demon when you are in that area, you receive a notification. Or does it always show where UNIQ is located when it opens the map? Need to use Discord. If you answer. I’m glad.

You’ll never know the unique locations spawn, that information is not sent to the client, only if you are near them. The same rule apply to all players, mobs, npc, objects, etc.

As I understand it, if there is a UNIQ nearby, make a sound notification. A command like this, but this command points to the UNiQ point on the map.