L2Tower Discord Let's keep the community alive with discord. Discussions about plugins and scripts L2Tower Discord

Post Reply 
 
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
WTB craft script code
Author Message
capucine Offline
Expired VIP Member
**

Posts: 1,083
Joined: Jan 2013
Reputation: 208
Version: 1.4.2.142
Post: #21
RE: WTB craft script code

(05-30-2015 13:42 PM)schubbel2208 Wrote:  hrhr my fault it should be

    LUA Programming
if (GetItemAmountByName(crystals) > 2) then
 if (GetItemAmountByName(stone) > 80) then


you should edit your previous post and make the change in the main script !
05-30-2015 19:40 PM
Find all posts by this user Quote this message in a reply
aiwaras83 Offline
Expired VIP Member
**

Posts: 29
Joined: Oct 2013
Reputation: 4
Version: 1.4.2.135
Post: #22
RE: WTB craft script code

change to this, its better for your CPU if you don't have enough MP:

Code:
repeat
Sleep(1000);
if (me:GetMp() > 258) then
if (GetItemAmountByName(crystals) > 2) then
if (GetItemAmountByName(stone) > 80) then
CraftItem(1125);

end;
end;
end;
until false
(This post was last modified: 05-31-2015 22:28 PM by aiwaras83.)
05-31-2015 22:27 PM
Find all posts by this user Quote this message in a reply
schubbel2208 Offline
Expired VIP Member
**

Posts: 154
Joined: Jun 2012
Reputation: 35
Version: 1.4.3.143
Post: #23
RE: WTB craft script code

    LUA Programming
-- credits to original author W4rGo
 
CraftStatus = false;
weigthLimit=95;
 
function OnCreate()
	this:RegisterCommand("craft", CommandChatType.CHAT_ALLY, CommandAccessLevel.ACCESS_ME);
end;
 
function OnCommand_craft(vCommandChatType, vNick, vCommandParam)
if (vCommandParam:GetCount() == 1) and (CraftStatus == false) then
	ShotType = string.lower(vCommandParam:GetParam(0):GetStr(true));
	if (ShotType == "ssa") then
 craftId=23;
 mpCost=120;
 mat1="Crystal (A-grade)";
 mat1num=1;
 mat2="Spirit Ore";
 mat2num=36; 
 CraftStatus = true;
	elseif (ShotType == "ssb") then
 craftId=22;
 mpCost=100;
 mat1="Crystal (B-Grade)";
 mat1num=1;
 mat2="Soul Ore";
 mat2num=54; 
 CraftStatus = true;
	elseif (ShotType == "ssc") then
 craftId=21;
 mpCost=84;
 mat1="Crystal (C-Grade)";
 mat1num=2;
 mat2="Soul Ore";
 mat2num=30; 
 CraftStatus = true;
	elseif (ShotType == "ssd") then
 craftId=20;
 mpCost=150;
 mat1="Crystal (D-Grade)";
 mat1num=3;
 mat2="Soul Ore";
 mat2num=9; 
 CraftStatus = true;
	elseif (ShotType == "sss") then
 craftId=24;
 mpCost=150;
 mat1="Crystal (S-Grade)";
 mat1num=1;
 mat2="Soul Ore";
 mat2num=40;
 CraftStatus = true;
	elseif (ShotType == "bssc") then
 craftId=324;
 mpCost=150;
 mat1="Crystal (C-Grade)";
 mat1num=2;
 mat2="Spirit Ore";
 mat2num=30; 
 CraftStatus = true; 
	elseif (ShotType == "bssd") then 
 craftId=323;
 mpCost=150;
 mat1="Crystal (D-Grade)";
 mat1num=2;
 mat2="Spirit Ore";
 mat2num=8; 
 CraftStatus = true;	
	elseif (ShotType == "bssa") then 
 craftId=326;
 mpCost=240;
 mat1="Crystal (A-grade)";
 mat1num=2;
 mat2="Spirit Ore";
 mat2num=70; 
 CraftStatus = true;	
	elseif (ShotType == "bssb") then 
 craftId=325;
 mpCost=180;
 mat1="Crystal (B-Grade)";
 mat1num=2;
 mat2="Spirit Ore";
 mat2num=16; 
 CraftStatus = true;	
	elseif (ShotType == "ssr") then 
 craftId=1125;
 mpCost=258;
 mat1="Crystal (R-grade)";
 mat1num=2;
 mat2="Soulstone";
 mat2num=80; 
 CraftStatus = true;	
	elseif (ShotType == "bssr") then 
 craftId=1127;
 mpCost=258;
 mat1="Crystal (R-grade)";
 mat1num=2;
 mat2="Spirit Ore";
 mat2num=750; 
 CraftStatus = true; 
	else
 ShowToClient("Craft Plugin","Item Is not Supported.");
	end;
else
	if (CraftStatus == true) then
 CraftStatus = false;
 ShowToClient("Craft Plugin","Craft Is Deactivated.");
	else
 ShowToClient("Craft Plugin","You must choose the item you want to craft for example: /craft_ssa");
	end;	
end; 
end;
 
function getItemByName(name)
local invList = GetInventory();
	for item in invList.list do
 if (item.Name == name) then
 return item;
 end;
	end;
	return nil;
end;
 
function hasItem(name)
local invList = GetInventory();
	for item in invList.list do
 if (item.Name == name) then
 return true;
 end;
	end;
	return false;
end;
 
function Craft(RecipeId)
 if (type(RecipeId) == "number" and RecipeId > 0) then
 local packet = PacketBuilder();
 packet:AppendInt(0xB8, 1);
 packet:AppendInt(RecipeId, 4);
 SendPacket(packet);
 end;
end;
 
function OnLTick1s()
 
if (CraftStatus == true) then
	if(GetMe():GetWeightPercent() < weigthLimit) then
 if (hasItem(mat1) == true) then 
 if(getItemByName(mat1).ItemNum >= mat1num) then
 if(hasItem(mat2) == true) then 
 if(getItemByName(mat2).ItemNum >= mat2num) then
 if (GetMe():GetMp() > mpCost) then
 Craft(craftId);
 end;
 else
 CraftStatus = false;
 ShowToClient("Craft Plugin","Not enough " .. mat2);
 end;
 else
 CraftStatus = false;
 ShowToClient("Craft Plugin","Missing " .. mat2);
 end;
 else
 CraftStatus = false;
 ShowToClient("Craft Plugin","Not enough " .. mat1);
 end;	
 else
 CraftStatus = false;
 ShowToClient("Craft Plugin","Missing " .. mat1);
 end;
	else
 CraftStatus = false;
 ShowToClient("Craft Plugin","Weigth limit approaching, Craft Plugin Deactivated.");	
 end;	
end;
 
end;



save as plugin
05-31-2015 22:33 PM
Find all posts by this user Quote this message in a reply
 Reputed by : capucine(+2)
capucine Offline
Expired VIP Member
**

Posts: 1,083
Joined: Jan 2013
Reputation: 208
Version: 1.4.2.142
Post: #24
RE: WTB craft script code

Thx for sharing Schubbel... i'll test it in a few minutes

Just tested it and found some problems...

1- Description of Crystals is: Crystal (S-grade) and not (S-Grade) the "G" should be lowercase, if not, it doesn't work.

2- Description of Soul Stones to make Soulshots should be: Soulstone and NOT Soul ore

3- You didn't add BSSS... any reason why or simply forgot?

I made the changes for the 2 description above and I managed to craft SSS.

So thx for the updated plugin!


(05-31-2015 22:33 PM)schubbel2208 Wrote:  
    LUA Programming
-- credits to original author W4rGo
 
CraftStatus = false;
weigthLimit=95;
 
function OnCreate()
	this:RegisterCommand("craft", CommandChatType.CHAT_ALLY, CommandAccessLevel.ACCESS_ME);
end;
 
function OnCommand_craft(vCommandChatType, vNick, vCommandParam)
if (vCommandParam:GetCount() == 1) and (CraftStatus == false) then
	ShotType = string.lower(vCommandParam:GetParam(0):GetStr(true));
	if (ShotType == "ssa") then
 craftId=23;
 mpCost=120;
 mat1="Crystal (A-grade)";
 mat1num=1;
 mat2="Spirit Ore";
 mat2num=36; 
 CraftStatus = true;
	elseif (ShotType == "ssb") then
 craftId=22;
 mpCost=100;
 mat1="Crystal (B-Grade)";
 mat1num=1;
 mat2="Soul Ore";
 mat2num=54; 
 CraftStatus = true;
	elseif (ShotType == "ssc") then
 craftId=21;
 mpCost=84;
 mat1="Crystal (C-Grade)";
 mat1num=2;
 mat2="Soul Ore";
 mat2num=30; 
 CraftStatus = true;
	elseif (ShotType == "ssd") then
 craftId=20;
 mpCost=150;
 mat1="Crystal (D-Grade)";
 mat1num=3;
 mat2="Soul Ore";
 mat2num=9; 
 CraftStatus = true;
	elseif (ShotType == "sss") then
 craftId=24;
 mpCost=150;
 mat1="Crystal (S-Grade)";
 mat1num=1;
 mat2="Soul Ore";
 mat2num=40;
 CraftStatus = true;
	elseif (ShotType == "bssc") then
 craftId=324;
 mpCost=150;
 mat1="Crystal (C-Grade)";
 mat1num=2;
 mat2="Spirit Ore";
 mat2num=30; 
 CraftStatus = true; 
	elseif (ShotType == "bssd") then 
 craftId=323;
 mpCost=150;
 mat1="Crystal (D-Grade)";
 mat1num=2;
 mat2="Spirit Ore";
 mat2num=8; 
 CraftStatus = true;	
	elseif (ShotType == "bssa") then 
 craftId=326;
 mpCost=240;
 mat1="Crystal (A-grade)";
 mat1num=2;
 mat2="Spirit Ore";
 mat2num=70; 
 CraftStatus = true;	
	elseif (ShotType == "bssb") then 
 craftId=325;
 mpCost=180;
 mat1="Crystal (B-Grade)";
 mat1num=2;
 mat2="Spirit Ore";
 mat2num=16; 
 CraftStatus = true;	
	elseif (ShotType == "ssr") then 
 craftId=1125;
 mpCost=258;
 mat1="Crystal (R-grade)";
 mat1num=2;
 mat2="Soulstone";
 mat2num=80; 
 CraftStatus = true;	
	elseif (ShotType == "bssr") then 
 craftId=1127;
 mpCost=258;
 mat1="Crystal (R-grade)";
 mat1num=2;
 mat2="Spirit Ore";
 mat2num=750; 
 CraftStatus = true; 
	else
 ShowToClient("Craft Plugin","Item Is not Supported.");
	end;
else
	if (CraftStatus == true) then
 CraftStatus = false;
 ShowToClient("Craft Plugin","Craft Is Deactivated.");
	else
 ShowToClient("Craft Plugin","You must choose the item you want to craft for example: /craft_ssa");
	end;	
end; 
end;
 
function getItemByName(name)
local invList = GetInventory();
	for item in invList.list do
 if (item.Name == name) then
 return item;
 end;
	end;
	return nil;
end;
 
function hasItem(name)
local invList = GetInventory();
	for item in invList.list do
 if (item.Name == name) then
 return true;
 end;
	end;
	return false;
end;
 
function Craft(RecipeId)
 if (type(RecipeId) == "number" and RecipeId > 0) then
 local packet = PacketBuilder();
 packet:AppendInt(0xB8, 1);
 packet:AppendInt(RecipeId, 4);
 SendPacket(packet);
 end;
end;
 
function OnLTick1s()
 
if (CraftStatus == true) then
	if(GetMe():GetWeightPercent() < weigthLimit) then
 if (hasItem(mat1) == true) then 
 if(getItemByName(mat1).ItemNum >= mat1num) then
 if(hasItem(mat2) == true) then 
 if(getItemByName(mat2).ItemNum >= mat2num) then
 if (GetMe():GetMp() > mpCost) then
 Craft(craftId);
 end;
 else
 CraftStatus = false;
 ShowToClient("Craft Plugin","Not enough " .. mat2);
 end;
 else
 CraftStatus = false;
 ShowToClient("Craft Plugin","Missing " .. mat2);
 end;
 else
 CraftStatus = false;
 ShowToClient("Craft Plugin","Not enough " .. mat1);
 end;	
 else
 CraftStatus = false;
 ShowToClient("Craft Plugin","Missing " .. mat1);
 end;
	else
 CraftStatus = false;
 ShowToClient("Craft Plugin","Weigth limit approaching, Craft Plugin Deactivated.");	
 end;	
end;
 
end;



save as plugin
(This post was last modified: 06-01-2015 18:29 PM by capucine.)
06-01-2015 17:24 PM
Find all posts by this user Quote this message in a reply
plixplox Offline
Expired VIP Member
**

Posts: 304
Joined: Nov 2013
Reputation: 23
Version: 1.4.2.138
Post: #25
RE: WTB craft script code

how can make work if char is not in alliance?
06-02-2015 02:28 AM
Find all posts by this user Quote this message in a reply
capucine Offline
Expired VIP Member
**

Posts: 1,083
Joined: Jan 2013
Reputation: 208
Version: 1.4.2.142
Post: #26
RE: WTB craft script code

(06-02-2015 02:28 AM)plixplox Wrote:  how can make work if char is not in alliance?

What alliance are u talking about??? im confused...Huh
06-02-2015 04:11 AM
Find all posts by this user Quote this message in a reply
plixplox Offline
Expired VIP Member
**

Posts: 304
Joined: Nov 2013
Reputation: 23
Version: 1.4.2.138
Post: #27
RE: WTB craft script code

function OnCreate()
this:RegisterCommand("craft", CommandChatType.CHAT_ALLY, CommandAccessLevel.ACCESS_ME);

looking at script to me anyways, to activate script says type in allychat, ssa, ssb, etc..
don't see any stop command tho.. like stop .. to change craft type, or stop to do something else a bit, etc...

Just realized, I don't even know hot to start this plugin, let alone stop it Sad
(This post was last modified: 06-02-2015 05:18 AM by plixplox.)
06-02-2015 04:42 AM
Find all posts by this user Quote this message in a reply
schubbel2208 Offline
Expired VIP Member
**

Posts: 154
Joined: Jun 2012
Reputation: 35
Version: 1.4.3.143
Post: #28
RE: WTB craft script code

/craft_ssr
06-02-2015 12:11 PM
Find all posts by this user Quote this message in a reply
plixplox Offline
Expired VIP Member
**

Posts: 304
Joined: Nov 2013
Reputation: 23
Version: 1.4.2.138
Post: #29
RE: WTB craft script code

ok, how turn off?
06-02-2015 15:00 PM
Find all posts by this user Quote this message in a reply
capucine Offline
Expired VIP Member
**

Posts: 1,083
Joined: Jan 2013
Reputation: 208
Version: 1.4.2.142
Post: #30
RE: WTB craft script code

(06-02-2015 15:00 PM)plixplox Wrote:  ok, how turn off?

to start, u simply type in GENERAL chat (white chat) like all plugin commands...

so to craft BSSR: /craft_bssr

SSB: /craft_ssb

and to stop: /craft
06-02-2015 16:15 PM
Find all posts by this user Quote this message in a reply
Post Reply 




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