Search results for query: *

  1. Waffss

    Droping/removeing swords when equiping bayonet

    Seems like it hit the veriable limit when i tried compileing it. Is it possible to add more veriables then the limit?
  2. Waffss

    Droping/removeing swords when equiping bayonet

    yeah, that did it thanks and ill be trying to do smaller stuff from now on. (spent a whole week on this even before posting for help, so I have enough of bayonets for now :dead:) also thanks for replying even after getting best answer, you've been a great help.
  3. Waffss

    Droping/removeing swords when equiping bayonet

    So the version I had posted, with comments intact, assumes all rifles use the same sabre. But, if you wanted a different sabre per rifle, you could create a slot like slot_item_unique_bayonet in module_constants, and uncomment
    Python:
    # (item_get_slot,":bayonet",":curRifle", slot_item_unique_bayonet), # this is a variant needed if you want a different bayonet per rifle
    in order to change the check from a single sabre item, to the sabre item stored in that slot.

    Of course you'd need to update the Fixbayoneta code to include the bayonets on both the bayoneted and non-bayoneted versions of the rifles.

    You could also do it without slots, but by using slots this script stays modular and you can just keep adding rifles and assigning the appropriate slots without any changes.
    I tried that here is fixbayoneta pretty sure that's what you meant?
    Python:
                (item_set_slot,"itm_british_brown_bess_bare",slot_item_bayonetItem,"itm_british_brown_bess"), #set each non-bayoneted rifle to its bayoneted version       
                (item_set_slot,"itm_british_brown_bess",slot_item_bayonetItem,"itm_british_brown_bess_bare"), #set each bayoneted rifle to its non-bayoneted version
                (item_set_slot, "itm_british_brown_bess", slot_item_isFixed, 1), #set each bayonet-attached item to isFixed             
                (item_set_slot,"itm_french_charleville_bare",slot_item_bayonetItem,"itm_french_charleville"), #set each non-bayoneted rifle to its bayoneted version       
                (item_set_slot,"itm_french_charleville",slot_item_bayonetItem,"itm_french_charleville_bare"), #set each bayoneted rifle to its non-bayoneted version
                (item_set_slot, "itm_french_charleville", slot_item_isFixed, 1), #set each bayonet-attached item to isFixed
                (item_set_slot,"itm_british_baker_rifle",slot_item_unique_bayonet,"itm_british_baker_rifle_bayonet"), #set each non-bayoneted rifle to its bayoneted version       
                (item_set_slot,"itm_british_baker_rifle_bayonet",slot_item_unique_bayonet,"itm_british_baker_rifle"), #set each bayoneted rifle to its non-bayoneted version
                (item_set_slot, "itm_british_baker_rifle_bayonet", slot_item_isFixed, 1), #set each bayonet-attached item to isFixed
    and here is the new script
    Python:
    (eq,":bayonetCooldown",0),
    (agent_get_wielded_item,":curRifle",":playerAgent"),
    (item_get_slot,":bayonetItem",":curRifle",slot_item_bayonetItem),
    (item_get_slot,":bayonet",":curRifle", slot_item_unique_bayonet),
    (assign, ":bayonet", "itm_british_baker_bayonet"),
    (neq,":bayonetItem",0),
    im not sure whats wrong there it seems the baker-rifle cant do the whole fix and unfix thing i would like to try to fix it myself but im not sure where to start could you point me in the right direction and ill try to fix it thanks
  4. Waffss

    Droping/removeing swords when equiping bayonet

    Hi me again forgot to ask you last time if you could expand on the ''(assign, ":bayonet", "itm_bayonet"), # or whatever the bayonet item_id is, if you want a different one per rifle, make a new slot called slot_item_unique_bayonet and assign them there. Then move this down to the commented out section below'' I'm not really sure what you meant by assigning them there? thanks
  5. Waffss

    Droping/removeing swords when equiping bayonet

    Thank you so much it works perfectly and I can't thank you enough. Your replies were always great descriptive and easy to follow. I truly thank you one more question for mount and blade scripting would I need to learn mount and blade specific code or just standard python and do you know any good guides on it?. Again thank you and ill make sure that if i ever get anything done that you will be credited.
  6. Waffss

    Droping/removeing swords when equiping bayonet

    To help you think like a WB scripter, I'm going to walk through my thought process in bugfixing.

    First: Identify the bug.
    The try_*** loop is always claiming ":isFixed" = 0, so we'll start with that.

    Second: Think about what could cause the bug.
    One of two things might be happening, the slot is either being overwritten, or it's not being updated.
    So we'll look though the script for an agent_set_slot operation pointing at slot_item_isFixed.
    There is none, so that means the slot is never updated to reflect the bayonet's state, meaning it's always 0.
    So we need to add a agent_set_slot to the consequence block.

    Update this section to include slot setting:
    Python:
                    (try_begin),
                        (eq,":isFixed",0),
                        (agent_set_animation,":playerAgent","anim_fix_bayonet"),
                        (agent_set_slot,":playerAgent",slot_item_isFixed, 1), # 1 marks the bayonet as fixed
                                (else_try),
                        (agent_set_animation,":playerAgent","anim_unfix_bayonet"),
                        (agent_set_slot,":playerAgent",slot_item_isFixed, 0), # 0 marks the bayonet as unfixed
                    (try_end),

    Keep in mind that I didn't check the other mission_template scripts, so maybe the other lines do it. But it should be handled here, to be honest.

    Join us in the Modding Discord for faster responses, by some guys much more skilled than me.
    Thanks this worked I've also tried your first script with the unequipping the bayonet sabre but it causes the same problem as before with it playing the only one animation and it also doesn't unequip the saber bayonet here is the combined script for them both.
    Python:
    #Bajo script
                  (eq, ":event_type", multiplayer_event_fixBayonet),
            (store_script_param,":eventNo",3),
            (store_script_param,":var2",4),
                (try_begin),
                    (eq,":eventNo",1), #Event 1 - Fix Bayonet
                    (assign, ":bayonet", "itm_british_baker_bayonet"),
                    (assign,":itemFound",0),
                    (assign,":playerAgent",":var2"),
                    (agent_is_active, ":playerAgent"),
                    (agent_is_alive, ":playerAgent"),
                    (agent_get_slot,":bayonetCooldown",":playerAgent",slot_agent_bayonetCooldown),
                    (eq,":bayonetCooldown",0),
                    (agent_get_wielded_item,":curRifle",":playerAgent"),
                    (item_get_slot,":bayonetItem",":curRifle",slot_item_bayonetItem),
                    (neq,":bayonetItem",0),
                    (try_for_range,":curSlot",0,3),
                        (neq,":itemFound",1),
                        (agent_get_item_slot,":curItem",":playerAgent",":curSlot"),
                        (try_begin),
                        (eq,":curItem",":curRifle"),
                        (assign,":itemFound",1), #break loop
                        (assign,":itemSlot",":curSlot"),
                        (else_try),
                        (eq,":curItem",":bayonet"),
                        (assign, ":bayonet_in_inventory", 1),
                        (assign, ":bayonet_itemSlot", ":curSlot"),
                        (try_end),
                    (try_end),
                    (eq,":itemFound",1), #the item was found and no witchcraft occurred
                    (agent_is_active, ":playerAgent"),
                    (agent_is_alive, ":playerAgent"),
                    (agent_get_ammo_for_slot,":rifleAmmo",":playerAgent",":itemSlot"),
                    (agent_get_slot,":isFixed",":playerAgent",slot_item_isFixed),
                    (try_begin),
                        (eq,":isFixed",0),
                        (eq,":bayonet_in_inventory",1),
                        (agent_set_animation,":playerAgent","anim_fix_bayonet"),
                        (agent_set_slot,":playerAgent",slot_item_isFixed, 1), # 1 marks the bayonet as fixed
                        (agent_unequip_item, ":playerAgent", ":bayonet", ":bayonet_itemSlot"),
                                (else_try),
                        (agent_set_animation,":playerAgent","anim_unfix_bayonet"),
                        (agent_set_slot,":playerAgent",slot_item_isFixed, 0), # 0 marks the bayonet as unfixed
                        (agent_equip_item, ":playerAgent", ":bayonet"),
                    (try_end),
                    (agent_unequip_item,":playerAgent",":curRifle"),
                    (agent_equip_item,":playerAgent",":bayonetItem"),
                    (agent_set_wielded_item,":playerAgent",":bayonetItem"),
                    (try_begin),
                        (eq,":rifleAmmo",0),
                        (agent_set_ammo,":playerAgent",":bayonetItem",0),
                    (try_end),
                    (agent_is_active, ":playerAgent"),
                    (agent_is_alive, ":playerAgent"),
                    (agent_set_slot,":playerAgent",slot_agent_bayonetCooldown,6), #unable to spam bayonet on/off
                (try_end), #Bajo script
  7. Waffss

    Droping/removeing swords when equiping bayonet

    That could be a number of things, but you might try raising the animation priority first. Right now it's set to amf_priority_mount which is to say 60, so if another animation is playing with a higher priority, it won't take effect. I personally use 71 in a lot of my stuff which pretty much will take priority over all other animations outside of being hit.

    Outside of that, make sure the animations are declared properly and that they are inside the *.brf and the brf is named inside module.ini
    That didn't work, Here is my script so far without your update, If possible could you take a look at it thanks
    Python:
    #Bajo script
                  (eq, ":event_type", multiplayer_event_fixBayonet),
            (store_script_param,":eventNo",3),
            (store_script_param,":var2",4),
                (try_begin),
                    (eq,":eventNo",1), #Event 1 - Fix Bayonet
                    (assign,":itemFound",0),
                    (assign,":playerAgent",":var2"),
                    (agent_is_active, ":playerAgent"),
                    (agent_is_alive, ":playerAgent"),
                    (agent_get_slot,":bayonetCooldown",":playerAgent",slot_agent_bayonetCooldown),
                    (eq,":bayonetCooldown",0),
                    (agent_get_wielded_item,":curRifle",":playerAgent"),
                    (item_get_slot,":bayonetItem",":curRifle",slot_item_bayonetItem),
                    (neq,":bayonetItem",0),
                    (try_for_range,":curSlot",0,3),
                        (neq,":itemFound",1),
                        (agent_get_item_slot,":curItem",":playerAgent",":curSlot"),
                        (eq,":curItem",":curRifle"),
                        (assign,":itemFound",1), #break loop
                        (assign,":itemSlot",":curSlot"),
                    (try_end),
                    (eq,":itemFound",1), #the item was found and no witchcraft occurred
                    (agent_is_active, ":playerAgent"),
                    (agent_is_alive, ":playerAgent"),
                    (agent_get_ammo_for_slot,":rifleAmmo",":playerAgent",":itemSlot"),
                    (agent_get_slot,":isFixed",":playerAgent",slot_item_isFixed),
                    (try_begin),
                        (eq,":isFixed",0),
                        (agent_set_animation,":playerAgent","anim_fix_bayonet"),
                                (else_try),
                        (agent_set_animation,":playerAgent","anim_unfix_bayonet"),
                    (try_end),
                    (agent_unequip_item,":playerAgent",":curRifle"),
                    (agent_equip_item,":playerAgent",":bayonetItem"),
                    (agent_set_wielded_item,":playerAgent",":bayonetItem"),
                    (try_begin),
                        (eq,":rifleAmmo",0),
                        (agent_set_ammo,":playerAgent",":bayonetItem",0),
                    (try_end),
                    (agent_is_active, ":playerAgent"),
                    (agent_is_alive, ":playerAgent"),
                    (agent_set_slot,":playerAgent",slot_agent_bayonetCooldown,6), #unable to spam bayonet on/off
                (try_end), #Bajo script
          (else_try),
    From my testing ive figured out that when i change the number in (eq,":isFixed",0), it will play the other animation both (for example if set to 0 it plays fix bayonet animation when fixing and unfixing oppisite if set to 1)

    and for your new code you sent ill try it once I figure this out. Thanks again
  8. Waffss

    Droping/removeing swords when equiping bayonet

    Hi thanks for replying ill try your updated code later today although im haveing problems with the animation it only plays the fix bayonet animation and not the unfix one would you know the cause of this by any chance and again thanks for replying
    Ive narrowed it down and im 90 percent sure the issue is with the script which is exactly as in the tutorial i linked
  9. Waffss

    Droping/removeing swords when equiping bayonet

    Hey, friend. Not entirely sure what you mean here. If you're saying the bayonet is a knife in the inventory you'll want to amend this by doing something like

    Changes marked in Red, my comments in Orange
    #Bajo script
    (eq, ":event_type", multiplayer_event_fixBayonet),
    (store_script_param,":eventNo",3),
    (store_script_param,":var2",4),
    (try_begin),
    (eq,":eventNo",1), #Event 1 - Fix Bayonet

    (assign, ":bayonet", "itm_bayonet"), # or whatever the bayonet item_id is, if you want a different one per rifle, make a new slot called slot_item_unique_bayonet and assign them there. Then move this down to the commented out section below
    (assign,":itemFound",0),
    (assign,":playerAgent",":var2"),
    (agent_is_active, ":playerAgent"),
    (agent_is_alive, ":playerAgent"),
    (agent_get_slot,":bayonetCooldown",":playerAgent",slot_agent_bayonetCooldown),
    (eq,":bayonetCooldown",0),
    (agent_get_wielded_item,":curRifle",":playerAgent"),
    (item_get_slot,":bayonetItem",":curRifle",slot_item_bayonetItem),

    # (item_get_slot,":bayonet",":curRifle", slot_item_unique_bayonet), # this is a variant needed if you want a different bayonet per rifle
    (neq,":bayonetItem",0),
    (try_for_range,":curSlot",0,3),
    (neq,":itemFound",1),
    (agent_get_item_slot,":curItem",":playerAgent",":curSlot"),
    (try_begin),
    (eq,":curItem",":curRifle"),
    (assign,":itemFound",1), #break loop
    (assign,":itemSlot",":curSlot"),

    (else_try),
    (eq,":curItem",":bayonet"),
    (assign, ":bayonet_in_inventory", 1),
    (assign, ":bayonet_itemSlot", ":curSlot"),
    (try_end),

    (try_end),
    (eq,":itemFound",1), #the item was found and no witchcraft occurred
    (agent_is_active, ":playerAgent"),
    (agent_is_alive, ":playerAgent"),
    (agent_get_ammo_for_slot,":rifleAmmo",":playerAgent",":itemSlot"),
    (agent_get_slot,":isFixed",":playerAgent",slot_item_isFixed),
    (try_begin),
    (eq,":isFixed",0),

    (eq,":bayonet_in_inventory",1),
    (agent_set_animation,":playerAgent","anim_fix_bayonet"),
    (agent_unequip_item, ":playerAgent", ":bayonet", ":bayonet_itemSlot"), # using the item slot will ensure that an agent can carry multiple bayonet items without being forced to unequip them all.
    (else_try),
    (agent_set_animation,":playerAgent","anim_unfix_bayonet"),

    (agent_equip_item, ":playerAgent", ":bayonet"), # This assumes there is an empty slot. That ~should~ be true since we had to unequip an item to make this true, but if the agent picked something in the meantime this would fail.
    (try_end),
    (agent_unequip_item,":playerAgent",":curRifle"),
    (agent_equip_item,":playerAgent",":bayonetItem"),
    (agent_set_wielded_item,":playerAgent",":bayonetItem"),
    (try_begin),
    (eq,":rifleAmmo",0),
    (agent_set_ammo,":playerAgent",":bayonetItem",0),
    (try_end),
    (agent_is_active, ":playerAgent"),
    (agent_is_alive, ":playerAgent"),
    (agent_set_slot,":playerAgent",slot_agent_bayonetCooldown,6), #unable to spam bayonet on/off
    (try_end), #Bajo script

    Sorry about the tabs, being inside a spoiler ruins that

    Of course, this is entirely untested and I am only guessing at what you are asking.

    The way this works is pretty straight forward. It adds a check that there is a bayonet weapon in the inventory of the agent, and if there is, and the current rifle is a variant without a bayonet, it unequips the last bayonet weapon in the equip slots, and changes the variant just like the base version. Then, if the player is swapping from a bayoneted variant, it assumes there should be an open inventory slot, equips the bayonet weapon, and changes the rifle's variant just as the base did.
    Hi thanks for replying ill try your updated code later today although im haveing problems with the animation it only plays the fix bayonet animation and not the unfix one would you know the cause of this by any chance and again thanks for replying
  10. Waffss

    Droping/removeing swords when equiping bayonet

    Hi, I recently followed Naveys guide on implementing fixing and unfixing bayonets. https://www.fsegames.eu/forum/index.php?topic=17793.msg733177#msg733177 I got it to work and now I'm wondering how to implement dropping or removing the little butter-swords that are meant to attach as bayonets...
  11. Waffss

    How to randomize weapons you spawn in.

    My troop in game: https://gyazo.com/293503c3998243741401e037bc4226a0
    compared to partizani which says random and as i explained before weapon only changes when I select on my troop again and not on respawn.
    Thanks for helping.
  12. Waffss

    How to randomize weapons you spawn in.

    #partizani
    ["russian_partizan","Partizani","Partisan Irregulars",tf_guarantee_all,0,0,fac_russia,
    [itm_rus_partizan1,itm_rus_partizan2,itm_rus_militia_ranker_pants,itm_rus_militia_ranker_pants1,itm_rus_opol_hat_ranker,itm_rus_partisan_hat1,itm_rus_partisan_hat2,itm_rus_partisan_hat3,itm_rus_partisan_hat4,itm_rus_partisan_hat5,itm_rus_opol_hat_ranker,itm_rus_drummer_shako,itm_bullets,itm_russian_dragoon_musket,itm_russian_peasant_fork,itm_russian_peasant_pitchfork,itm_russian_peasant_sap,itm_russian_peasant_kosa,itm_russian_peasant_kosa2,itm_birch_trunk,itm_brokenbottle,itm_russian_peasant_club,itm_russian_peasant_birch_club,itm_russian_peasant_axe,itm_russian_peasant_knife,itm_russian_peasant_serp,itm_russian_peasant_pike,itm_russian_peasant_kuvalda,itm_russian_peasant_2handed_axe,itm_russian_peasant_rogatina,itm_russian_gusarskiy_karabin],
    def_attrib_multiplayer|level(20),wpex(80,5,80,5,130,80),knows_common|knows_ironflesh_3|knows_power_strike_3|knows_athletics_3,swadian_face_middle_1, swadian_face_old_2],

    #my troop:
    ["Militia_rebels","militia rebels","rebels",tf_guarantee_all,0,0,fac_austria,
    [itm_militia_rebel_coat,itm_rebel_hat,itm_prussian_landwehr_pants,itm_russian_peasant_sap,itm_russian_peasant_kosa,itm_russian_peasant_kosa2,itm_russian_peasant_pike,itm_russian_peasant_rogatina,itm_russian_cossack_pike,itm_russian_opolcheniye_pike],
    def_attrib_multiplayer|level(20),wpex(50,5,130,5,300,5),knows_common|knows_ironflesh_3|knows_power_strike_3|knows_athletics_10,swadian_face_middle_1, swadian_face_old_2],
  13. Waffss

    How to randomize weapons you spawn in.

    I am not sure how exactly partizani works in Napoleonic Wars. But if you want to get random weapon,armor or horse - you can use these operations.

    Python:
    store_random_horse              = 2257    # (store_random_horse,<destination>)
    store_random_equipment          = 2258    # (store_random_equipment,<destination>)
    store_random_armor              = 2259    # (store_random_armor,<destination>)
    # I use old modsys, this works perfectly here. In modern modsys, it might now work. In this case. You should choose different approach.

    Keep in mind, if you decide to use this approach, and you don't want to give someone musket without bullets, you have to code it.

    Another approach would be to iterate through weapons/armors range and choose random weapon by your own.

    Most importantly, in both cases you need module system knowledge to understand what I just said.
    Good luck.

    Right but I already have them in the game and they are randomizer but only when selecting them in the manu, but when you die you keep the weapon given to you initially and not a random one. My bad probably should have clarified that initially.
  14. Waffss

    How to randomize weapons you spawn in.

    I created my own troop on NW and gave it a list of weapons but every time I respawn I stay with the same weapon. I want the troop to work exactly as partizani in NW Thanks in advance
Back
Top Bottom