View Full Version : Item Scaling help
helman
01-31-2012, 01:36 AM
Ok I'm trying to use sub EVENT_SCALE_CALC But I'm confused as hell even after using
sub EVENT_SCALE_CALC
{
if (defined($qglobals{titanium_relic})) {
$questitem->SetScale($qglobals{titanium_relic}/10);
}
else {
$questitem->SetScale(0);
}
}
as a reference. I asked Trevius and he said I all need to do is use an item charmfile script. Then use qglobals to track whatever it is I'm wanting to use for scaling the item. That helps a lot. But I don't know how to use qglobals. Like I'm wanting to to use a custom item I named Rift Shards for scaling up my epics. If someone could Help me out I'd me most happy.
This is what I have.
sub EVENT_SCALE_CALC {
if (defined($qglobals{132481})) {
$questitem->SetScale($qglobals{132481}/1500);
}
else {
$questitem->setscal(0);
}
}
But I think thats wrong I don't even know what I set it to use for the Scaling
lerxst2112
01-31-2012, 02:02 AM
Scaling is generally between 0 and 1, or 0% and 100%. The easiest thing to do is put hardcoded numbers in the script and see how it scales. If you put 0.5, what are the stats, what are they at 1.5? That way you can see what you need to do with the formula to make it work the way you want.
helman
01-31-2012, 02:07 AM
Ok How do i set what item ups the stats and all that. (I'm going for something that Trevius has on his server. The more AAs you give to an npc the more the stats go up. But i don't know how to do it and theres not to much in the forums talking about it.)
sorvani
01-31-2012, 02:24 AM
Items that scale, will scale all stats by the percentage that the calc returns as far as i know, not just one or two stats.
Look at LLDAugText.pl to see how to use Qglobals. Ignore all the values, because all you need to worry about is making your values go from 0 to 1.
lerxst2112
01-31-2012, 02:27 AM
As far as I know, the stats you see in the item editor are what they would be if the scale value was 1, or 100%.
It's a very easy thing to experiment with, and you're not going to permanently break anything if the script is wrong, so play around, you'll figure it out.
helman
01-31-2012, 02:35 AM
I might just forget it. I think I got most of it down but if I have to figure it out with no reference than I might not ever get it to work as I want it to.
I can probably get it to scale but I still don't know how use my item to make it scale up. I want the stats to improve after ever 50 Rift Shards given to an npc.
So how can I get it to do that?
joligario
01-31-2012, 05:53 AM
You also have a spelling error in your script above.
sorvani
01-31-2012, 10:23 AM
You have been given references. I am not going to write your script for you.
Here is another. look at the Vxed zone to see how each mob increments a qglobal.
And another. Look at damn near any script in PoK to see a turn in example.
Combine it all up and snap. You got your scripts. Hmm, did I just slip tell you you need multiple scripts too?
helman
01-31-2012, 07:02 PM
Going off what you gave me I got the turn in working. But It doesn't do anything yet. Here is my Script. (Please tell me if I'm missing anything. I think I need to add a $qglobals, But I'm not sure how to do it yet.)
sub EVENT_SAY {
if($text=~/Hail/i) {
quest::say("Hello Dear Friend, I am the elder here. I can Improve the stats on your Epic weapons.");
}
}
sub EVENT_ITEM {
if(plugin::check_handin(\%itemcount, 132508 => 1)) { #Rift Shards
quest::say("Thank you, Your weapon should be a bit stronger now.");
}
else {
quest::say("I have no use for this, $name.");
plugin::return_items(\%itemcount);
}
}
Now I am looking at some vxed mobs,and I see things like this But I don't know what to do with it.
example 1
if (defined $qglobals{bic} && $qglobals{bic_sew} == 12 && $qglobals{bic_vxe} == 13 && $qglobals{bic_tip} == 14) {
example 2
if (defined($qglobals{clockwork}) && ($qglobals{clockwork} == 1)) {
example 3
sub EVENT_DEATH {
my $instid = quest::GetInstanceID("vxed",0);
my $newvalue = $qglobals{$instid.'_vxed_status'};
$newvalue++;
quest::setglobal($instid.'_vxed_status',$newvalue, 7,"H6");
if($newvalue >= 50) {
SPAWN_EKIKOA();
}
} Although I think I know how this one works.
For my script what do I put in the {} after $qglobals, and what are the numbers for in example 1 and 2. I can probably put it together right if someone can tell me what goes there. Trust me After that I'll be able to do it on my own. (I kinda wish there was a detailed Tutorial on how to do this. Thats why I keep askin for a better example. Some people say its better for me to figure it out on my own, But I learn better when I have a good example to work off.)
lerxst2112
01-31-2012, 08:17 PM
http://www.eqemulator.net/wiki/wikka.php?wakka=QuestTutorial
The qglobal section is at the bottom.
helman
01-31-2012, 08:50 PM
I've read it and I understand it but I still don't know what 12,13,14 is for. Its like no one can tell me how to use a $qglobal for this. I can easily make a qglobal in peq database editor, But I don't know what I need to set it to. I can give it a Name,and set the zone,npcid,and player. But what do I put as a Value? It doesn't make seance. How dose a qglobals work for this?
right now I'm really frustrated, Y'all make this out to be so easy. If I can't figure out how to do this I might just trash my server. If I can't do something this simple, maybe I don't need to be running a server. (just a thought)
joligario
01-31-2012, 10:01 PM
The value is whatever you want it to be.
helman
01-31-2012, 11:07 PM
it don't matter what I set it to? Huh that would be so nice to know XDD.
sorvani
02-01-2012, 01:08 AM
Since you came up with something, I added some info for you.
sub EVENT_SAY {
if($text=~/Hail/i) {
quest::say("Hello Dear Friend, I am the elder here. I can Improve the stats on your Epic weapons.");
}
}
sub EVENT_ITEM {
#this if statement means whether they turn in 1 or 4 they only get credit once.
if(plugin::check_handin(\%itemcount, 132508 => 1)) { #Rift Shards
#just a note that depending on the "math" a single hand in may or may not affect the item.
quest::say("Thank you, Your weapon should be a bit stronger now.");
#define a variable to hold the qglobal value for calculation
my $newvalue = 0;
#check if the variable is defined.
if(defined($qglobals{epic_scale})) {
#since it exists, get the current value
$newvalue = $qglobals{epic_scale};
}
#increment the value (from 0 to 1 or what ever it was +1)
$newvalue++;
#set the new value for the qglobal
quest::setglobal("epic_scale",$newvalue,5,"F");
} else {
quest::say("I have no use for this, $name.");
}
#return item can always be the last thing outside any sub routine. this will ensure items are returned.
plugin::return_items(\%itemcount);
}
lerxst2112
02-01-2012, 03:01 AM
it don't matter what I set it to? Huh that would be so nice to know XDD.
Yes, it matters what you set it to if you're going to use it in a formula or something, but you can set it to anything that works for you.
helman
02-10-2012, 12:09 AM
Ok. I've been bizy. but I'm now able to work on this more. So I got My handin npc working but I'm having a bit of a hard time getting the Charm File to work. I Have some questions to help me figure this out.
First, How do I name my .pl? Charm77640.pl or just 77640.pl.
Second, Whats a Good reference for building my Charm file. Here (http://www.eqemulator.org/forums/showpost.php?p=191344&postcount=2) This Code here sub EVENT_SCALE_CALC
{
if (defined($qglobals{titanium_relic})) {
$questitem->SetScale($qglobals{titanium_relic}/10);
}
else {
$questitem->SetScale(0);
}
}
Or this from my LDDAugText my $charge = 5;
if (defined $qglobals{GUKpower}) {
if ($qglobals{GUKpower} <= 5) {
$charge += $qglobals{GUKpower} * 20;
}
elsif ($qglobals{GUKpower} >= 7) {
$charge += 200;
}
else {
$charge += 150;
}
}
If the one from my LDDAugText What dose $charge do and how do I use it to build my Charm file.(I have to ask cause its not in the Quest Cheat Sheet.)
Ok Thanks.
lerxst2112
02-10-2012, 01:19 AM
Items have a field named charmfile. What you put in there determines which perl file it uses for scaling.
If you look at the whole LDDAugText.pl file you'll see down at the bottom that $charge is used to set the scale. It is a local variable declared in that script.
helman
02-10-2012, 03:04 AM
I got My Blade of Vesagran set to Scale but I'm having a hard time setting the Charmfile script. I wandering if I should use Charm of the Brotherhoods charmfile scripts $matchcount for this. Reason is that no matter how many Rift Shards I give to the handin npc the items stats done go up. But it has no stats atm. So that means that its set right just not using the right type of charm file script or I didn't type the script right. My charmfile script. sub EVENT_SCALE_CALC {
{
if (defined($qglobals{epic_scale})) {
$questitem->SetScale($qglobals{epic_scale}/10);
}
else {
$questitem->SetScale(0.5);
}
} On another note after I hand in so meany rift shards my npc starts handing back the shards.
lerxst2112
02-10-2012, 04:28 AM
If you don't set the charmfile on an item it won't scale because the script is never called.
What is the trouble you're having setting the charmfile field on the item? If you use eqitems you can just type it in the box, or you can use a sql query to set it.
When you talk about using a local variable defined in another script it makes me think you really don't understand how perl works. Those variables are defined in that script to be used there, they are not global and can't be used elsewhere.
Without seeing your npc script I won't even try to guess at whatever that problem might be.
trevius
02-10-2012, 06:26 PM
Make sure the NPC you are handing items to is enabled for qglobals in the npc_types table. There is a field for them and it needs to be 1, not 0.
helman
02-10-2012, 11:26 PM
Look at the first page you'll see my full npc script But I figured out what it is. In order for my npc to take the item you need to give in 4 at a time not just one or two. A small part of my script. if(plugin::check_handin(\%itemcount, 132509 => 4))
If I change 4 to 1 I can give them to him 1 at a time but when set to 4 it has to be 4 at a time. So I think I know how to fix that. Now I have my item set to work on a CharmFile. I know The items set right cause when I log in the item has no stats. But it has stats in the DB. So the problem is probably my charm file script. Which can be seen in my last post. And Yes your right, I don't understand how Perl works. But I'm not going to let that stop me from trying to get this done.
sorvani
02-10-2012, 11:49 PM
WARNING: untested and I just got in from an after work meetup that involved a few beers..
Your logic is heavily flawed. If i have never turned in a single item, thus no quest global yet, i automatically get the item at half power. Additionally once I start turning in items it will go up in 10% increments from 0%. Also, there is no limit to how high the item will scale past 100%. Someone could easily exploit this to make the item much much more powerful.
Finally, you have more { than } so the script is in error and will never compile.
sub EVENT_SCALE_CALC {
if (defined($qglobals{epic_scale})) {
my $scale = $qglobals{epic_scale} / 10;
if ($scale > 1) {
$scale = 1;
$questitem->SetScale($qglobals{$scale});
} else {
#I honestly don't know enough baout this section of code to
#know it this is required or not to zero out the item.
$questitem->SetScale(0);
}
}
helman
02-11-2012, 12:57 AM
If you never pointed out the { and } I would have never noticed it. Which may be why it didn't work for me. I need to pay more attention to stuff like that. -tested it and I Got it to work with out using the code you just gave me. But I'll keep it as a back up to see which one works better to my liking. But thank you tho. If you didn't mention the } I never would have go it to work.-
Thank you.
Edit1 Just now i have to figure out what its using as its modifier. After give 10 I have like half stats.
Edit2 I got it working. Thanks guys.
vBulletin® v3.8.11, Copyright ©2000-2025, vBulletin Solutions Inc.