OSP Code Combat [WB][B] Alternate Weapon Modes

Users who are viewing this thread

TheMasteroDeath said:
Yes I'm an idiot, but I'm getting this error:

SyntaxError: invalid syntax
Traceback (most recent call last):
  File "process_global_variables_unused.py", line 3, in <module>
    from process_operations import *
  File "C:\Users\Ali\Desktop\Warband modding\Module_system 1.171\process_operations.py", line 20, in <module>
    from module_scripts import *
  File "C:\Users\Ali\Desktop\Warband modding\Module_system 1.171\module_scripts.py", line 1492
    (item_set_slot, "itm_bastard_sword_b", slot_item_alternate "greatsword_flipped")

And I have no Idea what do do with it. I am extremely new to modding and I defenitely need some help..

Just off what you've got here it looks like you're missing a comma after slot_item_alternate
 
mercury19 said:
TheMasteroDeath said:
Yes I'm an idiot, but I'm getting this error:

SyntaxError: invalid syntax
Traceback (most recent call last):
  File "process_global_variables_unused.py", line 3, in <module>
    from process_operations import *
  File "C:\Users\Ali\Desktop\Warband modding\Module_system 1.171\process_operations.py", line 20, in <module>
    from module_scripts import *
  File "C:\Users\Ali\Desktop\Warband modding\Module_system 1.171\module_scripts.py", line 1492
    (item_set_slot, "itm_bastard_sword_b", slot_item_alternate "greatsword_flipped")

And I have no Idea what do do with it. I am extremely new to modding and I defenitely need some help..

Just off what you've got here it looks like you're missing a comma after slot_item_alternate

It's so simple I feel stupid now. I'm gonna try and see if it indeed is the problem. Thanks a lot
 
Yes, I'm still an Idiot

But this time I got this error:

SyntaxError: invalid syntax
Traceback (most recent call last):
  File "process_global_variables.py", line 12, in <module>
    from process_operations import *
  File "C:\Users\Ali\Desktop\Warband modding\Module_system 1.171\process_operations.py", line 21, in <module>
    from module_mission_templates import *
  File "C:\Users\Ali\Desktop\Warband modding\Module_system 1.171\module_mission_templates.py", line 16014
    common_player_weapon_toggle = (0,0,1, [

 
Somebody said:
Scroll a couple of posts up on the page to see how to properly implement the mission template triggers.

I did but couldn't make much sense out of it. I'll try again but frankly I'll probably just end up asking again... I'm sorry :/
 
How could this be activated in multiplayer?

I tried adding "common_player_weapon_toggle" to the end of multiplayer_dm like this, with no results:

Code:
      ] + common_player_weapon_toggle,
  ),
 
In multiplayer it probably has to be done differently, by catching it and then sending a message to the server to authenticate what state the weapon is in and then running agent_equip_item from the server to synchronize it to clients. As for the implementation, common_player_weapon_toggle is just a single trigger so you'll need to add it to the list instead of appending.
 
Somebody said:
Now makes sure you actually include common_wpn_swapping in whatever mission template you want weapon switching to be enabled in.

Excuse me asking, but could anyone please tell me how ^that^ is done exactly?

I can't seem to add the common_wpn_swapping in any mission template without TypeError expecting a number instead of a tuple.

Any help would be much appreciated. I'm stuck  :dead:
 
You can either add those named triggers individually inside mission templates (comma separated), or append common_wpn_swapping (which is the list containing all 3 triggers) to the existing list via ] + common_wpn_swapping,
 
Ok I got slightly less errors like this, but still it complains about TypeError:

Code:
#----------------------------------------------------------------
#mission templates before this point are hardwired into the game.
#-----------------------------------------------------------------

  (
    "town_center",0,-1,
    "Default town visit",
    [(0,mtef_scene_source|mtef_team_0,af_override_horse,0,1,pilgrim_disguise),
    ... 
       (display_message, "@You got keys of dungeon."),
     (try_end),
   ]   + common_wpn_swapping,   # MODDING
   ),
        
  ]),

  (
    "village_center",0,-1,
    "village center",
 
I got it to work  :grin: by adding triggers individually and using the code from your (Somebody's) "revised code" early on page 2.

Earlier I tried to use the code Somebody supplied later (which contains the common_wpn_swapping), but I never got it to work.

Thank you anyway. One more question: Would you or anyone happen to know/guess why my (MS 1.171) compiler says items is not defined whe I try to incorporate the automated finding weapon alternatives code?

def set_item_score():
  item_score = []
  for i_item in xrange(len(items)):                                ####    <-----  here
    type = items[i_item][3] & 0x000000ff
    if (type >= itp_type_one_handed_wpn and type <= itp_type_thrown and type != itp_type_shield) or (type >= itp_type_pistol and type <= itp_type_bullets):
      item_score.append((item_set_slot, i_item, slot_item_thrust_damage, get_thrust_damage(items[i_item][6])))
      item_score.append((item_set_slot, i_item, slot_item_swing_damage, get_swing_damage(items[i_item][6])))
      if (items[i_item][3] & itp_next_item_as_melee == itp_next_item_as_melee) and type != itp_type_thrown: #toggleable weapons
        item_score.append((item_set_slot, i_item, slot_item_alternate, i_item + 1))
        item_score.append((item_set_slot, i_item + 1, slot_item_alternate, i_item))
        # print items[i_item][0] + str(i_item) + " has alternate " + str(i_item+1)
  return item_score[:]

EDIT: Got it to work by importing module_items. Thank you again, Somebody!
 
Back
Top Bottom