1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
// TMW2 Script
// Author:
// Jesusalva
// Description:
// Smith System (Player, Guild, NPC)
// Notes:
// It's like smithing, but it only change an item options
// Usage: SmithTweakSystem ({scope})
// Scopes: CRAFT_PLAYER, CRAFT_NPC
// Returns true on success, false on failure
function script SmithTweakSystem {
// Set .scope, .knowledge and .success
.scope=getarg(0, CRAFT_PLAYER);
copyarray(.knowledge,RECIPES_EQUIPMENT,getarraysize(RECIPES_EQUIPMENT));
.success=false;
mes l("Which item will you tweak?");
mesc l("WARNING, ITEM MAY BREAK"), 1;
.@id=requestitemindex();
mes "";
if (.@id < 0)
return false;
// *getequipisenableopt(<equipment slot>) → cannot use here
// Not an equipment
if (!getiteminfo(.@id, ITEMINFO_LOC))
return false;
// Clear all five options
setitemoptionbyindex(.@id, 0, 0, 0);
setitemoptionbyindex(.@id, 1, 0, 0);
setitemoptionbyindex(.@id, 2, 0, 0);
setitemoptionbyindex(.@id, 3, 0, 0);
setitemoptionbyindex(.@id, 4, 0, 0);
// Check if you fail
if (rand(0,10000) < 200) {
mesc l("ITEM BREAKS, ALL OPTIONS LOST!"), 1;
return false;
}
// Eh, apply some stuff for testing
setitemoptionbyindex(.@id, 0, VAR_MAXHPAMOUNT, 200);
setitemoptionbyindex(.@id, 1, VAR_STRAMOUNT, 10);
setitemoptionbyindex(.@id, 2, VAR_VITAMOUNT, -5);
mesc l("SUCCESS!"), 3;
return true;
}
|