![]() |
|
|
#24 |
|
Архивный участник
Join Date: Oct 2005
Posts: 175
|
hello,
i tried to write something like that: Code:
class warrior_sa : warrior
{
parameter:
int MaxLevel = 2;
int PerGet01 = 100;
int PerGet12 = 90;
int PerBreak0 = 0;
int PerBreak1 = 5;
handler:
EventHandler SPELLED(speller, skill_name_id)
{
if(skill_name_id == @s_soul_crystal)
{
//---------- BLUE SOUL CRYSTAL
if ((OwnItemCount(speller, @blue_soul_crystal_0) >= 1) && (MaxLevel >= 1)) {
if (Rand(100) >= PerGet01) {
DeleteItem1(speller, @blue_soul_crystal_0, 1);
GiveItem1(speller, @blue_soul_crystal_1,1);
SoundEffect(speller, "ItemSound.quest_itemget"); Despawn();
} else if (Rand(100) < PerBreak0) {
DeleteItem1(speller, @blue_soul_crystal_0, 1);
SoundEffect(speller, "ItemSound.quest_middle"); Despawn();
}
} else if ((OwnItemCount(speller, @blue_soul_crystal_1) >= 1) && (MaxLevel >= 2)) {
if (Rand(100) >= PerGet12) {
DeleteItem1(speller, @blue_soul_crystal_1, 1);
GiveItem1(speller, @blue_soul_crystal_2,1);
SoundEffect(speller, "ItemSound.quest_itemget"); Despawn();
} else if (Rand(100) < PerBreak1) {
DeleteItem1(speller, @blue_soul_crystal_1, 1);
SoundEffect(speller, "ItemSound.quest_middle"); Despawn();
}
}
}
}
}
Code:
class warrior_sa : warrior parameter_define_begin int MaxLevel 2 int PerGet01 100 int PerGet12 90 int PerBreak0 0 int PerBreak1 5 parameter_define_end handler 2 // SPELLED variable_begin "speller" "skill_name_id" "myself" "_choiceN" "_code" "_from_choice" variable_end push_event // skill_name_id push_const 120 add fetch_i push_const 536577 equal branch_false L1 L0 shift_sp 1 push_event // speller push_const 56 add fetch_i push_const 4651 func_call 81 // func[OwnItemCount] shift_sp -2 push_const 1 greater_equal push_reg_sp fetch_i branch_false L2 push_parameter MaxLevel push_const 1 greater_equal and L2 branch_false L4 L3 shift_sp 1 push_const 100 func_call 55 // func[Rand] shift_sp -1 push_parameter PerGet01 greater_equal branch_false L6 L5 shift_sp 1 push_event // speller push_const 56 add fetch_i push_const 4651 push_const 1 func_call 80 // func[DeleteItem1] shift_sp -3 shift_sp -1 shift_sp 1 push_event // speller push_const 56 add fetch_i push_const 4652 push_const 1 func_call 77 // func[GiveItem1] shift_sp -3 shift_sp -1 shift_sp 1 push_event // speller push_const 56 add fetch_i S1. "ItemSound.quest_itemget" push_string S1 func_call 173 // func[SoundEffect] shift_sp -2 shift_sp -1 shift_sp 1 func_call 175 // func[Despawn] shift_sp -1 jump L7 L6 shift_sp 1 push_const 100 func_call 55 // func[Rand] shift_sp -1 push_parameter PerBreak0 less branch_false L9 L8 shift_sp 1 push_event // speller push_const 56 add fetch_i push_const 4651 push_const 1 func_call 80 // func[DeleteItem1] shift_sp -3 shift_sp -1 shift_sp 1 push_event // speller push_const 56 add fetch_i S2. "ItemSound.quest_middle" push_string S2 func_call 173 // func[SoundEffect] shift_sp -2 shift_sp -1 shift_sp 1 func_call 175 // func[Despawn] shift_sp -1 L9 L7 jump L10 L4 shift_sp 1 push_event // speller push_const 56 add fetch_i push_const 4652 func_call 81 // func[OwnItemCount] shift_sp -2 push_const 1 greater_equal push_reg_sp fetch_i branch_false L11 push_parameter MaxLevel push_const 2 greater_equal and L11 branch_false L13 L12 shift_sp 1 push_const 100 func_call 55 // func[Rand] shift_sp -1 push_parameter PerGet12 greater_equal branch_false L15 L14 shift_sp 1 push_event // speller push_const 56 add fetch_i push_const 4652 push_const 1 func_call 80 // func[DeleteItem1] shift_sp -3 shift_sp -1 shift_sp 1 push_event // speller push_const 56 add fetch_i push_const 4653 push_const 1 func_call 77 // func[GiveItem1] shift_sp -3 shift_sp -1 shift_sp 1 push_event // speller push_const 56 add fetch_i S3. "ItemSound.quest_itemget" push_string S3 func_call 173 // func[SoundEffect] shift_sp -2 shift_sp -1 shift_sp 1 func_call 175 // func[Despawn] shift_sp -1 jump L16 L15 shift_sp 1 push_const 100 func_call 55 // func[Rand] shift_sp -1 push_parameter PerBreak1 less branch_false L18 L17 shift_sp 1 push_event // speller push_const 56 add fetch_i push_const 4652 push_const 1 func_call 80 // func[DeleteItem1] shift_sp -3 shift_sp -1 shift_sp 1 push_event // speller push_const 56 add fetch_i S4. "ItemSound.quest_middle" push_string S4 func_call 173 // func[SoundEffect] shift_sp -2 shift_sp -1 shift_sp 1 func_call 175 // func[Despawn] shift_sp -1 L18 L16 L13 L10 L1 handler_end class_end |
|
|
| Thread Tools | Search this Thread |
| Display Modes | |
|
|