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
Act on base function REPAIR
Author Message
Rizz
Master
**

Posts: 396
Likes Given: 21
Likes Received: 14 in 9 posts
Joined: Oct 2012
Reputation: 0



Post: #1
Act on base function REPAIR
Is possible to act on this function?
I saw that when you repair some items, i.e. blacksmith, it takes the same amount of ingots whether you have to repair 1hits or more.

Can i change it somewhere (maybe items related proprieties) or i need to create a replacement one?
03-01-2014 09:00 AM
Find all posts by this user Like Post Quote this message in a reply
Ben
Sphere Developer
*****

Posts: 612
Likes Given: 2
Likes Received: 123 in 70 posts
Joined: Mar 2010
Reputation: 18

SphereCommunity

Post: #2
RE: Act on base function REPAIR
Best way is to override the repair function.
This is an example of an old script I had on my shard of a custom repair function.
I had replaced the repair function with repairfix in the blacksmith menu, but there are other ways to do that now like overriding the repair function with the CommandTrigger INI setting, and this can definitely be updated Smile

Code:
[FUNCTION REPAIRFIX]
TARGETF f_repaire
SRC.SYSMESSAGE What would you like to repair?
RETURN 1

[FUNCTION f_repaire]
obj=<argo.uid>
LOCAL.AMOUNTFIX <EVAL <EVAL <EVAL <obj.MORE1H>+-<obj.HITPOINTS>>/4>+1>
FORITEMS 2
    IF (<TYPE> == t_anvil)
IF (<obj.TYPE>==t_armor)||(<obj.TYPE>==t_shield)||(<obj.TYPE>==t_weapon_mace_smith)||(<obj.TYPE>==t_weapon_mace_sharp)||(<obj.TYPE>==t_weapon_sword)||(<obj.TYPE>==t_weapon_fence)||(<obj.TYPE>==t_weapon_mace_pick)||(<obj.TYPE>==t_weapon_axe)||(<obj.TYPE>==t_weapon_mace_staff)
IF (<obj.HITPOINTS> < <obj.MORE1H>)
    IF <SRC.RESTEST <EVAL <LOCAL.AMOUNTFIX>> <obj.RESOURCES.1.KEY>>
    obj.HITPOINTS=<obj.MORE1H>
    SRC.CONSUME <EVAL <LOCAL.AMOUNTFIX>> <obj.RESOURCES.1.KEY>
    SRC.EMOTE repair <obj.NAME>
    SRC.SOUND 02a
    SRC.ANIM 13
    SERV.NEWITEM i_repairsound
    NEW.CONT=<SRC.UID>
    RETURN 1
    ELSE
    SRC.SYSMESSAGE You don't have enough resources to repair that
    RETURN 1
    ENDIF
ELSE
SRC.SYSMESSAGE This item is already in full repair
RETURN 1
ENDIF
ELSEIF (<obj.TYPE>==t_ingot)
SRC.SYSMESSAGE Double Click this item to craft something!
RETURN 1
ELSE
SRC.SYSMESSAGE This item can't be repaired with this
RETURN 1
ENDIF
    RETURN 1
    ENDIF
ENDFOR
SRC.SYSMESSAGE You must be near an anvil
RETURN 1

[ITEMDEF i_repairsound]
ID=i_memory
TYPE=t_eq_script
LAYER=layer_special

ON=@Create
TIMER=1

ON=@TIMER
CONT.SOUND 02a
CONT.ANIM 13
REMOVE
RETURN 1

AxisII's current version: 2.0.4j
AxisII SourceCode on Github
AxisII up to date changelog
03-01-2014 12:25 PM
Visit this user's website Find all posts by this user Like Post Quote this message in a reply
Rizz
Master
**

Posts: 396
Likes Given: 21
Likes Received: 14 in 9 posts
Joined: Oct 2012
Reputation: 0



Post: #3
RE: Act on base function REPAIR
Hey thx a lot for your answer!
CommandTrigger will also replace a specific function written in the scripts?

i.e.

PHP Code:
ON=i_ANVIL Repair    // pretty much anyone can attempt to repair.
TEST=BLACKSMITHING 1.0
REPAIR 

or it just works for in game commands only?
(This post was last modified: 03-01-2014 11:08 PM by Rizz.)
03-01-2014 11:07 PM
Find all posts by this user Like Post Quote this message in a reply
Ben
Sphere Developer
*****

Posts: 612
Likes Given: 2
Likes Received: 123 in 70 posts
Joined: Mar 2010
Reputation: 18

SphereCommunity

Post: #4
RE: Act on base function REPAIR
ok CommandTrigger will only change ingame commands... bust I just remembered that if you name your function the same as another one, it will override it, even if that function is hardcoded.

so you can do a [FUNCTION repair] and it will replace the hardcoded one.

AxisII's current version: 2.0.4j
AxisII SourceCode on Github
AxisII up to date changelog
03-01-2014 11:30 PM
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: 3 Guest(s)