Books and stat boosting... Where?!?!

正在查看此主题的用户

Tiwaz

Recruit
I was wondering if anyone has combined the ability that books have to enhance stats with weapons/armor to make magical items....

I looked in the module_items.py but there didn't seem to be anything regarding how books worked, it seems to merely declare their existence...

In the module_scripts.py there is a tidbit with the books mentioned but again it doesn't seem to have any references for giving them the stat enhancing feature...

(BTW I'm talking about the books that you can't read, like the surgery one...)



Aside from all that, I'm going to go out on a limb and ask if it's possible to create an item that boosts your skill in a particular category.  For instance, would it be possible to make a sword that increases your skill with one handed weapons by 10 or 20 or 5 or whatever.

Thanks!
Tiwaz
 
Tiwaz 说:
Aside from all that, I'm going to go out on a limb and ask if it's possible to create an item that boosts your skill in a particular category.  For instance, would it be possible to make a sword that increases your skill with one handed weapons by 10 or 20 or 5 or whatever.

Thanks!
Tiwaz

Could just add agility for 10+ proficiency, but ya, there should be like a book for like archery which increases bow proficiency.

Magical items? extrapolate

As for where the book info should be. It should be under module_scripts.py check again.
 
Magical items as in: Staff of Agility that when worn will add +1 to your agility skill until it's removed.

I'll check again in the scripts.py  ... maybe further down in the document there will be something...

Edit: I found this code...

  #script_game_get_skill_modifier_for_troop
  # This script is called from the game engine when a skill's modifiers are needed
  # INPUT: arg1 = troop_no, arg2 = skill_no
  # OUTPUT: trigger_result = modifier_value
  ("game_get_skill_modifier_for_troop",
  [(store_script_param, ":troop_no", 1),
    (store_script_param, ":skill_no", 2),
    (assign, ":modifier_value", 0),
    (try_begin),
      (eq, ":skill_no", "skl_wound_treatment"),
      (call_script, "script_get_troop_item_amount", ":troop_no", "itm_book_wound_treatment_reference"),
      (gt, reg0, 0),
      (val_add, ":modifier_value", 1),
    (else_try),
      (eq, ":skill_no", "skl_trainer"),
      (call_script, "script_get_troop_item_amount", ":troop_no", "itm_book_training_reference"),
      (gt, reg0, 0),
      (val_add, ":modifier_value", 1),
    (else_try),
      (eq, ":skill_no", "skl_surgery"),
      (call_script, "script_get_troop_item_amount", ":troop_no", "itm_book_surgery_reference"),
      (gt, reg0, 0),
      (val_add, ":modifier_value", 1),
    (try_end),
    (set_trigger_result, ":modifier_value"),
    ]),

It seems like this adds the modifier value... I'll try it out on a sword or something, but I had another thought and that is that the skill modifier would be active while the item is unequipped...

Edit: Tried that, and it works, but it also works while unequipped....  yay sword of +1 ironflesh even if it's not being used!
 
Tiwaz 说:
I was wondering if anyone has combined the ability that books have to enhance stats with weapons/armor to make magical items....
Yes and no. There is no analog of script_game_skill_modifier_for_troop for stats or prof. But stats change can be shoved  by triggers
in e.g. mission_templates.

Tiwaz 说:
Aside from all that, I'm going to go out on a limb and ask if it's possible to create an item that boosts your skill in a particular category.  For instance, would it be possible to make a sword that increases your skill with one handed weapons by 10 or 20 or 5 or whatever.
Maybe not for all but for some skills it can  be done by adding new checks to script_game_skill_modifier_for_troop.

Tiwaz 说:
Edit: Tried that, and it works, but it also works while unequipped....  yay sword of +1 ironflesh even if it's not being used!
You can check if item is equiped using troop_has_item_equiped
 
HAI! It's old :razz:
http://forums.taleworlds.com/index.php/topic,8652.msg1019846.html#msg1019846

Use that for weapons;

插入代码块:
(else_try),
(eq, ":skill_no", "skl_power_draw"),
(this_or_next|troop_get_inventory_slot,":cur_item1",":troop_no",ek_item_0),
(this_or_next|troop_get_inventory_slot,":cur_item1",":troop_no",ek_item_1),
(this_or_next|troop_get_inventory_slot,":cur_item1",":troop_no",ek_item_2),
(troop_get_inventory_slot,":cur_item1",":troop_no",ek_item_3),
(eq, ":cur_item1", "itm_bonus_giving_item"),
(val_add, ":modifier_value", 1), 

Also see;
http://mbx.streetofeyes.com/index.php/topic,972.0.html
 
This is cool, now do I put this in the module_scripts.py where I quoted it before?  I tried it and it returned some errors...  My knowledge of python is basically zero, the only python I've ever had success changing is the item tuples or whatever they're called.... which doesn't seem to have a whole lot of "python basics" involved... =p

nvm... I'm an idiot... just have to change bonus_giving_item to my item name =p

ERROR: Usage of unassigned local variable: :cur_item1
^^from the build_module batch file

How do i assign it? x_x

I added this line:

插入代码块:
(store_script_param, ":cur_item1", 3),

near where the others just like it are (numbered 1 and 2) ... this proceeded to get rid of the error but also make moving on the map slow as death (fps way down or something) so that I couldn't get to the towns to check if it had even worked! ... weird ... i have now reverted back to the old version =p
 
I never noticed that sample was fudged up sorry it is a wrongly modified version, original was for a set of items that go to definate slots (armour pieces) :razz:

插入代码块:
  #script_game_get_skill_modifier_for_troop
  # This script is called from the game engine when a skill's modifiers are needed
  # INPUT: arg1 = troop_no, arg2 = skill_no
  # OUTPUT: trigger_result = modifier_value
  ("game_get_skill_modifier_for_troop",
   [(store_script_param, ":troop_no", 1),#This script is called by engine whenever it needs to calculate skills of a troop.  This script should not be called from any other script or trigger. 
    (store_script_param, ":skill_no", 2),#Both of these parameters are called for every trp_ and skl_ by the game.
    (assign, ":modifier_value", 0),#This is the modifier value, it must have a value for the final operation, thus it is assigned 0. So it will have a value even if all the tries below fail.
    (try_begin),#Begins Trying For Skills
      (eq, ":skill_no", "skl_wound_treatment"), #This is the skill we are trying.
      (call_script, "script_get_troop_item_amount", ":troop_no", "itm_book_wound_treatment_reference"), #This a check, it will get number of "itm_book_wound_treatment_reference" items.
      (gt, reg0, 0), #The above script registers number of "itm_book_wound_treatment_reference" player has in invetory to reg0. This is a condition, if reg0 is greater 1 this try will succed.
      (val_add, ":modifier_value", 1),#This adds 1 to ":modifier_value", so the value is now 1.
    (else_try),#Once the try above fails, (if skl_ it is looking for is not skl_wound_treatment), it will try this one, untill it finds the skl_ it is looking for.
      (eq, ":skill_no", "skl_trainer"),
      (call_script, "script_get_troop_item_amount", ":troop_no", "itm_book_training_reference"),
      (gt, reg0, 0),
      (val_add, ":modifier_value", 1),
    (else_try),
      (eq, ":skill_no", "skl_surgery"),
      (call_script, "script_get_troop_item_amount", ":troop_no", "itm_book_surgery_reference"),
      (gt, reg0, 0),
      (val_add, ":modifier_value", 1),
#This is try checks for if item is equipped in a slot
	(else_try),
	  (eq, ":skill_no", "skl_power_draw"),
	  (troop_get_inventory_slot,":cur_item1",":troop_no",ek_item_0),#Here we are getting items from slots 0,1,2,3
	  (troop_get_inventory_slot,":cur_item2",":troop_no",ek_item_1),#Those slots are where weapons are placed.
	  (troop_get_inventory_slot,":cur_item3",":troop_no",ek_item_2),#We get them all to a different :local. Now all those :local variables are equal to one of the items in slots.
	  (troop_get_inventory_slot,":cur_item4",":troop_no",ek_item_3),#Then we check each item, if it is the one we want. 
	  (this_or_next|eq, ":cur_item1", "itm_bonus_giving_item"),#These are conditions similar to the conditions above.
	  (this_or_next|eq, ":cur_item2", "itm_bonus_giving_item"),#But we check multiple variables, so we use this_or_next|
	  (this_or_next|eq, ":cur_item3", "itm_bonus_giving_item"),#As the name suggests it is either this contion or the next.
	  (eq, ":cur_item4", "itm_bonus_giving_item"),#Since this one is the last one we don't need this_or_next. When any of the items is the item we want the script succeds.
	  (val_add, ":modifier_value", 1),#And when succeded adds 1.
    (try_end),#Ends Trying For Skills.
    (set_trigger_result, ":modifier_value"),#This the execution of the scipt: :troop_no gets :modifier_value bonus to :skill_no.
    ]),
 
Dude you rock! When I get a chance I'll test this out ... thanks for the comments: very useful.
 
后退
顶部 底部