ConstantA
Knight
Using item_get_type, we can check if item has itp_type_ flags.
But what if we want to check another itp_ flag, like itp_no_parry, itp_unbalanced or others?
Here's a small script which'll make it possible.
(I use it for SP, so the examples are for SP).
Create new item slot: slot_item_flags
Place the following code either into module_scripts.py before scripts tuple, or in a new file (for example, my_scripts.py) and import it to module scripts using "from my_scripts import *".
Create new script
Call it inside script_game_start
To check if the item has certain flag, we'll need the following script:
But what if we want to check another itp_ flag, like itp_no_parry, itp_unbalanced or others?
Here's a small script which'll make it possible.
(I use it for SP, so the examples are for SP).
Create new item slot: slot_item_flags
Place the following code either into module_scripts.py before scripts tuple, or in a new file (for example, my_scripts.py) and import it to module scripts using "from my_scripts import *".
Code:
def set_item_flags():
item_flags = []
for i_item in xrange(len(items)):
item_flags.append((item_set_slot, i_item, slot_item_flags, items[i_item][3]))
return item_flags[:]
Create new script
Code:
#script_setup_item_flags
("setup_item_flags", set_item_flags()),
Call it inside script_game_start
Code:
("game_start", [
(call_script,"script_setup_item_flags"),
To check if the item has certain flag, we'll need the following script:
Code:
#script_cf_item_has_flag
#INPUT: item, flag
("cf_item_has_flag", [
(store_script_param, ":item_no", 1),
(store_script_param, ":flag", 2),
(item_get_slot, ":flags", ":item_no", slot_item_flags),
(store_and, ":result", ":flags", ":flag"),
(neq, ":result", 0),
]),