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:
  • 1 Votes - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Creating New Gathering Skill
Author Message
Archaaz
Journeyman
*

Posts: 98
Likes Given: 12
Likes Received: 4 in 4 posts
Joined: Aug 2013
Reputation: 1



Post: #1
Creating New Gathering Skill
I am trying to create a new gathering skill, but do not want it attached to any of the other gathering skills. The idea is to create a Foraging skill that can be triggered by ON=@DClick a particular item (perhaps some sort of special knife), and then being able to @TARGON on a variety of new Region Resource Types and gather certain Resources (mostly reagents, but a few others as well).

I have been looking through the Sphere files, and read both the Scripting tutorial and the Making Your Own Skills tutorial, and have a few questions. I am not sure I am on the right track or not. I understand how to create the item (knife) for the trigger, and have discovered a lot of pieces, but I am not sure exactly how they fit, or rather where the actual meat of the script is supposed to go, or if it works in some other manner.

1. Is it possible to create such a skill, unconnected to the others?
2. If so, is there an actual script behind the gathering skills (I cannot seem to find any, beyond the basics in the Script folder) I can use as an example?

Slightly modified Lumberjacking Skill (I left the numbers the same):
Quote:[SKILL --]
DEFNAME=SKILL_FORAGING
FLAGS=SKF_SCRIPTED
KEY=Lumberjacking
TITLE=Forager (working title)
PROMPT_MSG=
DELAY=1.0
STAT_STR=85
STAT_INT=30
STAT_DEX=45
BONUS_STR=90
BONUS_DEX=10
BONUS_INT=0
BONUS_STATS=20
ADV_RATE=2.5,50.0,200.0
VALUES=1,10,50

ON=@Fail
SRC.SYSMESSAGE @,,2 500495

ON=@Abort
SRC.SYSMESSAGE You decide not to forage for now.

[eof]

3. Can the Key be changed to Foraging? Is this merely the skill level?
4. What causes the Lumberjacking skill to trigger when an equipped axe is d-clicked, and from what file? I do not see any such triggers looking through the items (axes and bladed)

Resource to be Gathered:
Quote:[ITEMDEF 0f7b]
//Blood Moss
DEFNAME=i_reag_blood_moss
TYPE=T_REAGENT
VALUE=3
PILE=1
WEIGHT=.1
CATEGORY=Provisions - Alchemy & Magic
SUBSECTION=Reagents - Normal
DESCRIPTION=Blood Moss

Item to Be Harvested From (Targeted):
Quote:[ITEMDEF 0cf3]
//fallen log
DEFNAME=i_log_fallen
VALUE=1
CATEGORY=Vegetation
SUBSECTION=Trees
DESCRIPTION=Fallen Log

Sphere_Types
Quote:[TYPEDEF t_fallen_log]
TERRAIN = 0cf3
(and various sister items and dupes)

5. Can an Item be made a Terrain Type in this manner?

Sphere_Region
Quote:[REGIONTYPE r_default_fallen_log t_fallen_log]
// Default fallen log area resources
RESOURCES=5.0 mr_blood moss

Sphere_Region_Resource
Quote:[REGIONRESOURCE mr_fallen_log]
// t_fallen_log
skill=85.0,100.0
amount=1,5
reap=i_blood_moss
regen=60*60*2
09-05-2013 03:44 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: Creating New Gathering Skill
Adding a completely new skill can cause clients problem, it's better to change one of the many useless skills ( in your case, i think that Camping is perfect). Also your skill will be not be displayed in the skill menu !
The KEY field is important, it's used by other objects like items,characters and so on, if you change it you'll have to change all the other scripts where it's used.

I'll add more after dinner Shock
(This post was last modified: 09-05-2013 04:24 AM by darksun84.)
09-05-2013 04:24 AM
Find all posts by this user Like Post Quote this message in a reply
RanXerox
Master
**

Posts: 550
Likes Given: 1
Likes Received: 12 in 9 posts
Joined: Dec 2010
Reputation: 19



Post: #3
RE: Creating New Gathering Skill
Quote:4. What causes the Lumberjacking skill to trigger when an equipped axe is d-clicked, and from what file? I do not see any such triggers looking through the items (axes and bladed)

The Axe has a TYPE (t_weapon_axe or t_weapon_sword both work)... the hard-coded behavior of that TYPE is what allows it to trigger the lumberjacking skill.

For your new harvesting skill, I would suggest making your own TYPEDEF that can be added to your item of choice (by adding a TEVENT=t_yourtype to the ITMDEF.)

Quote:5. Can an Item be made a Terrain Type in this manner?

No, you cannot add ITEMDEF values to the entries in sphere_types.scp ... the numbers in there are associated to "terrain", not items...

For you to harvest from static logs in the world, you would use REGIONTYPE and REGIONRESOURCES. In the REGIONRESOURCES you can put some code in @ResourceTest and @ResourceFound triggers that uses a FOR loop through the <SRC.TARGP.STATICS> of the location that was targetted to see if a fallen log is there...
FOR <SRC.TARGP.STATICS>

Maybe you can get some more ideas from this thread: http://forum.spherecommunity.net/Thread-...pe-of-tree
(This post was last modified: 09-05-2013 05:25 AM by RanXerox.)
09-05-2013 05:21 AM
Find all posts by this user Like Post Quote this message in a reply
Archaaz
Journeyman
*

Posts: 98
Likes Given: 12
Likes Received: 4 in 4 posts
Joined: Aug 2013
Reputation: 1



Post: #4
RE: Creating New Gathering Skill
[quote='darksun84' pid='12294' dateline='1378319041']
Adding a completely new skill can cause clients problem, it's better to change one of the many useless skills ( in your case, i think that Camping is perfect). Also your skill will be not be displayed in the skill menu !
The KEY field is important, it's used by other objects like items,characters and so on, if you change it you'll have to change all the other scripts where it's used.

I'll add more after dinner Shock
[/quote]

Thanks! This was also the case with POL, which I was looking into before. I have a list of skills I hope to implement by changing certain other skills (some new weapon specific combat skills, druidry, this foraging skill, a bard magic system, another magic system, and a marksmanship skill to work with archery, among possible others).

For the shard I am trying to create, there are a quite a few skills that I do not need or want including some that are not considered useless (even the bard skills and possibly stealing and snooping). Camping might indeed be a good choice, though it likewise might not be as useless in my shard as in other shards, with some of the changes I am considering making to my shard.

Good to know about the KEY field. It is a shame about the the new names not appearing in the skill menu. I had read in this thread: What did you do with camping?, that Rayvolution had discovered a way around this:

[quote='Rayvolution' pid='5670' dateline='1347857901'] I have a custom skill tree gump and custom gain systems/messages. So I can add/remove as many skills as I want with no regard to the hardcoded limits. [/quote]

A custom skill tree gump and custom gain/system messages would be a welcome addition for inserting the new names of the skills. Any idea on how to implement such a gump and system? Otherwise, I may have to curtail my ideas for skills a bit, as I think skills that do things but have totally unrelated names would detract a bit.

If not, I think I can find a work-around for most of the skills, a modified Spellweaving for Druidry, Mysticism for my other magic system, combine a few weapons systems. Still it would be nice to implement it as originally planned.

[quote='RanXerox' pid='12295' dateline='1378322469']
[quote]

The Axe has a TYPE (t_weapon_axe or t_weapon_sword both work)... the hard-coded behavior of that TYPE is what allows it to trigger the lumberjacking skill.

For your new harvesting skill, I would suggest making your own TYPEDEF that can be added to your item of choice (by adding a TEVENT=t_yourtype to the ITMDEF.)

No, you cannot add ITEMDEF values to the entries in sphere_types.scp ... the numbers in there are associated to "terrain", not items...

For you to harvest from static logs in the world, you would use REGIONTYPE and REGIONRESOURCES. In the REGIONRESOURCES you can put some code in @ResourceTest and @ResourceFound triggers that uses a FOR loop through the <SRC.TARGP.STATICS> of the location that was targetted to see if a fallen log is there...
FOR <SRC.TARGP.STATICS>

Maybe you can get some more ideas from this thread: http://forum.spherecommunity.net/Thread-...pe-of-tree
[/quote]

Thanks! That answer a lot of questions and your custom Lumberjacking script helps a lot. It is quite brilliant in its own right, and something I would like to include. I do have a question about certain items I do not want to include, in this script and in general. There are a few tree log/board types that I do not want to include, both in the script and the world in general (this extends to certain types of ores/ingots, items, creatures, even entire scripts and systems, etc.). Can I simply uncomment or delete them. Will this cause problems elsewhere?

I think I get the general picture from looking at your script, but it will require some more research and experimenting. So my new TYPEDEF would go in the Add-ONs? This is starting to make a lot more sense now. Thanks again.
(This post was last modified: 09-05-2013 02:40 PM by Archaaz.)
09-05-2013 02:23 PM
Find all posts by this user Like Post Quote this message in a reply
RanXerox
Master
**

Posts: 550
Likes Given: 1
Likes Received: 12 in 9 posts
Joined: Dec 2010
Reputation: 19



Post: #5
RE: Creating New Gathering Skill
Here is a simple example of adding a TYPEDEF to an item.

Here is the TYPEDEF that lets you cut a cake (i_cake_tiered) into 6 slices (i_cake_tiered_slice):

Code:
[TYPEDEF t_kitchenknife]
ON=@DClick
   TARGET
   RETURN 1
ON=@TargOn_Item
   IF (!STRCMPI(i_cake_tiered,<ARGO.DEFNAME>))
      IF (<ARGO.TOPOBJ>!=<SRC>)
         SRC.SYSMESSAGELOC color_text,1042001//"That must be in your backpack for you to use it."
         RETURN 1
      ENDIF
      FOR 6
         SERV.NEWITEM i_cake_tiered_slice,1,<SRC>
         NEW.COLOR=<ARGO.COLOR>
      ENDFOR
      ARGO.REMOVE
   ENDIF
   //FIXME: add more code like this for carving wheel of cheese and pie
   RETURN 1

...Here is an example of me giving this ability to all kitchen knives:

Code:
[ITEMDEF 09a5]
DEFNAME=i_knife
FLIP=1
VALUE=6
WEIGHT=0.1
RESOURCES=1 i_ingot_iron
SKILLMAKE=Tinkering 12.0,t_tinker_tools
CATEGORY=Decoration - Kitchen and Dining
SUBSECTION=Table Settings
DESCRIPTION=Butter Knife
DUPELIST=09a6,09f6,09f7
TEVENTS=t_kitchenknife

The nice thing about using TEVENTS like this is that all existing in-game i_knife objects will instantly get this new ability!

If you want to dynamically add this ability to a item in-game that normally doesn't have it, you can do that too. Just type this in-game:

.set EVENTS +t_kitchenknife

...and then target the item that you want to be able to carve cake (for example, maybe the prize for your lumberjacking contest is a carpentry saw that can cut cakes!)

Note: You can remove EVENTS from items using a - instead of the + but you can NOT remove TEVENTS from an item since they are permanently defined in the ITEMDEF itself.

Your harvesting tool would use a similar technique.

The @DClick trigger calls up the target reticule.

The @TargOn_Item would be used to detect logs that you manually placed in-game while decorating and @TargOn_Ground would detect static logs that are baked into the map itself. Both of those triggers would then trigger the skill itself (I am not precicely sure how to code that having never tried it before.)
(This post was last modified: 09-05-2013 03:19 PM by RanXerox.)
09-05-2013 03:11 PM
Find all posts by this user Like Post Quote this message in a reply
Archaaz
Journeyman
*

Posts: 98
Likes Given: 12
Likes Received: 4 in 4 posts
Joined: Aug 2013
Reputation: 1



Post: #6
RE: Creating New Gathering Skill
I used the Butcher Knife graphic (0x13f6) and renamed it. Will this affect or replace the butcher knife item, or are there now two items that share that same graphic? I know that this was not a problem in POL, but not sure with Sphere.

Quote:[ITEMDEF 0x13F6
DEFNAME=i_pruning_knife
NAME=Pruning Knife
TYPE=T_WEAPON_FENCE
FLIP=1
DAM=10,11
SPEED=2.0
SKILL=Fencing
REQSTR=10
TWOHANDS=N
WEIGHT=1
RESOURCES=3 i_ingot_iron
SKILLMAKE=BLACKSMITHING 0.0
DUPELIST=0x13F7
TEVENTS=t_pruningknife
CATEGORY=Provisions - Weapons
SUBSECTION=Daggers
DESCRIPTION=Dagger

ON=@Create
HITPOINTS={36 48}

[ITEMDEF 0x13F7]
DUPEITEM=0x13F6


Quote:[ITEMDEF 0cf3]
//fallen log
DEFNAME=i_log_fallen
VALUE=1
CATEGORY=Vegetation
SUBSECTION=Trees
DESCRIPTION=Fallen Log

[ITEMDEF 0cf4]
//fallen log
DUPEITEM=0cf3

[ITEMDEF 0cf5]
//fallen log
DUPEITEM=0cf3

[ITEMDEF 0cf6]
//fallen log
DUPEITEM=0cf3

[ITEMDEF 0cf7]
//fallen log
DUPEITEM=0cf3


Quote:REGIONTYPE r_default-fallen-log t-fallen_log
// Default fallen log resources
RESOURCES=5.0 mr_blood_moss


Quote:REGIONRESOURCE mr_fallen_log (or should it be log_fallen?)
SKILL=80.0,100.0 (what exactly does this mean?)
AMOUNT=1,5
REAP=i_blood_moss
REGEN=60*60*10


Quote:[TYPEDEF t_pruning_knife]
ON=@DClick
TARGET
RETURN 1
ON=@TargOn_Ground
If <targp.type>> == t_fallen_log
If <src.distance <src.targp>> >= 3
src.sysmessage That is too far away.
return 1
endif
If !<src.canseelos <src.targp>>
src.sysmessage You cannot see that.
return 1
endif

I am sure this is not quite right, and am a bit lost afer this. I assume it needs to perform a check against the character's Foraging Skill. Maybe:

Quote:if <r<src.foraging>> > <eval <src.foraging>

And maybe an ON=@Success command? Does it need to check whether there is enough resource to harvest, perhaps using a worldgem command?

I think I see the process, just not sure about the syntax, and what is performed automatically:

1. I have targeted an appropriate item.
2. Is there is enough of the item to harvest? If yes:
3. Is my skill high enough for the attempt? If yes:
4. Perform a skill check against Foraging (determined by Skill in RegionResource?).
5. If successful one blood moss is added to backpack.
6. On fail receive failure message in Foraging Skill file.
09-05-2013 09:48 PM
Find all posts by this user Like Post Quote this message in a reply
RanXerox
Master
**

Posts: 550
Likes Given: 1
Likes Received: 12 in 9 posts
Joined: Dec 2010
Reputation: 19



Post: #7
RE: Creating New Gathering Skill
Quote:I used the Butcher Knife graphic (0x13f6) and renamed it. Will this affect or replace the butcher knife item, or are there now two items that share that same graphic? I know that this was not a problem in POL, but not sure with Sphere.

In Sphere, only 1 "base" item should be defined. A base item looks like this:

Code:
[ITEMDEF 01234]
DEFNAME=i_whatever

...where the 01234 correlates to the tile image number in the MUL/UOP file. You can make other copies derived from that base item by doing this:

Code:
[ITEMDEF i_mywhatever]
ID=i_whatever //or you could put the number itself here

Notes:

1. In Sphere, hex number have a leading zero only... they do not also have an x like your previous post example.
2. I suggest you avoid using minus symbols in defining the names of things... the minus symbol has special meaning. Use an underscore instead.
3. You can find some details on REGIONRESOURCE properties (and other related things like that) on the wiki here: http://wiki.sphere.torfo.org/index.php/REGIONRESOURCE
4. fallen_log or log_fallen is just a personal preference... it is up to you how you name things. I personally use log_fallen just in case there will be a log_standing or log_buried, that way they will sort better when I search for stuff.
5. TARGP is a special sort of reference... to a point on the ground. As such you can't do things like TARGP.TYPE because a point on the ground is not a thing, it is a location. Try the @TargOn_Item first (where you would use TARG which is a reference to a specific thing)... and once you have that perfected, then try the ground. The wiki has some details on what specific references are available in those triggers: http://wiki.sphere.torfo.org/index.php/@TargOn_Ground http://wiki.sphere.torfo.org/index.php/@TargOn_Item
09-06-2013 01:18 AM
Find all posts by this user Like Post Quote this message in a reply
Archaaz
Journeyman
*

Posts: 98
Likes Given: 12
Likes Received: 4 in 4 posts
Joined: Aug 2013
Reputation: 1



Post: #8
RE: Creating New Gathering Skill
(09-06-2013 01:18 AM)RanXerox Wrote:  In Sphere, only 1 "base" item should be defined. A base item looks like this:

Code:
[ITEMDEF 01234]
DEFNAME=i_whatever

...where the 01234 correlates to the tile image number in the MUL/UOP file. You can make other copies derived from that base item by doing this:

Code:
[ITEMDEF i_mywhatever]
ID=i_whatever //or you could put the number itself here

Notes:

1. In Sphere, hex number have a leading zero only... they do not also have an x like your previous post example.
2. I suggest you avoid using minus symbols in defining the names of things... the minus symbol has special meaning. Use an underscore instead.
3. You can find some details on REGIONRESOURCE properties (and other related things like that) on the wiki here: http://wiki.sphere.torfo.org/index.php/REGIONRESOURCE
4. fallen_log or log_fallen is just a personal preference... it is up to you how you name things. I personally use log_fallen just in case there will be a log_standing or log_buried, that way they will sort better when I search for stuff.
5. TARGP is a special sort of reference... to a point on the ground. As such you can't do things like TARGP.TYPE because a point on the ground is not a thing, it is a location. Try the @TargOn_Item first (where you would use TARG which is a reference to a specific thing)... and once you have that perfected, then try the ground. The wiki has some details on what specific references are available in those triggers: http://wiki.sphere.torfo.org/index.php/@TargOn_Ground http://wiki.sphere.torfo.org/index.php/@TargOn_Item


Yet again ,thanks for all the information and advice. I was used to the little bit of POL programming I go into, which uses the 0X prefix, which I got from UOFiddler.

Thanks for the link. Though I had read the basic scripting tutorials, I had not made it through the various categories. These have been of immense help in a number of other areas involving what I want to do.
09-06-2013 06:47 PM
Find all posts by this user Like Post Quote this message in a reply
RanXerox
Master
**

Posts: 550
Likes Given: 1
Likes Received: 12 in 9 posts
Joined: Dec 2010
Reputation: 19



Post: #9
RE: Creating New Gathering Skill
Quote:A custom skill tree gump and custom gain/system messages would be a welcome addition for inserting the new names of the skills. Any idea on how to implement such a gump and system?

You can intercept the player clicking the Skills button on the paperdoll (or using a maco to open it) using the @UserSkills trigger: http://wiki.sphere.torfo.org/index.php/@UserSkills
09-07-2013 05:46 AM
Find all posts by this user Like Post Quote this message in a reply
Archaaz
Journeyman
*

Posts: 98
Likes Given: 12
Likes Received: 4 in 4 posts
Joined: Aug 2013
Reputation: 1



Post: #10
RE: Creating New Gathering Skill
(09-07-2013 05:46 AM)RanXerox Wrote:  
Quote:A custom skill tree gump and custom gain/system messages would be a welcome addition for inserting the new names of the skills. Any idea on how to implement such a gump and system?

You can intercept the player clicking the Skills button on the paperdoll (or using a maco to open it) using the @UserSkills trigger: http://wiki.sphere.torfo.org/index.php/@UserSkills

Thanks yet again. You have been an enormous help. I likewise discovered this thread while doing a google search:
http://forum.spherecommunity.net/Thread-...replace-it
09-07-2013 07:06 PM
Find all posts by this user Like Post Quote this message in a reply
Post Reply 


Forum Jump:


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