This morning I was playing with AI and thought, I wonder if AI would be able to create a custom mob for someone to plug into their server? I have no idea about the format these days for the db, but it’s interesting that AI thought it could do this with no problem, and just started spitting out code. I only gave it two stats to use, just to see what it would do with it. Here are the results.
Code:
import eqemu
# Configure your database connection
db = eqemu.connect('your_database')
def spawn_monster(zone, hitpoints, strength, db_id):
# Define the SQL query to insert a new NPC into the database
query = f"""
INSERT INTO npc_types (id, name, level, hp, strength, zone)
VALUES ({db_id}, 'Monster', 1, {hitpoints}, {strength}, '{zone}');
"""
# Execute the SQL query
db.execute(query)
print(f"Monster spawned in zone {zone} with {hitpoints} hitpoints and {strength} strength.")
# Replace 'current_zone' with your current zone identifier
current_zone = 'forest' # Example zone
monster_hp = 10000
monster_strength = 500
database_id = 2000
# Call the function to spawn the monster
spawn_monster(current_zone, monster_hp, monster_strength, database_id)
To get this, I typed:
I need a py script for eqemulator that spawns a monster in the current zone, with 10000 hitpoints and 500 strength, and the database id will be 2000
Obviously this needs a lot more input than I gave it, but the premise is still interesting. I wonder if you could use it for code for the server itself as well.