Calling Weapon Length

Users who are viewing this thread

ares007

Master Knight
Before I go through the trouble of putting together a script that returns various weapon lengths, does something like that already exist?
 
Look through first 10 lines of http://forums.taleworlds.com/index.php/topic,60099.msg1553218.html#msg1553218
and use "get_weapon_length(item[6])". Don't forget to define new item slot
 
Cool thanks.

Of course, I must now present another question. Being rather new to the module system and python coding, I'm not sure how exactly to define a new item slot :razz:
 
I'm... not sure... how that helps me... :neutral:

(I'm not trying to add new items)

I'm just trying to call up the length for weapons that are already in the game and store it as a variable. I know for a fact that I could make a script that would do this in a very clear, understandable way, but it would be a little tedious with a lot of control statements. I just want to know if there is a quicker way to do it.

Oh, and this is the operation I'll be using to get the weapon id:
(agent_get_wielded_item,<destination>,<agent_id>,<hand_no>),
I'm not exactly sure will be stored either.
 
Unfortunately I think setting a slot for every item with the value of their reach is the only way to do it.
 
Not sure if it works but defining a new header/ID (id_weapons_for_item_length) for every item and then proceed to make the script call the values accordingly ?

I'm still struggling with shield only slot assignation, which is half way to what you wish for.
 
Yoshiboy said:
Unfortunately I think setting a slot for every item with the value of their reach is the only way to do it.
Why unfortunately? :smile: This is the most convenient way

You can also fill an troop/party array where slot # relates to item ID
 
Yoshiboy said:
Unfortunately I think setting a slot for every item with the value of their reach is the only way to do it.

Well, I could make a script like so:

(store_script_param_1, ":weapon"), # where ":weapon" is the weapon id
(try_begin),
  (eq, ":weapon", "itm_sword"),
  (assign, reg0, 96),
(else_try),
  ...
  etc
(try_end),


Of course, I would have to manually type in the weapon lengths.


But honestly, I really don't understand the item slots and stuff. I wouldn't even know where to begin with that method.
 
It isn't that complicated, slots are just like an extra property for the item.

define a new slot in module_constants.py which doesn't overlap with any of the other item slots, say like this:

slot_item_reach = 16

then do this for every item

(item_store_slot,"itm_spiked_club",slot_item_reach,83).

and then when you want to get the reach back for your script

(item_get_slot,":weapon_reach","itm_spiked_club",slot_item_reach),

and the weapon reach for the spiked club will be stored in ":weapon_reach".

The hard part is setting the slot for every item (which takes ages)
 
Ok. That isn't much different than my script idea :razz:

Also, if I did this, in what file would the item_store_slot lines go in. What part of the file.

Thanks
 
ares007 said:
Ok. That isn't much different than my script idea :razz:

Also, if I did this, in what file would the item_store_slot lines go in. What part of the file.

Thanks

You'd probably want to put them in module_scripts.py , in one of the game initialization scripts.
 
Back
Top Bottom