Blacksmithing and Skillmenus - Jonaleth - 08-09-2014 10:34 PM
I've encoutnered a problem, that I cannot get fixed no matter how. Perhaps you can help me out?
I have added new materials to craft armors and weapons from. It worked fine at first, but then I wanted to modify the blacksmith system.
The new system requires coal to lit a forge inorder for it to be used.
Code:
[ITEMDEF 0fb1]
//forge
//**Is there a type for this? Smithing type?
DEFNAME=i_forge
TYPE=T_FORGE
RESOURCES=20 i_rock_plain, 30 i_KINDLING
WEIGHT=500
CATEGORY=Items by Professions
SUBSECTION=Blacksmiths
DESCRIPTION=Forge 1
ON=@DCLICK
IF <tag0.lit> > 0
message @036 Forge is already lit
RETURN 1
ELSE
IF (<src.restest <DLOCAL.lega> i_coal>)
sound=550
src.consume <DLOCAL.lega> i_coal
src.sysmessage @031 It cost 1 coal to lit the forge
src.newitem i_forge_fire
new.p=<p>
new.nudgeup 8
new.link=<src.uid>
new.timer=60*10
src.say @036 <name> is lit and ready to be used
tag0.lit=1
return 1
ELSE
message @025 You need to have the coal in your backpack
return 1
ENDIF
ENDIF
And once the forge is lit, you can use the anvil (I couldn't find a way to give a message if you were further away then 3, perhaps that can be solved somehow, but that'd be a bonus).
Code:
[ITEMDEF 0faf]
//anvil
DEFNAME=i_anvil
TYPE=T_ANVIL
SKILLMAKE=BLACKSMITHING 30.0, TINKERING 56.0,t_tinker_tools
RESOURCES=20 i_ingot_iron, 1 i_LOG
FLIP=1
WEIGHT=255
CATEGORY=Items by Professions
SUBSECTION=Blacksmiths
DESCRIPTION=Anvil (N)
DUPELIST=0fb0
ON=@DCLICK
FORITEMS 3
WHILE <tag0.lit> == 01
src.SKILLMENU=sm_blacksmith
RETURN 1
ENDWHILE
ENDFOR
Now here's the problem. I won't let me to craft anything! Here take a look;
Code:
[SKILLMENU sm_blacksmith]
Blacksmithing
ON=i_ANVIL Repair
TEST=BLACKSMITHING 1.0
REPAIR
ON=i_rock_plain Stone Items
SKILLMENU=sm_items_stone
[SKILLMENU sm_items_stone]
Stone Items
ON=i_sword_viking Weapons
SKILLMENU=sm_weapons_stone
ON=i_bone_chest Armors
SKILLMENU=sm_stonearmor_armor
[SKILLMENU sm_weapons_stone]
Stone Weapons
ON=i_gold Info
sysmessage @025 Stone weapons
ON=i_stone_dagger <name> (<resmake>)
MAKEITEM=i_stone_dagger
ON=i_stone_sword_broad <name> (<resmake>)
MAKEITEM=i_stone_sword_broad
ON=i_stone_sword_2h <name> (<resmake>)
MAKEITEM=i_stone_sword_2h
ON=i_stone_axe <name> (<resmake>)
MAKEITEM=i_stone_axe
ON=i_stone_axe_large <name> (<resmake>)
MAKEITEM=i_stone_axe_large
ON=i_stone_mace <name> (<resmake>)
MAKEITEM=i_stone_mace
ON=i_stone_maul <name> (<resmake>)
MAKEITEM=i_stone_maul
ON=i_stone_hammer_war <name> (<resmake>)
MAKEITEM=i_stone_hammer_war
[SKILLMENU sm_stonearmor_armor]
Stone Armor
ON=i_gold Info
sysmessage @025 Stone armors
ON=i_stone_helm <name> (<resmake>)
MAKEITEM=i_stone_helm
ON=i_stone_chest <name> (<resmake>)
MAKEITEM=i_stone_chest
ON=i_stone_bracers <name> (<resmake>)
MAKEITEM=i_stone_bracers
ON=i_stone_gauntlets <name> (<resmake>)
MAKEITEM=i_stone_gauntlets
ON=i_stone_legguards <name> (<resmake>)
MAKEITEM=i_stone_legguards
I added the gold coin just to see if the skillmenu works at all, and it does. That is the only item that shows up in the skillmenu. So then i thought perhaps I don't have the material needed to craft these stone items.
I added 100 i_stone and tried to craft this;
Code:
[ITEMDEF i_stone_helm]
ID=i_helm_open
NAME=Stone Helmet
TYPE=T_ARMOR
RESOURCES=15 i_stone
WEIGHT=12
ARMOR=20
REQSTR=40
SKILLMAKE=BLACKSMITHING 30.0
CATEGORY=Equipments - Armor
SUBSECTION=Stone Armor
DESCRIPTION=Helmet
ON=@Create
COLOR=color_o_stone
HITPOINTS={30 40}
But it won't show up on the skillmenu. What have I missed?
RE: Blacksmithing and Skillmenus - Skul - 08-10-2014 01:04 AM
Try lighting the forge and checking for the anvil when tryting to craft with blacksmithing, example:
Code:
[events e_blacksmithing]
on=@itemdclick
if (<act.type>==t_ingot) || (<act.baseid>==i_stone)
if (<findlayer.1.type>==t_weapon_mace_smith) || (<findlayer.2.type>==t_weapon_mace_smith)
if (<isnearlitforge>)
if (<isneartype t_anvil 3>)
skillmenu sm_blacksmith
else
sysmessage You must be near an anvil to do that.
endif
return 1
endif
if (<restest 1 i_coal)
local.uid=<uid>
foritems 3
if !(<local.lit>)
if (<type>==t_forge)
serv.newitem=i_forge_fire
new.attr=attr_move_never|attr_decay
new.p=<p.x>,<p.y>,<eval <z> +7>,<map>
new.link=<local.uid>
new.timer=<eval 60*10>
tag.lit=1
timerf <eval 60*10>, tag.lit=
local.lit=1
trysrc <local.uid> uid.<local.uid>.message @036 <name> is lit and ready to be used.
uid.<local.uid>.consume 1 i_coal
endif
endif
endfor
if (<local.lit>)
if (<isneartype t_anvil 3>)
skillmenu sm_blacksmith
else
sysmessage You must be near an anvil to do that.
endif
else
sysmessage You need to light a forge with coal to do that.
endif
else
sysmessage You need coal to do that.
endif
else
sysmessage You must weild a smith's hammer to do that.
endif
return 1
endif
on=@itemtargon_item
if (<targ.type>==t_ingot) || (<targ.baseid>==i_stone)
if (<act.type>==t_weapon_mace_smith)
if (<isnearlitforge>)
if (<isneartype t_anvil 3>)
skillmenu sm_blacksmith
else
sysmessage You must be near an anvil to do that.
endif
return 1
endif
if (<restest 1 i_coal)
local.uid=<uid>
foritems 3
if !(<local.lit>)
if (<type>==t_forge)
serv.newitem=i_forge_fire
new.attr=attr_move_never|attr_decay
new.p=<p.x>,<p.y>,<eval <z> +7>,<map>
new.link=<local.uid>
new.timer=<eval 60*10>
tag.lit=1
timerf <eval 60*10>, tag.lit=
local.lit=1
trysrc <local.uid> uid.<local.uid>.message @036 <name> is lit and ready to be used.
uid.<local.uid>.consume 1 i_coal
endif
endif
endfor
if (<local.lit>)
if (<isneartype t_anvil 3>)
skillmenu sm_blacksmith
else
sysmessage You must be near an anvil to do that.
endif
else
sysmessage You need to light a forge with coal to do that.
endif
else
sysmessage You need coal to do that.
endif
else
sysmessage You must weild a smith's hammer to do that.
endif
return 1
endif
[function isnearlitforge]
foritems 3
if (<type>==t_forge)
if (<tag0.lit>)
local.return=1
endif
endif
endfor
return <dlocal.return>
*untested*
RE: Blacksmithing and Skillmenus - Jonaleth - 08-10-2014 02:02 AM
Thank you! I will try this sollution that is far more advance than mine. But the lit forge and use anvil works fine. I've tested by chanching the src.skillmenu to src.message success. It is my skillmenu that wont work.
The skillmenu works if i change all makeitem to message you crafted a stone sword. But for some unknown reason it wont work when i put a option with a makeitem, as if i dont have the skill requirement or resourses. But ive put all skills to 100.0 and given myself plenty of resourses.
RE: Blacksmithing and Skillmenus - Skul - 08-10-2014 02:24 AM
That's because sphere's default behavior to open sm_blacksmith is for types t_ingot. Since i_stone is not type t_ingot sphere ignores it.
RE: Blacksmithing and Skillmenus - Jonaleth - 08-10-2014 02:50 AM
But that just cannot be the problem, because i_stone is t_ingot;
Code:
[ITEMDEF i_stone]
ID=019ba
NAME=Stone
TYPE=t_ingot
SKILLMAKE=MINING 1.0
TDATA1=i_stone
WEIGHT=1
VALUE=2
DUPELIST=i_stone,i_stone_m,i_stone_b
CATEGORY=Items by Professions
SUBSECTION=Blacksmiths
DESCRIPTION=Stone (Small Pile)
ON=@CREATE
color=0076e
But even if it wasn't t_ingot, i do not enter the skillmenu through i_stone. its by dclicking on i_anvil;
Code:
///////////
// ANVIL //
///////////
[ITEMDEF 0faf]
//anvil
DEFNAME=i_anvil
TYPE=T_ANVIL
SKILLMAKE=BLACKSMITHING 30.0, TINKERING 56.0,t_tinker_tools
RESOURCES=20 i_ingot_iron, 1 i_LOG
FLIP=1
WEIGHT=255
CATEGORY=Items by Professions
SUBSECTION=Blacksmiths
DESCRIPTION=Anvil (N)
DUPELIST=0fb0
ON=@DCLICK
FORITEMS 3
WHILE <tag0.lit> == 01
src.SKILLMENU=sm_blacksmith
RETURN 1
ENDWHILE
ENDFOR
The problem is not the smithing system itself, the sm_blacksmith skillmenu comes up, the issue is the only thing i can do i repair, none of them items show up on the skillmenu. Even if I have the skill and materials.
RE: Blacksmithing and Skillmenus - Skul - 08-10-2014 02:52 AM
Try adding t_weapon_mace_smith to your SKILLMAKE on your stone weapons and armor, example:
Code:
SKILLMAKE=BLACKSMITHING 30.0, t_weapon_mace_smith
RE: Blacksmithing and Skillmenus - Jonaleth - 08-10-2014 03:28 AM
Still not working... 
Here's the issue;
Code:
[SKILLMENU sm_blacksmith]
Blacksmithing
ON=i_ANVIL Repair
TEST=BLACKSMITHING 1.0
REPAIR
ON=i_ingot_iron Ingots
SKILLMENU=sm_ingots
ON=i_rock_plain Stone Items
SKILLMENU=sm_items_stone
This works just fine, then I choose to enter the Stone Item menu;
Code:
[SKILLMENU sm_items_stone]
Stone Items
ON=i_sword_viking Weapons
SKILLMENU=sm_weapons_stone
ON=i_bone_chest Armors
SKILLMENU=sm_stonearmor_armor
This works as well, but it is in these two menus the problem appears;
Code:
[SKILLMENU sm_weapons_stone]
Stone Weapons
ON=i_gold Info // <---- THIS WORKS!
sysmessage @025 Stone weapons // <---- THIS WORKS!
ON=i_stone_dagger <name> (<resmake>)
MAKEITEM=i_stone_dagger
ON=i_stone_sword_broad <name> (<resmake>)
MAKEITEM=i_stone_sword_broad
ON=i_stone_sword_2h <name> (<resmake>)
MAKEITEM=i_stone_sword_2h
ON=i_stone_axe <name> (<resmake>)
MAKEITEM=i_stone_axe
ON=i_stone_axe_large <name> (<resmake>)
MAKEITEM=i_stone_axe_large
ON=i_stone_mace <name> (<resmake>)
MAKEITEM=i_stone_mace
ON=i_stone_maul <name> (<resmake>)
MAKEITEM=i_stone_maul
ON=i_stone_hammer_war <name> (<resmake>)
MAKEITEM=i_stone_hammer_war
[SKILLMENU sm_stonearmor_armor]
Stone Armor
ON=i_gold Info // <---- THIS WORKS!
sysmessage @025 Stone armors // <---- THIS WORKS!
ON=i_stone_helm <name> (<resmake>)
MAKEITEM=i_stone_helm
ON=i_stone_chest <name> (<resmake>)
MAKEITEM=i_stone_chest
ON=i_stone_bracers <name> (<resmake>)
MAKEITEM=i_stone_bracers
ON=i_stone_gauntlets <name> (<resmake>)
MAKEITEM=i_stone_gauntlets
ON=i_stone_legguards <name> (<resmake>)
MAKEITEM=i_stone_legguards
Only the two gold coins show in the skillmenu, but no other items does. It did work with the standard blacksmithsystem, where you just dclick on the smith hammer and target i_stone. But not by dclicking on the anvil, according to the script I posted above...
If you have any idea what causes this problem and how to solve it, I'd be most interested in knowing how... otherwise, is there a way to use the standard blacksmith system and implement the "forge lit by coal".
RE: Blacksmithing and Skillmenus - Jonaleth - 08-10-2014 06:59 AM
Ok, I got it fixed with help of your code. BUT there is one problem (which I can cope with);
If I dclick on stone then I can only craft stone items, even if I have other materials.
If i dclick on iron ingots, then i can only craft iron items, even if I have other materials.
This works, but not how I planned. I will have some gems that can be used in certain items, that means that I have to make all gems to ingots (inorder for them to be used in crafting). Which is not fantastic, but... I will have to work it out somehow.
UNLESS you have a sullotion? :-)
RE: Blacksmithing and Skillmenus - Skul - 08-10-2014 09:35 AM
As for gems, use t_weapon_mace_smith in your SKILLMAKE for those itemdefs. That will sort out your problem.
As for the script I posted, I'm glad it works, although it does not include any functionality for @dclick an anvil.
RE: Blacksmithing and Skillmenus - Jonaleth - 08-10-2014 03:55 PM
Thank you. Yeah no dclick om anvils. Ill just have to live with that I guess. The problem i guess is that I must dclick on the material that i will craft something from. That would answer why no items show up when Entering the skillmenu through the anvil.
...but that still sounds weird to me.
|