ServUO Version
Publish 57
Ultima Expansion
None
I made him create this script, I like the RPG very much, it is for me the last online of rpg is limited and therefore I want to implement it with many more things that will make it much more beautiful in my opinion I made the human world generate me with diseases, but it is not perfect it always gives me mistakes maybe it is me who does not explain what I want but the scripts do them, and he makes complex ones but they are not perfect
using System;
using System.Collections.Generic;
using Server;
using Server.Items;
using Server.Mobiles;

namespace Server
{
public class DiseaseSystem
{
private static List<string> diseaseNames = new List<string>
{
"Fever of the Night",
"Crimson Plague",
"Wasting Sickness",
"Rotting Flesh",
"Coughing Curse",
"Blight of the Undead",
"Chill of the Grave",
"Pestilence",
"Miasma",
"Sorrow's Affliction"
};

private static List<string> potionNames = new List<string>
{
"Elixir of Vitality",
"Potion of Restoration",
"Tonic of Health",
"Balm of the Healer",
"Syrup of Renewal",
"Vial of Purity",
"Draught of Recovery",
"Infusion of Life",
"Nectar of the Gods",
"Philter of the Phoenix"
};

public static void Initialize()
{
Timer.DelayCall(TimeSpan.FromMinutes(1), CheckForDiseases);
CreateDoctorVendors();
}

private static void CreateDoctorVendors()
{
// Create vendors in various cities
string[] cities = { "Britain", "Moonglow", "Trinsic", "Yew", "Skara Brae" };
foreach (string city in cities)
{
Random rand = new Random();
string doctorName = "Doctor " + RandomName();
DoctorVendor vendor = new DoctorVendor(doctorName);
vendor.Location = GetRandomLocationInCity(city);
vendor.Map = Map.Felucca; // Change to appropriate map
vendor.AddToWorld();
}
}

private static void CheckForDiseases()
{
foreach (Mobile mobile in World.Mobiles.Values)
{
if (mobile is PlayerMobile player && player.Alive)
{
if (player.HasDisease)
{
// Check if the disease duration has expired
if (DateTime.UtcNow >= player.DiseaseEndTime)
{
player.CureDisease();
}
else
{
// Random chance of dying from the disease
if (Utility.RandomDouble() < 0.05) // 5% chance to die
{
player.Kill();
}
}
}
else if (Utility.RandomDouble() < 0.01) // 1% chance to get sick
{
player.GetSick();
}
}
}

Timer.DelayCall(TimeSpan.FromMinutes(1), CheckForDiseases);
}

private static Point3D GetRandomLocationInCity(string city)
{
// Implement logic to return a random Point3D within the specified city
return new Point3D(0, 0, 0); // Placeholder
}

private static string RandomName()
{
return "RandomName"; // Implement logic to generate a random name
}
}

public class DoctorVendor : BaseVendor
{
public DoctorVendor(string name) : base(name)
{
AddPotionItems();
}

private void AddPotionItems()
{
foreach (string potionName in DiseaseSystem.potionNames)
{
AddItem(new CurePotion(potionName));
}
}
}

public class PlayerMobile : Mobile
{
public bool HasDisease { get; set; }
public DateTime DiseaseEndTime { get; set; }

public void GetSick()
{
HasDisease = true;
DiseaseEndTime = DateTime.UtcNow.AddDays(Utility.Random(3, 5)); // Random duration between 3 to 7 days
// Assign a random disease name
string diseaseName = DiseaseSystem.diseaseNames[Utility.Random(DiseaseSystem.diseaseNames.Count)];
// Notify player of the disease
SendMessage($"You have contracted {diseaseName}!");
}

public void CureDisease()
{
HasDisease = false;
SendMessage("You have recovered from your illness.");
}
}

public class CurePotion : Item
{
public CurePotion(string name) : base(0x0F0C) // Use appropriate item ID
{
Name = name;
Weight = 1.0;
}
}
}
 
You are trying to make too complex of a system with a single prompt. ChatGPT can only spit out so much code, so you need to break each part of the disease system down into parts.
 
You are trying to make too complex of a system with a single prompt. ChatGPT can only spit out so much code, so you need to break each part of the disease system down into parts.
I have recently been using this tool and your advice will help me to use it better, I have ideas for scripts for role-playing games but I am not familiar with ChatGPT
Se stai cercando un sistema di malattia, per ref, uso o modifica con l'intelligenza artificiale : Sickness System 101
Sì, come è realmente accaduto nel Medioevo
 
I made him create this script, I like the RPG very much, it is for me the last online of rpg is limited and therefore I want to implement it with many more things that will make it much more beautiful in my opinion I made the human world generate me with diseases, but it is not perfect it always gives me mistakes maybe it is me who does not explain what I want but the scripts do them, and he makes complex ones but they are not perfect
using System;
using System.Collections.Generic;
using Server;
using Server.Items;
using Server.Mobiles;

namespace Server
{
public class DiseaseSystem
{
private static List<string> diseaseNames = new List<string>
{
"Fever of the Night",
"Crimson Plague",
"Wasting Sickness",
"Rotting Flesh",
"Coughing Curse",
"Blight of the Undead",
"Chill of the Grave",
"Pestilence",
"Miasma",
"Sorrow's Affliction"
};

private static List<string> potionNames = new List<string>
{
"Elixir of Vitality",
"Potion of Restoration",
"Tonic of Health",
"Balm of the Healer",
"Syrup of Renewal",
"Vial of Purity",
"Draught of Recovery",
"Infusion of Life",
"Nectar of the Gods",
"Philter of the Phoenix"
};

public static void Initialize()
{
Timer.DelayCall(TimeSpan.FromMinutes(1), CheckForDiseases);
CreateDoctorVendors();
}

private static void CreateDoctorVendors()
{
// Create vendors in various cities
string[] cities = { "Britain", "Moonglow", "Trinsic", "Yew", "Skara Brae" };
foreach (string city in cities)
{
Random rand = new Random();
string doctorName = "Doctor " + RandomName();
DoctorVendor vendor = new DoctorVendor(doctorName);
vendor.Location = GetRandomLocationInCity(city);
vendor.Map = Map.Felucca; // Change to appropriate map
vendor.AddToWorld();
}
}

private static void CheckForDiseases()
{
foreach (Mobile mobile in World.Mobiles.Values)
{
if (mobile is PlayerMobile player && player.Alive)
{
if (player.HasDisease)
{
// Check if the disease duration has expired
if (DateTime.UtcNow >= player.DiseaseEndTime)
{
player.CureDisease();
}
else
{
// Random chance of dying from the disease
if (Utility.RandomDouble() < 0.05) // 5% chance to die
{
player.Kill();
}
}
}
else if (Utility.RandomDouble() < 0.01) // 1% chance to get sick
{
player.GetSick();
}
}
}

Timer.DelayCall(TimeSpan.FromMinutes(1), CheckForDiseases);
}

private static Point3D GetRandomLocationInCity(string city)
{
// Implement logic to return a random Point3D within the specified city
return new Point3D(0, 0, 0); // Placeholder
}

private static string RandomName()
{
return "RandomName"; // Implement logic to generate a random name
}
}

public class DoctorVendor : BaseVendor
{
public DoctorVendor(string name) : base(name)
{
AddPotionItems();
}

private void AddPotionItems()
{
foreach (string potionName in DiseaseSystem.potionNames)
{
AddItem(new CurePotion(potionName));
}
}
}

public class PlayerMobile : Mobile
{
public bool HasDisease { get; set; }
public DateTime DiseaseEndTime { get; set; }

public void GetSick()
{
HasDisease = true;
DiseaseEndTime = DateTime.UtcNow.AddDays(Utility.Random(3, 5)); // Random duration between 3 to 7 days
// Assign a random disease name
string diseaseName = DiseaseSystem.diseaseNames[Utility.Random(DiseaseSystem.diseaseNames.Count)];
// Notify player of the disease
SendMessage($"You have contracted {diseaseName}!");
}

public void CureDisease()
{
HasDisease = false;
SendMessage("You have recovered from your illness.");
}
}

public class CurePotion : Item
{
public CurePotion(string name) : base(0x0F0C) // Use appropriate item ID
{
Name = name;
Weight = 1.0;
}
}
}
I agree with everyone in what they have said. New to modifying. Prompts can only do so much. If you have one file that does too much it could cause slowdowns when its triggered as well. I learned that tonight when i had a huge complex script but when it triggered it caused a slight delay (it trigged often). Curious how this turns out for you.
 

Active Shards

Donations

Total amount
$0.00
Goal
$1,000.00
Back