"can not find any usable ore" :(

Get Help on scripting in POL with configurations, config setups, script trouble shooting, etc.

Moderator: POL Developer

Post Reply
Mutley
New User
Posts: 29
Joined: Tue Sep 03, 2013 8:26 am
Location: BRAZIL

"can not find any usable ore" :(

Post by Mutley »

I created a player crafter lvl4 with 130 all, but when I go mine he misses most of the times: "can not find any usable ore"

How do I edit to harvest full time?

I've tried editing in Distro \ pkg \ skills \ crafter \ mining \ mining.src
But no success: (

Help me, Thanks.

Mutley
xcpustyle
New User
Posts: 17
Joined: Fri Apr 27, 2012 5:55 pm

Re: "can not find any usable ore" :(

Post by xcpustyle »

Did you tried chance harverstchance at Distro \ pkg \ items \ ores \ config \ itemdesc.src ?
Mutley
New User
Posts: 29
Joined: Tue Sep 03, 2013 8:26 am
Location: BRAZIL

Re: "can not find any usable ore" :(

Post by Mutley »

I've tried xcpustyle yes, then I can only say if a specific ore has more or less likely to reap. Hand is not going to spoon or will not, the amount of hits to my intender fits the skill or skillcheck devices, perhaps.

Thank
Yukiko
Distro Developer
Posts: 2825
Joined: Thu Feb 02, 2006 1:41 pm
Location: San Antonio, Texas
Contact:

Re: "can not find any usable ore" :(

Post by Yukiko »

Mutley,
Are you using the "Distro" from the SVN Repository or the ZIP file in the downloads section of the POL site? The reason I ask is because I think there have been updates to the SVN Repository since that ZIP file was made available. I have the version from the SVN Repo and I can't find the phrase "can not find any usable ore" in the mining.src file. The phrase I do find is "You fail to find any usable ore." Maybe that's what you meant to type in your original post but when debugging programs I assume the program's output, error messages, etc. are exactly as shown.
Mutley
New User
Posts: 29
Joined: Tue Sep 03, 2013 8:26 am
Location: BRAZIL

Re: "can not find any usable ore" :(

Post by Mutley »

Yukiko,

I'm using the SVN distro99 yes. Atrazés update TortoiseSVN, as Austin guided in another post.

I have this in my mining.src :

if( !found )
SendSysMessage( mobile, "You fail to find any usable ore." );
return 0;
endif

Code: Select all

/*
        Maintened by *Edwards
        For FantasiaShard.com

        Edwards@FantasiaShard.com

        2008-10-17

        Last Modifications 2008-12-13
             * Fixed a check distance between of mobile & targ

        Last Modifications 2009-01-18
             * Verifications of the codes
             * Mobile will now face targ

        Last Modifications 2009-07-31
             * Added useItem_check()

        Last Modifications 2009-11-24
             * Added check with LOS
             * Added Play_mining_effects()
             * Changed mining loop to random
             * Fixed message with wrong amount of ressource shown
             * Added landtiles.inc
             * Cleaned codes for better performances

        Last Modifications 2010-01-07
             * Added check if mobile is in noDamage area will get a penalty for amount harvested

        Last Modifications 2010-03-19
             * Added Autoloop to mining
*/
use uo;
use os;
use util;

include "include/client";
include "include/facings";
include "include/itemUtil";
include "include/landtiles";
include ":areas:managment";
include ":attributes:attributes";
include ":autoloop:autoloop";
include ":classes:classes";
include ":crafting:crafting";

const NO_DAMAGE_BONUS := 1.50;
const HARVEST_BONUS := 2.5;

program skill_Mining( mobile, shovel )

        if( shovel.objtype == 0x0f39 )
                if( !useItem_check( mobile, shovel, ITEM_INCONTAINER ))
		        return 0;
	        endif
        else
                EquipItem( mobile, shovel );
                if( !useItem_check( mobile, shovel, ITEM_EQUIPPED ))
		        return 0;
	        endif
        endif

        SendSysMessage( mobile, "Select a place to mine." );
        var targ := TargetCoordinates( mobile );
        if( !targ )
                SendSysMessage( mobile, "Cancelled." );
                return 0;
        elseif( CoordinateDistance( mobile.x, mobile.y, targ.x, targ.y ) > 2 )
                SendSysMessage( mobile, "This is too far away." );
                return 0;
        elseif( !CheckLosAt( mobile, targ.x, targ.y, targ.z ))
                SendSysMessage( mobile, "You cannot see that." );
                return 0;
        endif

        var info := GetMapInfo( targ.x, targ.y ),
            mine_amount,
            tile;

        SendAutoLoop( mobile );
        SendSysMessage( mobile, "You start mining...", 3, 89 );

        var x := mobile.x,
            y := mobile.y;

	while( AutoLoop( mobile ))
 
                if( IsSwamp( info.landtile ))
                        tile := "clay";

                        mine_amount := HarvestResource( "clay", targ.x, targ.y, 1, 2, targ.realm );
                        if( !mine_amount )
                                SendSysMessage( mobile, "There's no clay left there." );
                                return 0;
                        endif
                elseif( IsSand( info.landtile ))
                        tile := "sand";

                        mine_amount := HarvestResource( "sand", targ.x, targ.y, 1, 2, targ.realm );
                        if( !mine_amount )
                                SendSysMessage( mobile, "There's no sand left there." );
                                return 0;
                        endif
                elseif( IsMinable( info.landtile, targ.objtype ))
                        tile := "ore";

                        mine_amount := HarvestResource( "ore", targ.x, targ.y, 1, 2, targ.realm );
                        if( !mine_amount )
                                SendSysMessage( mobile, "There's no ore left there." );
                                return 0;
                        endif
                else
                        SendSysMessage( mobile, "You cannot mine or dig anything there." );
                        return 0;
                endif

        	var delay := RandomInt( 4 ) + 2;
        	while( delay )
			if( x != mobile.x || y != mobile.y || !shovel )
		        	SendSysMessage( mobile, "You stop mining." );
                        	return 0;
			endif
			Play_mining_effects( mobile, targ );
			delay -= 1;
		endwhile

                var ore_amount := CInt( GetOreAmount( mobile, shovel ) * HARVEST_BONUS );
                if( tile == "clay" )
                       if( SkillCheck( mobile, MINING, -1 ) > 0 )
                               var clay := CreateItemInBackpack( mobile, 0xee19, CInt( ore_amount ));
                               if( !clay )
		                       SendSysMessage( mobile, "You fail to find any usable clay." );
                               else
	                               SendSysMessage( mobile, "You put "+ore_amount+" blocks of clay in your backpack." );
                               endif
                        else
                                SendSysMessage( mobile, "You fail to find any usable clay." );
                        endif
                elseif( tile == "sand" )
                        if( SkillCheck( mobile, MINING, -1 ) > 0 )
                                var clay := CreateItemInBackpack( mobile, 0xee18, CInt( ore_amount ));
                                if( !clay )
		                        SendSysMessage( mobile, "You fail to find any usable sand." );
                                else
	                                SendSysMessage( mobile, "You put "+ore_amount+" units of sand in your backpack." );
                                endif
                        else
                                SendSysMessage( mobile, "You fail to find any usable sand." );
                        endif
                elseif( tile == "ore" )
                        GetRessource( mobile, ore_amount, shovel );
                endif

                CheckToolWear( mobile, shovel, MINING );
	endwhile

        EndAutoLoop( mobile );
        SendSysMessage( mobile, "You stop mining...", 3, 89 );

        return 1;
endprogram

function GetRessource( mobile, ore_amount, shovel )

        var colored_chances := CInt( AP_GetSkill( mobile, MINING ) * ClasseBonus( mobile, CRAFTER )),
            objtype;
        
        if( RandomInt( 75 ) <= colored_chances )
		objtype := GetOre( mobile );
        else
		objtype := 0x19B8;
                ore_amount *= 2;
        endif

        if( SkillCheck( mobile, MINING, -1 ) > 0 )
                createOres( mobile, objtype, ore_amount );
        else
                SpecialEffects( mobile, shovel );
        endif

        return 1;
endfunction

function createOres( mobile, objtype, amount )

	var ores := CreateItemInBackpack( mobile, objtype, CInt( amount ));
        if( !ores )
                CreateItemAtLocation( mobile.x, mobile.y, mobile.z, objtype, CInt( amount ), mobile.realm );
        endif

        SendSysMessage( mobile, "You put "+CInt( amount )+" "+GetRessourceName( ores )+" in your backpack." );

        return 1;
endfunction

function GetOre( mobile )

        var cfg	:= ReadConfigFile( ":ores:itemdesc" );
        if( cfg.errortext )
                SendSysMessage( mobile, "Error reading config <:ores:itemdesc> -->"+cfg.errortext );
                return 0;
        endif
        
        var the_keys := GetConfigStringKeys( cfg ),
            possibles := array{};

        foreach key in the_keys
		var harvest := CInt( cfg[key].HarvestChance ),
                    difficulty := CInt( cfg[key].Difficulty );
                    
                if( !harvest )
                        //Skip sand definition in itemdesc
                        continue;
                endif

		if( RandomInt( 155 ) >= harvest )
			if( SkillCheck( mobile, MINING, difficulty, 0, ADV_DISABLE ) > 0 )
				possibles.Append( key );
                        endif
		endif
                SleepMS(5);
	endforeach
        
        return CInt( possibles.RandomEntry() );
endfunction

function GetOreAmount( mobile, shovel )

        var skill := AP_GetSkill( mobile, MINING ),
            max_amount := CInt( RandomDiceRoll( "1d"+CInt( skill / 40 )+"+1" ) * ClasseBonus( mobile, CRAFTER ));

        var bonus := GetObjProperty( shovel, "MiningBonus" );
	if( bonus )
		max_amount *= bonus;
	endif

        if( !A_IsIn( mobile, AREAS_NO_DAMAGE ))
                max_amount *= NO_DAMAGE_BONUS;
        endif

        if( max_amount < 1 )
		max_amount := 1;
	endif

        return CInt( max_amount );
endfunction

function GetRessourceName( item )

	var name := item.desc;

	if( item.amount > 1 )
		var i := Len( name ),
		    amount := item.amount,
		    count := 2;
		while( CInt( amount / 10 ))
			count += 1;
			amount := CInt( amount / 10 );
                        SleepMS(5);
		endwhile

		name := name[count+1, i-count];
	endif

	return name;
endfunction

function SpecialEffects( mobile, shovel )

        var bonus := CInt(( AP_GetSkill( mobile, MINING ) / 10 ) * ClasseBonus( mobile, CRAFTER ));
        if( bonus < 1 )
                bonus := 1;
        endif
        
        var chance := RandomInt( 100 ) + bonus;

        var shovel_bonus := GetObjProperty( shovel, "MiningBonus" );
	if( shovel_bonus )
		chance += 5;
        endif

        var found := 0;
        case( CInt( chance ))

		30:     CreateItemInBackpack( mobile, 0x14ED, 1 );
			SendSysMessage( mobile, "You put TreasureMap in your backpack." );

                        found := 1;
			break;

		100:	CreateItemInBackpack( mobile, 0x19eb, 10 );
			SendSysMessage( mobile, "You find a piece of Exlusive ZULU ORE!" );

                        found := 1;
			break;

                102:	CreateItemInBackpack( mobile, 0x19e8, 8 );
			SendSysMessage( mobile, "You find a strange looking Blue Gem!" );

                        found := 1;
			break;

                104:	CreateItemInBackpack( mobile, 0x19e9, 6 );
			SendSysMessage( mobile, "You find a strange looking Red Gem!" );

                        found := 1;
			break;

                106:	CreateItemInBackpack( mobile, 0x19ea, 4 );
			SendSysMessage( mobile, "You find a strange looking White Gem!" );

                        found := 1;
			break;

                108:	CreateItemInBackpack( mobile, 0x19ec, 2 );
			SendSysMessage( mobile, "You find a glowing bright SPECIAL ORE!" );

                        found := 1;
			break;
	endcase
 
        if( !found )
                SendSysMessage( mobile, "You fail to find any usable ore." );
	        return 0;
        endif

	return 1;
endfunction

function Play_mining_effects( mobile, targ )

        TurnObjectToward( mobile, targ.x, targ.y );

        PerformAction( mobile, 0x0b );
        SleepMS(500);
        PlaySoundEffect( mobile, 0x0043 );

        SleepMS( 1000 );

        return 1;
endfunction
Excuse me, but I can not write in English. I use the google translator. I am Brazilian, only the Portuguese domino :/

Thank you for your attention.
Yukiko
Distro Developer
Posts: 2825
Joined: Thu Feb 02, 2006 1:41 pm
Location: San Antonio, Texas
Contact:

Re: "can not find any usable ore" :(

Post by Yukiko »

No problem Mutley. I can understood what you meant. I was confused because the failure message you had given originally did not match what the script contains. I wanted to be sure that your scripts matched the SVN scripts.

Maybe you can modify the script for testing purposes to always give success on a SkillCheck to see if you are able to harvest ore. If that works then you will know that the ore creation part of the script works properly.

I will try to look at the script later today too see if I can discover what is wrong.
Mutley
New User
Posts: 29
Joined: Tue Sep 03, 2013 8:26 am
Location: BRAZIL

Re: "can not find any usable ore" :(

Post by Mutley »

Thank you Yukiko.

The same happens with lumberjacking and fishing. Only messages of failure are different:

Lumberjacking: "You fail to find any usable wood."

Fishing: "They do not seem to be biting."

Fishing.src

Code: Select all

/*
        Maintened by *Edwards

        2008-10-14

        Last Modifications 2008-12-13
             * Fixed a check distance between of mobile & targ

        Last Modifications 2009-01-18
             * GM Poseidon added with bonus

        Last Modifications 2009-08-23
             * Added useItem()

        Last Modifications 2009-11-24
             * Added check with LOS

        Last Modifications 2010-02-16
             * Added check if mobile is in noDamage area will get a penalty for amount harvested

        Last Modifications 2010-03-14
             * Added SpecialEffects()

        Last Modifications 2010-03-19
             * Added Autoloop to fishing
*/
use uo;
use os;
use util;

include "include/client";
include "include/facings";
include "include/itemUtil";
include "include/objType";
include ":attributes:attributes";
include ":autoloop:autoloop";
include ":classes:classes";
include ":crafting:crafting";
include ":loot:lootParser";

const NO_DAMAGE_BONUS := 1.50;
const HARVEST_BONUS := 2.5;

program skill_Fishing( mobile, pole )

        EquipItem( mobile, pole );

        if( !useItem_check( mobile, pole, ITEM_EQUIPPED ))
		return 0;
	endif

        SendSysMessage( mobile, "Select a fishing spot." );
        var targ := TargetCoordinates( mobile );
        if( !targ )
                SendSysMessage( mobile, "Cancelled." );
        elseif( !useItem_check( mobile, pole ))
		return 0;
        elseif( !IsWater( targ ))
                SendSysMessage( mobile, "You must target water." );
                return 0;
        elseif( !CheckLosAt( mobile, targ.x, targ.y, targ.z ))
                SendSysMessage( mobile, "You cannot see that." );
                return 0;
        endif
        
        var x := mobile.x,
            y := mobile.y;

        SendAutoLoop( mobile );
        SendSysMessage( mobile, "You start fishing...", 3, 89 );

	while( AutoLoop( mobile ))

                PlayFishingAnimation( mobile, targ );
                
        	var delay := RandomInt( 3 ) + 2;
        	while( delay )
			Sleep( 1 );
			delay -= 1;
			if( x != mobile.x || y != mobile.y || !pole )
				SendSysMessage( mobile, "You must be patient while fishing." );
                        	return 0;
			endif
		endwhile
  
                if( CheckSoSTreasure( mobile, targ ))
                	return 1;
                endif

        	var difficulty := CInt( GetHarvestDifficulty( "fish", targ.x, targ.y, targ.objtype ));
        	if( !difficulty )
                	SendSysMessage( mobile, "You can't seem to get any fish here." );
                	return 0;
        	endif

        	if( SkillCheck( mobile, FISHING, -1 ) > 0 )

                	var harvest := HarvestResource( "fish", targ.x, targ.y, 1, 1 );
                	if( !harvest )
                        	SendSysMessage( mobile, "There's no more fish left there." );
                        	return 0;
                	endif

                	var fish_amount := CInt( GetFishAmount( mobile, pole ) * HARVEST_BONUS );
                	var dagger := GetEquipmentByLayer( mobile, LAYER_HAND1 ).graphic == 3921;

                	if( SpecialEffects( mobile, pole, fish_amount, dagger ))
                        	continue;
                	endif

                	if( dagger )
                        	PlaySoundEffect( mobile, 0x0057 );

                                var i;
                                For( i:=0; i<fish_amount; i+=1 )
                        	 	CreateItemInBackpack( mobile, 0x097a, 1 );
                                 	SleepMS(5);
                                endfor
                                
                        	SendSysMessage( mobile, "You carve the fish and put "+fish_amount+" steak(s) in your backpack." );
                	else
                        	var create := CreateItemInBackpack( mobile, 0x09cc, fish_amount );
                        	if( !create )
                                	SendSysMessage( mobile, "They don't seem to be biting." );
                        	endif
                         
                        	SendSysMessage( mobile, "You put "+fish_amount+" fish in your backpack." );
                	endif
        	else
                	SendSysMessage( mobile, "They don't seem to be biting." );
        	endif

        	CheckToolWear( mobile, pole, FISHING );
	endwhile

        EndAutoLoop( mobile );
        SendSysMessage( mobile, "You stop fishing...", 3, 89 );

        return 1;
endprogram

function CheckSoSTreasure( mobile, targ )

        foreach item in ListItemsNearLocation( targ.x, targ.y, targ.z, 6, targ.realm )
                if( item.IsSOSTile() )
                        if( FetchBottle( mobile, item ));
                                return 1;
                        endif
                endif
                SleepMS(5);
        endforeach
        
        return 0;
endfunction

function PlayFishingAnimation( mobile, targ )

        TurnObjectToward( mobile, targ.x, targ.y );
        PerformAction( mobile, 0x9 );

        SleepMS( RandomInt( 1000 ));
        
        PlaySoundEffect( mobile, 0x0240 );
        PlayStationaryEffect( targ.x, targ.y, targ.z, 13613, 10, 10, 1 );
        
        Sleep(2);
        
        return 1;
endfunction

function GetFishAmount( mobile, pole )

        var skill := AP_GetSkill( mobile, FISHING ),
            max_amount := CInt( RandomDiceRoll( "1d"+CInt( skill / 25 )+"+3" ) * ClasseBonus( mobile, RANGER ));

        var bonus := GetObjProperty( pole, "FishingBonus" );
	if( bonus )
		max_amount *= bonus;
	endif

        if( !A_IsIn( mobile, AREAS_NO_DAMAGE ))
                max_amount *= NO_DAMAGE_BONUS;
        endif

        if( max_amount < 1 )
		max_amount := 1;
	endif

        return CInt( max_amount );
endfunction

function SpecialEffects( mobile, pole, fish_amount, dagger )

        var bonus := ( CInt( AP_GetSkill( mobile, FISHING ) / 30 ) + 1 ) * ClasseBonus( mobile, RANGER );
        if( bonus < 5 )
                bonus := 5;
        endif
        
        var chance := RandomInt( 95 ) - bonus;

        var pole_bonus := GetObjProperty( pole, "FishingBonus" );
	if( pole_bonus )
		chance += 20;
	elseif( !GetObjProperty( mobile, CRAFTER ))
                chance -= 20;
        endif

        var ret := 0;
        case( CInt( chance ))
		15:	CreateItemInBackpack( mobile, 0xdca, 1 );
			SendSysMessage( mobile, "You just found a special fishing net!" );

                        ret := 1;
                        break;
   
                40:
                        CreateItemInContainer( mobile.backpack, RandomFish(), 1 );
                        SendSysMessage( mobile, "You caught a magical fish!" );
                        ret := 1;
			break;

                80:	CreateMagicFish( mobile, fish_amount, dagger );
			SendSysMessage( mobile, "You find some seaweed!" );

                        ret := 1;
			break;

		98:	CreateItemInBackpack( mobile, 0xa360, 1 );
			SendSysMessage( mobile, "You find a tattered old map!" );

                        ret := 1;
			break;

                100:	CreateItemInBackpack( mobile, CreateShell( mobile ), 1 );
			SendSysMessage( mobile, "You find something valuable!" );

                        ret := 1;
			break;
	endcase

	return ret;
endfunction

function CreateMagicFish( mobile, fish_amount, dagger )

	if( dagger )
		PlaySoundEffect( mobile, 0x0057 );

		CreateItemInBackpack( mobile, 0x097a, CInt( fish_amount ));
		SendSysMessage( mobile, "You carve the fish and put "+CInt( fish_amount )+" steak(s) in your backpack." );
	else
                var magic_fish := array{0xA350, 0xA351, 0xA352, 0xA353, 0xA354, 0xA355, 0xA356, 0xA357};

                CreateItemInBackpack( mobile, magic_fish.RandomEntry(), 1 );
	endif

        return 1;
endfunction

function CreateShell( mobile )

        case( RandomInt( 5 ))
                0: return 0x80ae;
                1: return 0x80af;
                2: return 0x80b0;
                3:
                4: if( AP_GetSkill( mobile, FISHING ) > 100 )
	                   if( RandomInt(3) == 2 )
		                   return 0x80b6;
	                   else
		                   return 0x80b5;
	                   endif
                   else
   	                   return 0x80b1;
                   endif
        endcase

        return 0;
endfunction

function FetchBottle( mobile, tile )
        
        var msg_serial := GetObjProperty( tile, "SOSMsgSerial" ),
            sos_message := 0;

        foreach item in EnumerateItemsInContainer( mobile.backpack )
                if( item.serial == msg_serial )
                        sos_message := item;
                        break;
                endif
                SleepMS(5);
        endforeach

        if( sos_message )
                SendSysMessage( mobile, "You catch a sunken treasure!" );
                
                SkillCheck( mobile, FISHING, -1, 400 );
	        CreateSOSChest( mobile );
	        DestroyItem( sos_message );
         
                return 1;
        endif

        return 0;
endfunction

function CreateSOSChest( mobile )

        var chest := CreateItemAtLocation( mobile.x, mobile.y, mobile.z, 0xE40, 1, mobile.realm );
        if( chest.errortext )
                SendSysMessage( mobile, "Error creating treasure chest -->"+chest.errortext );
                return 0;
        endif
        
        var level := RandomInt( CInt( GetObjProperty( mobile, RANGER )));
        if( !level )
                level := 1;
        elseif( level >= 6 )
                level := 6;
        endif
        
        Loot_Generate( chest, level, 1 );

        return 1;
endfunction

function RandomFish()

        case( RandomInt( 7 ))
                0: return 0xA350;
                1: return 0xA351;
                2: return 0xA352;
                3: return 0xA353;
                4: return 0xA354;
                5: return 0xA355;
                6: return 0xA356;
                7: return 0xA357;
        endcase

        return 0;
endfunction
thank you
User avatar
Austin
Former Developer
Posts: 621
Joined: Wed Jan 25, 2006 2:30 am

Re: "can not find any usable ore" :(

Post by Austin »

See if the lumberjacking and mining here work more how you want (though you will need to do some editing to work with distro item names/objtypes)
http://forums.mytharriauo.com/viewtopic.php?f=9&t=154
Tomi
POL Developer
Posts: 478
Joined: Tue Feb 21, 2006 5:08 pm

Re: "can not find any usable ore" :(

Post by Tomi »

Mutley are you defining container max weights in itemdescs and servspecopt.cfg as 0 or -1 or such ?
Because when I looked at the code your posted that message shows up in 2 cases
1: There is no ore, fish, wood
2: Your backpack is full

In that case either change them to 0xFFFF or grab the latest core SVN and compile it
Mutley
New User
Posts: 29
Joined: Tue Sep 03, 2013 8:26 am
Location: BRAZIL

Re: "can not find any usable ore" :(

Post by Mutley »

Hello Tomi

I'm using the latest SVN core ...

What I'm trying to make is that whenever the resource collection. As an example, when fishingnet playing in the sea. + Or - 50% of the time it returns nothing and the message: "You did not cath anything."

This part of the code:

if (! SkillCheck (mobile, FISHING, -1)> 0)
SendSysMessage (mobile, "You did not catch anything.");
return 0;
endif

See FishingNet.src (distro99 svn)

Code: Select all

/*
        Maintened by *Edwards

        2009-01-18
*/
use uo;
use os;

include "include/itemUtil";
include "include/objType";
include "include/facings";
include ":attributes:attributes";

program use_fishingNet( mobile, fishingNet )

       	if( !useItem_check( mobile, fishingNet, ITEM_INCONTAINER ))
		return 0;
	endif

        var use_on := TargetCoordinates( mobile );
        if( !use_on )
                SendSysMessage( mobile, "Canceled." );
                return 0;
        elseif( Distance( mobile, use_on ) > 5 )
                SendSysMessage( mobile, "That is too far away." );
	        return 0;
        elseif( !CheckLosAt( mobile, use_on.x, use_on.y, use_on.z ))
                SendSysMessage( mobile, "You cannot see that." );
                return 0;
        endif

        if( !IsWater( use_on ))
                SendSysMessage( mobile, "That is not deep sea." );
                return 0;
        endif

        SendSysMessage( mobile, "You throw the net out into sea." );
        TurnObjectToward( mobile, use_on.x, use_on.y );
        PlaySoundEffect( fishingNet, 0x0026 );
        DestroyItem( fishingNet );
        
        var splash := CreateItemAtLocation( use_on.x, use_on.y, use_on.z, 0x352d, 1, use_on.realm );
        splash.movable := 0;
	SleepMS( 500 );
	splash.graphic := 0x352e;
	SleepMS( 500 );
	splash.graphic := 0x352f;
	SleepMS( 500 );
	splash.graphic := 0x3530;
	SleepMS( 500 );
	DestroyItem( splash );
        
        var x := mobile.x,
            y := mobile.y;

        var delay := 10;
        while( delay )
		Sleep( 1 );
		delay -= 1;
		if( x != mobile.x || y != mobile.y )
			SendSysMessage( mobile, "You must be patient while fishing." );
                        return 0;
		endif
	endwhile
        
        if( !SkillCheck( mobile, FISHING, -1 ) > 0 )
                SendSysMessage( mobile, "You did not catch anything." );
                return 0;
        endif

        case( RandomInt( 7 ))
                0:          var npc := CreateNpcFromTemplate( ":ai_sea:SeaMonster", use_on.x, use_on.y, use_on.z );
                            if( npc.errortext )
                                    SendSysMessage( mobile, "Error creating <:ai_sea:SeaMonster> -->"+npc.errotext );
                            endif
                            
                            SendSysMessage( mobile, "You caught something dangerous in your net!" );
                            return 1;
                1:          CreateItemInContainer( mobile.backpack, 0xa360, 1 );
                            SendSysMessage( mobile, "You caught an old bottle!" );
                            return 1;
                2:          if( RandomInt( 10 ) > 3 )
                                    var bag := CreateItemInContainer( mobile.backpack, 0xE76, 1 );
                                    bag.color := 1160;
                                    bag.decay := 120;
                                    
                                    var randomNum := RandomInt( 2500 );
                                    if( GetObjProperty( mobile, RANGER ))
                                            randomNum *= GetObjProperty( mobile, RANGER );
                                    endif
                                    
                                    CreateItemInContainer( bag, 0xeed, randomNum + 125 );
                                    SendSysMessage( mobile, "You find an old bag!" );
                                    return 1;
                            endif
                            break;
                3:
                            if( RandomInt( 10 ) > 8 )
                                    CreateItemInContainer( mobile.backpack, RandomShell( mobile ), 1 );
                                    SendSysMessage( mobile, "You find something valuable!" );
                                    return 1;
                            endif
                            break;
                4:
                            if( RandomInt( 10 ) > 6 )
                                    CreateItemInContainer( mobile.backpack, RandomFish(), 1 );
                                    SendSysMessage( mobile, "You caught a magical fish!" );
                                    return 1;
                            endif
                            break;
                5:
                            if( RandomInt( 10 ) > 2 )
                                    CreateItemInContainer( mobile.backpack, 0x09cc, RandomInt(20)+5 );
                                    SendSysMessage( mobile, "You caught some fishes!" );
                                    return 1;
                            endif
                            break;
                6:
                            if( RandomInt( 20 ) == 16 )
                                    var trophy := "0x1E62";
                                    if( RandomInt( 2 ) == 1 )
                                           trophy := "0x1E69";
                                    endif

                                    var troph := CreateItemInContainer( mobile.backpack, trophy, 1 );
                                    SetObjProperty( troph, "Fish", mobile.serial );
                                    SendSysMessage( mobile, "You catch a trophy!" );
                                    return 1;
                            endif
                            break;
                7:
                            if( RandomInt( 10 ) == 10 )
                                    CreateItemInContainer( mobile.backpack, RandomArmor( mobile ), 1 );
                                    SendSysMessage( mobile, "You find a human skeleton rests!" );
                                    return 1;
                            endif
                            break;
        endcase
        
        SendSysMessage( mobile, "You did not catch anything." );
        
        return 1;
endprogram

function RandomShell( mobile )

        case( RandomInt( 5 ))
                0: return 0xA350;
                1: return 0xA351;
                2: return 0xA352;
                3: return 0xA353;
                4: if( AP_GetSkill( mobile, FISHING ) > 100 )
	                    if( RandomInt( 3 ) == 2 )
	                            return 0xA354;
	                    else
	                            return 0xA355;
	                    endif
                   else
   	                    return 0xA356;
                   endif
                5: return 0xA357;
        endcase

        return 0;
endfunction

function RandomArmor( mobile )

        var skill_fishing := AP_GetSkill( mobile, FISHING );
        
        case( RandomInt( 5 ))
                0: if( skill_fishing > 100 )
	                 if( RandomInt( 3 ) == 2 )
	                        return 0x8255; //Gloves of Terror
	                 endif
                   endif
                   break;
                1: if( skill_fishing > 105 )
	                 if( RandomInt( 3 ) == 2 )
	                        return 0x8253;  //Arms of Terror
	                 endif
                   endif
                   break;
                2: if( skill_fishing > 110 )
	                 if( RandomInt( 3 ) == 2 )
	                        return 0x8256; //Helm of Terror
	                 endif
                   endif
                   break;
                3: if( skill_fishing > 115 )
	                 if( RandomInt( 3 ) == 2 )
	                        return 0x8257; //Legs of Terror
	                 endif
                   endif
                   break;
                4: if( skill_fishing > 120 )
	                 if( RandomInt( 3 ) == 2 )
	                        return 0x8254; //Tunic of Terror
	                 endif
                   endif
                   break;
                5: if( skill_fishing > 125 )
	                 if( RandomInt( 3 ) == 2 )
	                        return 0x8252; //HeavyCrossbow of Terror
	                 endif
                   endif
                   break;
        endcase

        return 0;
endfunction

function RandomFish()

        case( RandomInt( 7 ))
                0: return 0xA350;
                1: return 0xA351;
                2: return 0xA352;
                3: return 0xA353;
                4: return 0xA354;
                5: return 0xA355;
                6: return 0xA356;
                7: return 0xA357;
        endcase

        return 0;
endfunction
Thank
Post Reply