The following warnings occurred:
Warning [2] Use of undefined constant SAPI_NAME - assumed 'SAPI_NAME' (this will throw an Error in a future version of PHP) - Line: 3388 - File: inc/functions.php PHP 7.4.33-nmm7 (Linux)
File Line Function
/inc/functions.php 3388 errorHandler->error
/showthread.php 116 build_archive_link
Warning [2] Use of undefined constant IN_ARCHIVE - assumed 'IN_ARCHIVE' (this will throw an Error in a future version of PHP) - Line: 3331 - File: inc/functions.php PHP 7.4.33-nmm7 (Linux)
File Line Function
/inc/functions.php 3331 errorHandler->error
/inc/functions.php 3324 build_forum_breadcrumb
/showthread.php 195 build_forum_breadcrumb
Warning [2] Use of undefined constant IN_ARCHIVE - assumed 'IN_ARCHIVE' (this will throw an Error in a future version of PHP) - Line: 3331 - File: inc/functions.php PHP 7.4.33-nmm7 (Linux)
File Line Function
/inc/functions.php 3331 errorHandler->error
/showthread.php 195 build_forum_breadcrumb






Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
want to dig sand
Author Message
darksun84
Sir Spamalot
****

Posts: 1,687
Likes Given: 245
Likes Received: 162 in 151 posts
Joined: Mar 2012
Reputation: 35



Post: #7
RE: want to dig sand
I managed to script the sand diggin with a shovel with the appropriate use of the mining skill, it seems to work.

Code:
[REGIONRESOURCE mr_sand]
AMOUNT=1,10
REAP=i_sand
REAPAMOUNT=1,3
SKILL=60.0,110.0
REGEN=60*60*10

[REGIONTYPE r_default_sand t_sand]
resources = 10.0 mr_nothing
resources = 90.0 mr_sand

[FUNCTION createSandGem]
//Thank sto CALCMEMBERINDEX we get the appropriate resource according to our skill level and its defname
local.resTypeIndex =  <serv.regiontype.r_default_sand.CALCMEMBERINDEX <uid>>
local.resTypeName = <serv.regiontype.r_default_sand.resources.<eval <local.resTypeIndex> + 1>.key>
serv.log Resource found: <serv.regiontype.r_default_sand.resources.<eval <local.resTypeIndex> + 1>.key>
//Calculate the amount range based on the resource found
local.resTypeRangeAmount = <serv.regionresource.<local.resTypename>.amount>
serv.log Amount range: <local.resTypeRangeAmount>
//Calculate the timer
local.resTypeTimer = <serv.regionresource.<local.resTypename>.regen>
serv.log Regen time: <dlocal.resTypeTimer>
//Create the gembit
serv.newitem i_worldgem_bit,<R<local.resTypeRangeAmount>>
new.timer = <dlocal.resTypeTimer>
new.attr = attr_decay|attr_invis|attr_move_never
//Set the appropriate  more1
new.type = t_rock
new.more1 = <local.resTypeName>
new.p = <targp>
new.z = <targp.z>




[ITEMDEF i_shovel_sand]
id=i_shovel
name=Sand Shovel
type=t_weapon_mace_pick

ON=@Create
hitpoints = 100
color = 035
ON=@Dclick
if ( !<cont> ) && ( <topobj> != <src> )
    src.sysmessage You have to put the <name> in your backpack.
    return 1
endif

ON=@TargOn_ground
if <src.distance <src.targp>> <= <serv.skill.skill_mining.range>
    if <serv.map(<src.targp>).type> == t_sand
        src.emote start digging for sand
        //We create a gem bit.
        src.createSandGem
        //Timerf seems to be needed otherwise sometime the skill is called before the gem creation
        src.timerf 2,src.skill 45
        
    else
        src.emote can't dig sand here.
        return 1
    endif
else
    src.sysmessage Too far away
    return 1
endif
05-12-2017 08:50 AM
Find all posts by this user Like Post Quote this message in a reply
[+] 1 user Likes darksun84's post
Post Reply 


Messages In This Thread
want to dig sand - WRWR - 05-12-2017, 03:17 AM
RE: want to dig sand - darksun84 - 05-12-2017, 03:40 AM
RE: want to dig sand - WRWR - 05-12-2017, 04:31 AM
RE: want to dig sand - darksun84 - 05-12-2017, 06:41 AM
RE: want to dig sand - WRWR - 05-12-2017, 07:02 AM
RE: want to dig sand - darksun84 - 05-12-2017, 07:18 AM
RE: want to dig sand - darksun84 - 05-12-2017 08:50 AM
RE: want to dig sand - WRWR - 05-12-2017, 10:24 AM
RE: want to dig sand - golfin - 05-05-2019, 02:37 AM

Forum Jump:


User(s) browsing this thread: 1 Guest(s)