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-nmm6 (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-nmm6 (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-nmm6 (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
WRWR
Journeyman
*

Posts: 212
Likes Given: 30
Likes Received: 1 in 1 posts
Joined: Mar 2012
Reputation: 1



Post: #1
want to dig sand
just want to dig sand on beach

Code:
[REGIONTYPE r_default_rock t_sand]
RESOURCES=40.0 mr_sand

but it's not work Smile any suggestions? Lol

or shovel work only with t_rock like a pickaxe?
(This post was last modified: 05-12-2017 03:19 AM by WRWR.)
05-12-2017 03:17 AM
Find all posts by this user Like Post Quote this message in a reply
darksun84
Sir Spamalot
****

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



Post: #2
RE: want to dig sand
Did you define [REGIORNRESOURCE mr_sand] ?
Also make sure that the sand tiles you are digging matches the ID of [TYPEDEF t_sand] in sphere_types.scp
(This post was last modified: 05-12-2017 03:42 AM by darksun84.)
05-12-2017 03:40 AM
Find all posts by this user Like Post Quote this message in a reply
WRWR
Journeyman
*

Posts: 212
Likes Given: 30
Likes Received: 1 in 1 posts
Joined: Mar 2012
Reputation: 1



Post: #3
RE: want to dig sand
(05-12-2017 03:40 AM)darksun84 Wrote:  Did you define [REGIORNRESOURCE mr_sand] ?
Also make sure that the sand tiles you are digging matches the ID of [TYPEDEF t_sand] in sphere_types.scp

sure

Code:
[TYPEDEF t_sand]
TERRAIN = 016    03e
TERRAIN = 044    04b
TERRAIN = 011e    012d
TERRAIN = 0192
TERRAIN = 01a8    01ab
TERRAIN = 01b9    01d1
TERRAIN = 0282    0291
TERRAIN = 0335    0354
TERRAIN = 0359    035c
TERRAIN = 03b7    03ca
TERRAIN = 05a7    05ba
TERRAIN = 064b    066a
TERRAIN = 066f    0672

and
Code:
[REGIONRESOURCE MR_SAND]
REAP I_ORE_SAND
REGEN 60
AMOUNT 10,20
REAPAMOUNT 3,5
(This post was last modified: 05-12-2017 04:32 AM by WRWR.)
05-12-2017 04:31 AM
Find all posts by this user Like Post Quote this message in a reply
darksun84
Sir Spamalot
****

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



Post: #4
RE: want to dig sand
I guess by reading the comments looks like is mandatory to use t_rock if you are using a pickaxe/shovel Confused

In order to actually mine ore, a REGIONRESOURCE needs to exist for it, and a
REGIONTYPE needs a REGION= entry to that REGIONRESOURCE... also that same
REGIONTYPE must be associated to the t_rock Terrain TYPEDEF.


Hovewer, i did a test, i moved the t_sand tiles in the t_rock part.
Then i created a custom areadef that includes a beach area.
Added the sand regiontype as the last event entry in the areadef.
Then you can mine sand in this area, without other ore conflicts, hovewer i remember it was more easy to do that before?

Probably the quickest way is to play with the regionresource triggers (still you have to add the sand tiles to the rock tiles part)

Or creating a custom pickaxe?
05-12-2017 06:41 AM
Find all posts by this user Like Post Quote this message in a reply
WRWR
Journeyman
*

Posts: 212
Likes Given: 30
Likes Received: 1 in 1 posts
Joined: Mar 2012
Reputation: 1



Post: #5
RE: want to dig sand
yeah, i know about t_rock terrains...

sand to t_rock? no way
pickaxe for sand? no! Smile
why i can't use shovel for it?
05-12-2017 07:02 AM
Find all posts by this user Like Post Quote this message in a reply
darksun84
Sir Spamalot
****

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



Post: #6
RE: want to dig sand
Because i think the shovel is treated as a pickaxe, so there is no (internal) behaviour for it Tongue
05-12-2017 07:18 AM
Find all posts by this user Like Post Quote this message in a reply
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
WRWR
Journeyman
*

Posts: 212
Likes Given: 30
Likes Received: 1 in 1 posts
Joined: Mar 2012
Reputation: 1



Post: #8
RE: want to dig sand
using almost same script for it...
05-12-2017 10:24 AM
Find all posts by this user Like Post Quote this message in a reply
golfin
Banned

Posts: 213
Likes Given: 2
Likes Received: 32 in 28 posts
Joined: Nov 2017

Eranova

Post: #9
RE: want to dig sand
I played a little and modified your script. DarkSun. It's not done, but works partially outside the hardcod sphere settings on all the terrain I choose. That's what I wanted. Here's a sample.

PHP Code:
//****************************************************************************
// Saved in ANSI encoding
//****************************************************************************
// Drd Online
// Dragon & Dungeon - Extraction of sand and clay
// Create Golfin (Czech)
//****************************************************************************
// Last file update: Saturday, May 4, 2019

VERSION=0.56d

[DEFNAME skills_msgs]
/// mining ///
lopata_musi_byt        "Shovel must be in the backpack!"
hodil            "He threw"
hodila            "She threw"
hornictvi        "mining"
fatal_neuspech        "Fatal Failure !!!"
chvili            "For a moment ye are in the earth,"
nenachazis        "but you don't find much."
znicena            "it was destroyed."
poskozena        "it was damaged."
fatal_uspech        "Fatal success"
nasel            "He found"
nasla            "She found"

[DEFNAME Resources_type]
REGIONRESOURCE_mr_clay                "clay"
REGIONRESOURCE_mr_sand                "sand"

[TYPEDEF t_Mining_Sand]
ON=@Dclick
if ( !<Cont> ) && ( <TopObj> != <Src> )
   
// Shovel must be in the backpack
   
Src.f_Sys_Orange <Def.lopata_musi_byt>    
   return 
1
endif

On=@Targon_Ground
// we target sand, grass and clay (clay roads and fields - modified scp sphere_types.scp)
   
If ( <Serv.map(<Src.TargP>).TYPE> == t_sand ) || (<Serv.map(<Src.TargP>).TYPE> == t_grass ) || (<Serv.map(<Src.TargP>).TYPE> == t_dirt )
      
// distance scoop from player by skill mining
      
If <Src.distance <Src.TargP>> <= <Serv.skill.skill_mining.range>    
         
Serv.Newitem=i_memory
         
New.f_Harvest_Sand_Clay <Src.UID>,"<Src.TargP>"
      
EndIf
   EndIf

[function 
f_Harvest_Sand_Clay]
Local.Harvest_Sand_Clay 0
= <Src.TargP>
Updatex
Foritems 0
// verify that worldgem_bit already exists
   
If ((<baseid> == i_worldgem_bit) && ( <type> == t_rock )
      
Local.Harvest_Sand_Clay = <UID>
   EndIf
EndFor
// When worldgem_bit does not exist, a new dice roll is created per percent (According to D&D rules)
If <Local.Harvest_Sand_Clay> = 0
   
// Source selection by terrain type 
   // Here I had to place a skill condition because of the resources in the sphere_region file it doesn't work
   
If ( <Src.Mining> > 0.0 ) && ( (<Serv.map(<Src.TargP>).TYPE> = t_grass) || (<Serv.map(<Src.TargP>).TYPE> = t_dirt) )
      
Local.Regionresource mr_clay
      Local
.Amount = <Serv.REGIONRESOURCE.<Local.Regionresource>.AMOUNT>
      
Local.Timer = <Serv.REGIONRESOURCE.<Local.Regionresource>.REGEN>
   ElseIf ( <
Src.Mining> > 4.9 ) && ( <Serv.map(<Src.TargP>).TYPE> = t_sand )
      
Local.Regionresource mr_sand
      Local
.Amount = <Serv.REGIONRESOURCE.<Local.Regionresource>.AMOUNT>
      
Local.Timer = <Serv.REGIONRESOURCE.<Local.Regionresource>.REGEN>
   EndIf
   
// 1K10 Dice Throw (1 to 100% Percent - According to D&D rules)
   
Local.desitka = <Eval rand(1100)>
   If (<
local.desitka> > 19)
      
Src.f_1k10_100
      Serv
.newitem i_worldgem_bit,<R<Local.Amount>>
      New.
Attr Attr_decay|Attr_invis|Attr_move_never
      
New.TYPE t_rock
      
New.More1 = <Local.Regionresource>
      New.
Timer = <DLocal.Timer>
      New.
= <P>
      
Local.Harvest_Sand_Clay = <New.UID>
      
// Timerf 2 is needed due to delay - otherwise it would give the player material 
      // before creating the worldgembit
      
Src.Timerf 2,Src.skill 45        
      Src
.f_Msg_Cyan <Src.Sex <Def.hodil>/<Def.hodila>> jsi na <Def.hornictvi> <Eval <Local.desitka>>
      If (<
local.desitka> = 100)
         
Src.f_Sys_Green <Def.fatal_uspech>
     
Tag0.Exp += f_1k10_100        // bonus exps per level per 1k10 at 100% - Fatal success
      
EndIf
   ElseIf (<
local.desitka> > 1) && (<local.desitka> < 20)
   
// Fail mining
      
Src.f_Msg_Cyan <Src.Sex <Def.hodil>/<Def.hodila>> jsi na <Def.hornictvi> <Eval <Local.desitka>>
      
Src.f_Msg_Gray <Def.chvili>
      
Src.f_Msg_Gray <Def.nenachazis>
   ElseIf (<
local.desitka> < 2)
   
// Fatal Failure
      // Here I want to finish the bucket break when I set it in def files for equip
      
Src.f_Msg_Cyan <Src.Sex <Def.hodil>/<Def.hodila>> jsi na <Def.hornictvi> <Eval <Local.desitka>>
      
Src.f_Msg_Red <Def.fatal_neuspech>
      
Serv.Log Hrac hodil Fatalni neuspech v <Src.TargP.Region.Namea zlamal si lopatu.
   EndIf
EndIf

[
ITEMDEF i_Shovel_Sand]
id=i_Shovel
name
=Shovel for sand
TYPE
=t_weapon_mace_pick
FLIP
=1
VALUE
=20
WEIGHT
=6.0
RESOURCES
=4 i_ingot_iron,2 i_Log
SKILLMAKE
=Tinkering 20.0,t_tinker_tools

CATEGORY
=Provisions Tools D&D
SUBSECTION
=Mining
DESCRIPTION
=Shovel for sand
ReqStr
=1
DUPELIST
=0f3a
//CanUse=can_u_human|can_u_elf
TEVENTS=t_Mining_Sand

ON
=@Create
   HITPOINTS
={150 250}
   
UsesMax=100
   Color
=color_o_mytheril

[Eof
(This post was last modified: 05-05-2019 02:39 AM by golfin.)
05-05-2019 02:37 AM
Visit this user's website Find all posts by this user Like Post Quote this message in a reply
Post Reply 


Forum Jump:


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