SphereCommunity
Smelt ore (2 ores smelt to one ingot) - Printable Version

+- SphereCommunity (https://forum.spherecommunity.net)
+-- Forum: Sphere 0.56d (/Forum-Sphere-0-56d)
+--- Forum: Script Help (/Forum-Script-Help)
+--- Thread: Smelt ore (2 ores smelt to one ingot) (/Thread-Smelt-ore-2-ores-smelt-to-one-ingot)



Smelt ore (2 ores smelt to one ingot) - Breaker - 05-03-2013 03:39 PM

Is there a way to control resources for smelting ore into ingots?
i want make: 1 ingot = 2 ores
and if player not have 2 ores (RESTEST 2 i_ore_iron) for smelt, then player will see message about shortage amount

rewrite types t_ore and t_forge, still what variants?


RE: Smelt ore (2 ores smelt to one ingot) - Mordaunt - 05-03-2013 09:59 PM

Code:
[ITEMDEF 01bef]
//DEFNAME2=INGOTS
//DEFNAME2=IRON_INGOT
DEFNAME=i_ingot_iron  
TYPE=T_INGOT
RESOURCES=2 i_ore_iron  <------
SKILLMAKE=20.0 MINING
TDATA1=20.0
TDATA2=50.0
WEIGHT=2
DUPELIST=01bf0,01bf1,01bf2,01bf3,01bf4
CATEGORY=Items by Professions
SUBSECTION=Blacksmiths
DESCRIPTION=Iron Ingot



RE: Smelt ore (2 ores smelt to one ingot) - Breaker - 05-05-2013 09:01 PM

It does not work, I had already tried
Please advise before checking works or not ...


RE: Smelt ore (2 ores smelt to one ingot) - Rizz - 05-07-2013 11:50 PM

I used this script for make 1 ingot from 10 ores.

PHP Code:
[ITEMDEF i_ore_coal]
ID=i_ore_iron
NAME
=Coal Ore
SKILLMAKE
=MINING 99.0
TDATA1
=i_ingot_steel
VALUE
=15

ON
=@Create
    COLOR
=0989
    
ON
=@DCLICK
LOCAL
.amount=<amount>
FORITEMS 3
    
IF (<TYPE>==t_forge)
        
LOCAL.lega=<DLOCAL.amount>*10
        
IF (<src.restest <DLOCAL.legai_ore_iron>)
            
src.consume <DLOCAL.legai_ore_iron
            
return 0
        
ELSE 
            
src.message @,3,1 You need 10 iron ore and 1 coal ore to make a steel ingot
            
return 1
        
ENDIF
    ENDIF
ENDFOR 



RE: Smelt ore (2 ores smelt to one ingot) - Breaker - 05-28-2013 07:07 AM

i make that:
Code:
[TYPEDEF t_ore]
ON=@DClick
IF (!<SRC.IsNearType,t_forge,2>)
   SRC.SYSMESSAGE You must be near a forge to smelt.
ELIF (!<SRC.RESTEST <SERV.ITEMDEF.<TDATA1>.RESOURCES>>)
   SRC.SYSMESSAGE You do not have enough <NAME> to smelt.
ELSE
   SERV.NEWITEM=i_fire
   NEW.ATTR=attr_decay
   NEW.P=<SRC.IsNearType.P,t_forge,2>
   NEW.NUDGEUP=8
   NEW.UPDATEX
   NEW.TIMER=1
   SRC.FACE=<NEW>
   SRC.EMOTE smelt <NAME>
   SRC.SOUND=84
   LOCAL.AMOUNT=<SRC.RESCOUNT <SERV.ITEMDEF.<TDATA1>.RESOURCES.0.KEY>> / <SERV.ITEMDEF.<TDATA1>.RESOURCES.0.VAL>
   SERV.NEWITEM=<TDATA1>,<dLOCAL.AMOUNT>,<SRC.BACKPACK>
   SRC.CONSUME=<EVAL (<dLOCAL.AMOUNT> * <SERV.ITEMDEF.TDATA1>.RESOURCES.0.VAL>)> <SERV.ITEMDEF.<TDATA1>.RESOURCES.0.KEY>
ENDIF
RETURN 1

[TYPEDEF t_forge]
ON=@DClick
IF (<DISTANCE> > 2)
   SRC.SYSMESSAGE You must be near a forge to melt.
ELSE
   TARGET What do you want melt?
ENDIF
RETURN 1

ON=@TargOn_Item
IF (<ARGO.TYPE>!=t_ore)
   RETURN 0
ELIF (<DISTANCE> > 2)
   SRC.SYSMESSAGE You must be near a forge to smelt.
ELIF (!<SRC.RESTEST <SERV.ITEMDEF.<ARGO.TDATA1>.RESOURCES>>)
   SRC.SYSMESSAGE You do not have enough <ARGO.NAME> to smelt.
ELSE
   SERV.NEWITEM=i_fire
   NEW.ATTR=attr_decay
   NEW.P=<P>
   NEW.NUDGEUP=8
   NEW.UPDATEX
   NEW.TIMER=1
   SRC.FACE=<NEW>
   SRC.EMOTE smelt <ARGO.NAME>
   SRC.SOUND=84
   LOCAL.AMOUNT=<SRC.RESCOUNT <SERV.ITEMDEF.<ARGO.TDATA1>.RESOURCES.0.KEY>> / <SERV.ITEMDEF.<ARGO.TDATA1>.RESOURCES.0.VAL>
   SERV.NEWITEM=<ARGO.TDATA1>,<dLOCAL.AMOUNT>,<3SRC.BACKPACK>
   SRC.CONSUME=<EVAL (<dLOCAL.AMOUNT> * <SERV.ITEMDEF.<ARGO.TDATA1>.RESOURCES.0.VAL>)> <SERV.ITEMDEF.<ARGO.TDATA1>.RESOURCES.0.KEY>
ENDIF
RETURN 1