PDA

View Full Version : Opinions on my new project


Criimson
07-20-2011, 02:27 PM
Hello everyone
So last night I was tinkering with an idea Ive had for several days.
Basically I run one character and wanted to mess with JC. So the idea came to look into having my chanter bot be able to enchant my silver. The idea was to hold a single bar of silver on my cursor and type #bot enchant silver. After I had that working add the other chants.

Here is the code and it works as it is supposed to (sort of)

//Enchant Metals
if(!strcasecmp(sep->arg[1], "enchant")) {
if(c->IsGrouped()){
bool hasenchanter = false;
Group *g = c->GetGroup();
for(int i=0; i<MAX_GROUP_MEMBERS; i++){
if(g && g->members[i] && g->members[i]->IsBot()) {
uint8 casterlevel = g->members[i]->GetLevel();
uint8 casterclass = g->members[i]->GetClass();
if (casterclass == ENCHANTER){
if(!strcasecmp(sep->arg[2], "silver")){
if (casterlevel >= 7){
g->members[i]->Say("Enchanting your silver bar");
g->members[i]->CastSpell(30015, c->GetID(), SLOT_CURSOR);
}
else {g->members[i]->Say("I must be at least level 7 to enchant silver.");}
}
}
}
}
}
else {
c->Message(15, "You need to be grouped with an enchanter.");
}
return;
}

The problem I realized is Enchant <Metal> is a self spell. So I went into the DB and copied the spell and renamed it Bot Enchant Silver at # 500000. Made it have a range of 100. No luck.
Used Nulls editor and it really didn't do anything different except number it at 30k and allow for easy changing of the spells_us.txt

So my question:
Would you:
1) Simply create a merchant that sold enchanted metals (this is my least preferable idea)

2) Create a spell (which isn't as portable to people who can't work in the DB or spells file)

3) Write code where a player can hand the silver bar to the bot and it casts the spell and hands it back (more like live I guess anyway)

Criimson

Caryatis
07-20-2011, 03:28 PM
Spell IDs are restricted by the clients, so a titanium client can only access spells with ID under 10000, SoF is like 20K, SoD is around 24k, Underfoot is 28k and HoT is 32k. This is a client side limitation so there is nothing you can do server side to fix that(also you need to change the targettype to change a spells target requirements, just changing the range doesnt make a self only spell, single target).

The thing is though, you dont need the bot to cast a spell at all. You just need the bot to allow you to cast it, ie do all your enchanter bot checks but instead of having the bot cast the enchant metal spell, have it like:


client->CastSpell(args);


That way it would easily allow you to implement all the single target enchants as well as the mass enchants.

Criimson
07-20-2011, 03:59 PM
Spell IDs are restricted by the clients, so a titanium client can only access spells with ID under 10000, SoF is like 20K, SoD is around 24k, Underfoot is 28k and HoT is 32k. This is a client side limitation so there is nothing you can do server side to fix that(also you need to change the targettype to change a spells target requirements, just changing the range doesnt make a self only spell, single target).

The thing is though, you dont need the bot to cast a spell at all. You just need the bot to allow you to cast it, ie do all your enchanter bot checks but instead of having the bot cast the enchant metal spell, have it like:


client->CastSpell(args);


That way it would easily allow you to implement all the single target enchants as well as the mass enchants.

Yea I was looking at target type, but was confused as the drop down menu in Nulls Editor was empty. Thought maybe it was a relic or unimplimented setting.

But I like your last suggestion. I will look into doing it that way.

Thank you for the info

Criimson

Caryatis
07-20-2011, 04:18 PM
One of my updates awhile ago broke the target drop down in Nulls as I added labels to the target types in the spdat.h file. If you wish to have it functional, remove all the /* 01 xxx */ from infront of each row of the targettypes listed, or bug Null to update it.

Congdar
07-20-2011, 04:31 PM
on my server i have customized some enchanter guildmasters .pl to handle this sort of thing for the bots. they usually require you to supply the ingredients plus some plat.

Criimson
07-20-2011, 05:59 PM
on my server i have customized some enchanter guildmasters .pl to handle this sort of thing for the bots. they usually require you to supply the ingredients plus some plat.

Any chance you can send the script change to me? I am not familiar with perl and would basically add it to a GM in PoK.

Thank you
Criimson

Congdar
07-21-2011, 05:46 AM
Perl scripting for the emu is probly easier than c++ to figure out. Here's the general idea for the pok enchanter guildmaster

sub EVENT_SAY {
if($text=~/enchant silver/i or $text=~/enchanted silver/i) {
quest::say("Oh! You are interested in enchanted silver bars! I only charge 100 platinum and Four regular Silver Bars for this service. I make them Four at a time.");
}
if($text=~/thicken mana/i or $text=~/viscous mana/i) {
quest::say("Oh! You are interested in a vial of Viscous Mana! I only charge 100 platinum and a poison vial and a pearl for this service. I make them one at a time.");
}
}

sub EVENT_ITEM {
if($platinum == 100 && plugin::check_handin(\%itemcount, 16500 => 4)) {
quest::say("Ahh, here you are then.");
quest::summonitem(16504, 4);
}
elsif($platinum == 100 && plugin::check_handin(\%itemcount, 10024 => 1, 16965 => 1)) {
quest::say("Ahh, here you are then.");
quest::summonitem(10250);
}
else {
quest::say("I don't need this."); #text made up
plugin::return_items(\%itemcount);
if($platinum != 0 || $gold !=0 || $silver != 0 || $copper != 0) {
quest::givecash($copper, $silver, $gold, $platinum);
}
}
}

Criimson
07-21-2011, 01:19 PM
Perl scripting for the emu is probly easier than c++ to figure out.

Yea when looking through a couple scripts it didn't seem overly difficult. In fact it reminded me of when I modded NWN many years ago. It is more a question of time. I am pretty focused on bots atm and coding them is pretty time consuming, especially since as a hobbyist coder it takes me longer than it would a professional coder. Although sometime in the next couple of weeks my group will be in the 40s and I'll need to learn because I am going to remove the class checks on the epic quests for my server.

Congdar
07-21-2011, 01:25 PM
i did a check of the entire quest directory and i think i only found maybe 2 or 3 files that check class in relation to the epic quest. not a huge problem to fix.

bad_captain
07-21-2011, 07:18 PM
If they weren't so time consuming for what you get, I'd love to do them for my bots.. But, since I only #bot giveitem loot I have actually looted or quested, that would take a whole lot of time.. lol

I have a 32 page word document with raid targets, their loot, what I actually loot on raids and all of my bots with their equipment. Epic quests could easily double that, if not more..

Criimson
07-21-2011, 07:34 PM
Yea Im a massochist when it comes to this kind of stuff. Maybe Im nestolgic from when Kunark was released and the awesomeness of the items/quests. Being on a raid in PoFear and praying a Spirit of Shissar would drop the right item for my chanter epic (and later being like wtf..shissar are harpies in PoF and snakemen in SSra) or hanging out in Oasis for the spoon of that SandGiant that used to scare the crap out of me when sitting on the docks.