Page 1 of 1

Adding ores

Posted: Mon May 30, 2011 5:10 pm
by Poi
I searched the forums for everything ore related, and have come to no avail, I am in the process of adding custom ores, I edited all the files in the mining pkg to add the custom ores(the smelt works on them, etc) now I need to know how to make them spawn, I replaced the iron with my new ore in order to test, but it did not work, it still gave me iron..


OreCore:

Code: Select all

  if((val >= 1) && (val <= 496))
    return 1;  //"iron"
replaced with:

Code: Select all

  if((val >= 1) && (val <= 496))
    return 10;  //"iron"
as I used 10 in mining.src:

Code: Select all

  case(oretype)
    1: diff :=  -1;   objtype := 0x6300;   name := "iron";
    2: diff :=  65;   objtype := 0x6301;   name := "dull copper";
    3: diff :=  70;   objtype := 0x6302;   name := "shadow";
    4: diff :=  75;   objtype := 0x6303;   name := "copper";
    5: diff :=  80;   objtype := 0x6304;   name := "bronze";
    6: diff :=  85;   objtype := 0x6305;   name := "golden";
    7: diff :=  90;   objtype := 0x6306;   name := "agapite";
    8: diff :=  95;   objtype := 0x6307;   name := "verite";
    9: diff :=  99;   objtype := 0x6308;   name := "valorite";
	10: diff := -1;   objtype := 0xc911;   name := "mytheral";
but I think I need to add the ore to a "oretable", I came to this conclusion from this:
SetGlobalProperty("orelist", oretable);

and:
GetGlobalProperty("orelist");

Both in oreCore.src

So can anyone tell me how I add an ore type to this oretable?

Re: Adding ores

Posted: Tue May 31, 2011 3:48 am
by Yukiko
Which script set are you using? I wasn't able to find oreCore.src in the 0.97 Distro.

Re: Adding ores

Posted: Tue May 31, 2011 4:40 am
by Poi
96, and its in pkg/skills/mining

Re: Adding ores

Posted: Wed Jun 01, 2011 3:23 am
by Yukiko
Well crap!
I can't find a copy of 0.96 Distro. I have about 13 complete shard sets but for some reason I don't have 0.96 anymore. Probably better off if someone else helps you out anyway. I am just plugging my mind back into POL after being away for a bit. I am off my game right now.
*laughs*
Heck I'm only average when I'm scripting on a regular basis.

Re: Adding ores

Posted: Wed Jun 01, 2011 4:49 am
by Poi
Haha nah you've helped me a lot in the past :P

http://downloads.polserver.com/browser. ... Distro/096 <-- 96 distro

Re: Adding ores

Posted: Fri Jun 03, 2011 3:37 am
by Yukiko
Thanks Poi. I didn't have that link you posted. I'll delve into this asap.

Re: Adding ores

Posted: Fri Jun 03, 2011 3:19 pm
by Poi
Alright awesome, thank you, I have had no luck with this yet =/

Re: Adding ores

Posted: Fri Jun 03, 2011 8:37 pm
by Yukiko
Poi, in that Distro all that's under the \pkg\skills folder is lumberjacking, removetrap and spells folders. Can you zip up your 0.96 Distro scripts and post them here?

Re: Adding ores

Posted: Sat Jun 04, 2011 6:15 am
by Poi
http://www.filefactory.com/file/ccad78e/n/pkg.zip

I didn't remove the ecl's or anything, I'm not sure how to do that, but its only 2mb

Re: Adding ores

Posted: Mon Jun 06, 2011 4:57 am
by Yukiko
Thanks Poi. Just wanted to let you know I am looking at this.

So you are saying that even when you switch one of your custom ores into the "iron" position, your ore doesn't ever get mined?

One thing you can try first is to save the following script in the \scripts\textcmd\test directory as eraseglobal and compile it. This assumes your command level is "test".

Code: Select all

use uo;


program textcmd_eraseglobal( who, propertyname )
    print( "Property Name: " + propertyname );

    var res := EraseGlobalProperty( propertyname );
    if (res != error)
        SendSysMessage( who, "Property " + propertyname + " erased." );
    else
        SendSysMessage( who, "Error erasing property: " + res.errortext );
    endif
endprogram
After compiling this script restart your server and enter the text command .eraseglobal orelist

That should remove the orelist Global Property. Now shutdown and restart your server so it can rebuild the orelist property from scratch. Try mining and see if that works. I think I remember having to do this when I started adding ores.

You realize that your custom ores will be rare based on the range of the random numbers that determine their creation. Assuming that the oreCore script you sent me is your working script. You might consider adding a vein system later so you can have veins of ore in certain places on your map. That's what I did eventually and just got away from the orelist system entirely. That way I could make the special ores as rare or as common as I liked.

I'll continue looking at it and see if I can find any other reason why it wouldn't work.

Re: Adding ores

Posted: Tue Jun 07, 2011 3:32 pm
by Poi
Thanks for the reply, one of these days when I'm not exhausted ill give it a looksie :)

Re: Adding ores

Posted: Wed Jun 08, 2011 5:19 am
by Yukiko
Yeah. I understand exhaustion.

Re: Adding ores

Posted: Sat Jun 11, 2011 7:16 am
by Poi
Aha! Perfect, thank you :) Thank you thank you :)

Re: Adding ores

Posted: Sat Jun 11, 2011 5:15 pm
by Yukiko
*laughs*
That worked!?!?
You are welcome.
I'm totally surprised.
I was only guessing from bits I could remember when I added ores to my shard back in 2001.
I guess the orelist is defined on start-up and once it's defined it never re-initializes or rarely does so that if you add new ore types to the scripts they don't get added to the orelist since it's already defined.

I'm glad I could help.