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
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
Post Reply 


Messages In This Thread
Act on base function REPAIR - Rizz - 03-01-2014, 09:00 AM
RE: Act on base function REPAIR - Ben - 03-01-2014 12:25 PM
RE: Act on base function REPAIR - Rizz - 03-01-2014, 11:07 PM
RE: Act on base function REPAIR - Ben - 03-01-2014, 11:30 PM

Forum Jump:


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