kn4tseb
Master
Posts: 392
Likes Given: 45
Likes Received: 10 in 10 posts
Joined: May 2014
Reputation: 0
|
RE: refering item from pos or similar.
OK this is pretty much what i did ... but its so far away from a simulation of mining, i might have to put the most part on a function so i can have a delay with the anim and mining sound, maybe a timer, would you help me a bit?
TY
PD: i did it this way because i want this tool to act not as a mining tool that extract resources, just to check veins, so no resource is gathered until the spot is mined.
a lot of checks like distance, LOS, etc, needs to be added...
Code:
ON=@Targon_ground
IF (<baseid> == i_hammer_prospector_tool)
IF (<serv.itemdef.<argn1>.type> == t_rock)
args = <serv.regiontype.r_default_rock.resources>
local.oremore1 = <r1,15>
serv.newitem i_worldgem_bit
src.anim 11
ref1 = <new>
ref1.attr 092
ref1.type t_rock
ref1.more1 = <streat <argv[<local.oremore1>]>>
ref1.timer <eval <serv.regionresource.<streat <argv[1]>>.regen>>
ref1.p <src.targp>
ref1.fix
for x 1 15
if (<ref1.more1> == <streat <argv[<dlocal.x>]>>)
if (<src.mining> >= <eval { <serv.regionresource.<streat <argv[<dlocal.x>]>>.skill> } >)
local.success = <streat <argv[<eval <dlocal.x>+1>]>>
local.amount = <eval { <serv.regionresource.<streat <argv[<dlocal.x>]>>.amount> } >
endif
endif
endfor
if (<local.success>)
ref1.more1 = <local.success>
ref1.amount = <local.amount>
src.sysmessage You have found a vein of <serv.itemdef.i_ore_<strsub 3 <eval strlen(<local.success>)> <local.success>>.name>
else
src.sysmessageloc -1,503043
ref1.amount = 0
endif
return 1
ENDIF
ENDIF
(This post was last modified: 07-18-2014 03:15 PM by kn4tseb.)
|
|
07-18-2014 03:14 PM |
|
|
kn4tseb
Master
Posts: 392
Likes Given: 45
Likes Received: 10 in 10 posts
Joined: May 2014
Reputation: 0
|
RE: refering item from pos or similar.
think this is the best way i could have it done:
Code:
ON=@SkillStart
IF (<src.weapon.baseid> == i_hammer_prospector_tool)
IF (<argn1> == 45)
src.sysmessage You have found a vein, dig deeper to check what type of ore it has.
src.anim 11
DORAND 2
sound 293
sound 294
ENDDO
return 1
ENDIF
ENDIF
ON=@Targon_Ground
IF (<baseid> == i_hammer_prospector_tool) && (<serv.itemdef.<argn1>.type> == t_rock)
IF <SRC.DISTANCE <SRC.TARGP>> > 2
SRC.SYSMESSAGE That is too far away.
RETURN 1
ENDIF
IF !<SRC.CANSEELOS <SRC.TARGP>>
SRC.SYSMESSAGE I cannot see that, how am i supposed to mine it?
RETURN 1
ENDIF
ENDIF
ON=@RegionResourceFound
IF (<src.weapon.baseid> == i_hammer_prospector_tool)
IF (<argo.type> == t_rock)
ref1=<argo>
src.weapon.tag0.uses -= 1
src.weapon.tag0.updatex
IF (<src.weapon.dtag0.uses> < 1)
src.weapon.remove
ENDIF
IF strmatch(*r_default_rock*,<src.region.events>)
args = <serv.regiontype.r_default_rock.resources>
for x 0 16
if (<ref1.more1> == <streat <argv[<dlocal.x>]>>)
local.success = <streat <argv[<eval <dlocal.x>+1>]>>
endif
endfor
if (<ref1.more1> == mr_nothing)
ref1.amount = <EVAL { <SERV.REGIONRESOURCE.MR_IRON.AMOUNT> } >
endif
if (<local.success>)
ref1.more1 = <local.success>
endif
ELIF strmatch(*r_dungeon*,<src.region.events>)
if (<ref1.more1> == mr_iron)
ref1.more1 = mr_shadow
elif (<ref1.more1> == mr_nothing)
ref1.more1 = mr_iron
ref1.amount = <EVAL { <SERV.REGIONRESOURCE.MR_IRON.AMOUNT> } >
endif
ENDIF
ENDIF
ENDIF
Dunno for the moment what other checks are missing.
(This post was last modified: 07-19-2014 09:27 AM by kn4tseb.)
|
|
07-19-2014 07:18 AM |
|
|
Lightsource
Apprentice
Posts: 9
Likes Given: 2
Likes Received: 1 in 1 posts
Joined: Dec 2013
Reputation: 0
|
RE: refering item from pos or similar.
|
|
02-04-2017 03:56 AM |
|
|