Go Back   EQEmulator Home > EQEmulator Forums > Quests > Quests::Q&A

Quests::Q&A This is the quest support section

Reply
 
Thread Tools Display Modes
  #1  
Old 08-10-2007, 11:36 AM
moydock
Discordant
 
Join Date: Jun 2005
Posts: 286
Default setting coin on death

I'm trying to set coin on a mob as you would in the database normally but i want excessive amounts of copper and silver to drop. Here's my code, seems to be doing nothing.

I also want to make different amounts drop, is there an easy way to do that? I was thinking I would make a different amount drop for each minute of the hour on ingame time or something ^^.

sub EVENT_DEATH
{
quest::SetCash(115, 30, 1, 0);
}
__________________
-Croup (the rogue)
Creator of Pandemic (PvP-Racewars)
Reply With Quote
  #2  
Old 08-10-2007, 02:05 PM
John Adams
Demi-God
 
Join Date: Jul 2006
Posts: 1,552
Default

There is certainly an explosion of "Opening Posts" going on here lately. Hungry little Emu'ers...

Where are you getting quest::SetCash(); as a valid command? I do not see that in the lexicon, though it is a little outdated.
Reply With Quote
  #3  
Old 08-10-2007, 04:08 PM
moydock
Discordant
 
Join Date: Jun 2005
Posts: 286
Default

I found it on this page http://www.eqemulator.net/wiki/wikka...a=QuestObjects
figured i'd give it a try although i wasn't sure if it actually was a command. I know i can use "quest::givecash ();" but that wasn't really what i wanted.
__________________
-Croup (the rogue)
Creator of Pandemic (PvP-Racewars)
Reply With Quote
  #4  
Old 08-10-2007, 04:42 PM
John Adams
Demi-God
 
Join Date: Jul 2006
Posts: 1,552
Default

Holy crap! How did I never find that Wiki in a year of using the hell out of it? Thanks, man. I never even knew about all those questobjects (most I have done with quests really is fix things that were broken)

Wow, what a busy weekend you just created for me.
Reply With Quote
  #5  
Old 08-10-2007, 08:35 PM
moydock
Discordant
 
Join Date: Jun 2005
Posts: 286
Default

lol. Yeah i've just been doing the most basic things with quests so far, wasn't till now that i needed more. So should "quest::SetCash(115, 30, 1, 0);" work? b/c it doesn't...
__________________
-Croup (the rogue)
Creator of Pandemic (PvP-Racewars)
Reply With Quote
  #6  
Old 08-11-2007, 05:20 AM
John Adams
Demi-God
 
Join Date: Jul 2006
Posts: 1,552
Default

I'll see if I can look through the source today to see what's up. I am not very familiar with the whole perl/script part of the code though.
Reply With Quote
  #7  
Old 08-12-2007, 04:42 AM
Secrets's Avatar
Secrets
Demi-God
 
Join Date: May 2007
Location: b
Posts: 1,449
Default

Easy way to do this is mincash and maxcash in the database. The values are in copper, so if you wanted all of that npc_type to drop between 100 and 300 plat, you'd use mincash value as 100 and maxcash as 300.

There's no need for perl, it's easier to do it in SQL.

Also, John, bleh added those recently, they are cut out from KMRA. Really neat commands.
Reply With Quote
  #8  
Old 08-12-2007, 10:51 AM
moydock
Discordant
 
Join Date: Jun 2005
Posts: 286
Default

Quote:
Originally Posted by Secrets View Post
Easy way to do this is mincash and maxcash in the database. The values are in copper, so if you wanted all of that npc_type to drop between 100 and 300 plat, you'd use mincash value as 100 and maxcash as 300.

There's no need for perl, it's easier to do it in SQL.

Also, John, bleh added those recently, they are cut out from KMRA. Really neat commands.
Yeah that would make 1-3 plat drop, I want like 100-300 copper to drop. Do you know how i could get that "quest::SetCash();" working? I think that might do it. I would just make it ondeath and it would put the cash on the npc's corpse, right?
__________________
-Croup (the rogue)
Creator of Pandemic (PvP-Racewars)
Reply With Quote
  #9  
Old 08-12-2007, 12:06 PM
Secrets's Avatar
Secrets
Demi-God
 
Join Date: May 2007
Location: b
Posts: 1,449
Default

Quote:
Originally Posted by moydock View Post
Yeah that would make 1-3 plat drop, I want like 100-300 copper to drop. Do you know how i could get that "quest::SetCash();" working? I think that might do it. I would just make it ondeath and it would put the cash on the npc's corpse, right?
Oh, sorry, I wasn't thinking straight.

You just want copper to drop, right?

Yeah you're gonna need to use a quest I think heh. There was a way without quests, I swear there was.
Let me take a look at the quest commands.

EDIT: $corpse->SetCash(in_copper, in_silver, in_gold, in_platinum)

So it would be...

Code:
sub EVENT_DEATH


my $cash = int(rand(300)+100);
{
$corpse->SetCash($cash,0,0,0);
}
And you'd have to have a random amount of cash, so you'd use a random integer between 100 and 300 with the $cash variable.

Should work in theory.

Last edited by Secrets; 08-12-2007 at 08:18 PM..
Reply With Quote
  #10  
Old 08-12-2007, 02:55 PM
moydock
Discordant
 
Join Date: Jun 2005
Posts: 286
Default

Woot, exactly what i want but no worky unfortunately.
__________________
-Croup (the rogue)
Creator of Pandemic (PvP-Racewars)
Reply With Quote
  #11  
Old 10-16-2007, 11:17 AM
moydock
Discordant
 
Join Date: Jun 2005
Posts: 286
Default

Anyone know how I could get this working? Still would really like to be able to do this.

Code:
sub EVENT_DEATH


my $cash = int(rand(300)+100);
{
$corpse->SetCash($cash,0,0,0);
}
__________________
-Croup (the rogue)
Creator of Pandemic (PvP-Racewars)
Reply With Quote
  #12  
Old 11-05-2007, 04:31 PM
wwazman
Sarnak
 
Join Date: Oct 2007
Location: Oregon
Posts: 37
Default

well, dunno about the guide linked to, but IN THE GAME, it goes BACKWARDS of what you have typed.. it goes "Plat, Gold, Silver, Copper"..

The way I've been doing it (with a hotbutton INGAME)..have the character targeted ... #npcloot money 34664 0 0 0 (and hit enter)
(that's 34664 plat, 0 gold, 0 silver and 0 copper)

if you want this to be a permanent change, you can do #npcspawn update (and hit enter) and the next time it spawns, it will spawn with those changes (you can also do, right now, #depopzone and then #repop to get it to respawn)

Sorry if that's not what you are looking for, ... I found these commands ingame using #help
Reply With Quote
  #13  
Old 01-14-2008, 10:19 AM
AndMetal
Developer
 
Join Date: Mar 2007
Location: Ohio
Posts: 648
Default

I think this might be a misunderstanding of the original source.

To start, the headers for the commands are located in the utils/perlxs directory and the actual source for the commands is in the zone directory. If you search through all of the header files (*.h), SetCash() is defined in PlayerCorpse.h:
Code:
SetCash(int16 in_copper, int16 in_silver, int16 in_gold, int16 in_platinum);
So, it looks like the resource should read "Player Corpse" instead of "Corpse". This can be seen in action using this example:
Code:
sub EVENT_SAY {
	if($text=~/Hail/i) {
		my $cash = int(rand(300)+100);
		my $copperstart = $npc->GetCopper();
		quest::say("Right now, I have $copperstart copper");
		quest::say("Giving myself $cash copper.");
		$npc->SetCash($cash,0,0,0);
		my $copperend = $npc->GetCopper();
		quest::say("According to GetCopper, I have $copperend copper.");
	}
}
The quest stops executing at $npc->SetCash:
Quote:
You say, 'Hail, Copper Dropper
Copper Dropper says, 'Right now, I have 0 copper'
Copper Dropper says 'Giving myself 391 copper.'
So now, we probably want to look at mob.h or npc.h. It looks like mob.h definitions concentrate on NPCs that are aggroed, so I'll focus on npc.h. Here are a few excerpts:
Code:
AddCash(int16 in_copper, int16 in_silver, int16 in_gold, int16 in_platinum);
GetCopper()		{ return copper; }
SetCopper(uint32 amt)		{ copper = amt; }
So, if I just change SetCash to AddCash, the script excecutes like normal:
Quote:
You say, 'Hail, Copper Dropper
Copper Dropper says, 'Right now, I have 0 copper'
Copper Dropper says 'Giving mysqlf 246 copper.'
Copper Dropper says 'According to GetCopper, I have 246 copper.'
Auto attack is on.
You crush Copper Dropper for 7726 points of damage.
You have slain Copper Dropper!
You receive 246 copper from the corpse.
So now that the NPC is actually getting the copper, let's see how it will work when we change it to excecute on death:
Code:
sub EVENT_DEATH {
	my $cash = int(rand(300)+100);
	my $copperstart = $npc->GetCopper();
	quest::say("Right now, I have $copperstart copper");
	quest::say("Giving myself $cash copper.");
	$npc->AddCash($cash,0,0,0);
	my $copperend = $npc->GetCopper();
	quest::say("According to GetCopper, I have $copperend copper.");
}
Quote:
Auto attack is on.
You crush Copper Dropper for 2528 points of damage.
You have slain Copper Dropper!
Copper Dropper says 'Right now, I have 0 copper'
Copper Dropper says 'Giving mysqlf 271 copper.'
Copper Dropper says 'According to GetCopper, I have 271 copper.'
However, upon looting, there is no copper on the corpse.

In conclusion, if you change SetCash to AddCash, it will work IF you add it while the NPC is still alive. EVENT_SPAWN is probably the best place for it, so this is the code you should use:
Code:
sub EVENT_SPAWN {
	$npc->AddCash(int(rand(300)+100),0,0,0);
}
__________________
GM-Impossible of 'A work in progress'
A non-legit PEQ DB server
How to create your own non-legit server

My Contributions to the Wiki
Reply With Quote
  #14  
Old 01-14-2008, 10:46 AM
moydock
Discordant
 
Join Date: Jun 2005
Posts: 286
Default

Damn, you are good! Thanks a bunch man. Damn excited to have this finally solved. And great info on how you solved it too, didn't know all that was in the code.
__________________
-Croup (the rogue)
Creator of Pandemic (PvP-Racewars)
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

   

All times are GMT -4. The time now is 01:18 PM.


 

Everquest is a registered trademark of Daybreak Game Company LLC.
EQEmulator is not associated or affiliated in any way with Daybreak Game Company LLC.
Except where otherwise noted, this site is licensed under a Creative Commons License.
       
Powered by vBulletin®, Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3