Search results for query: *

  1. MartinF

    Long term use of regs?

    exaclty... as long as the temp troops/items/parties are not in any of the native loops (something_begin, something_end) their native slots would never be used or set so it wouldn't matter which slot nrs you use.

    From a good coding point of view it might still be a good idea to declare the slots in module_contants, just so you (or someone else using the code) know what each slot does for that array unit.

    You could define say, troop_array_1 through however many you need and then define

    slot_array_whatever = 1

    and so on, so you have a reference for what is actually defined in each slot for the array troop.

    And yeah, the biggest benefit over using global vars would be that you can loop.  Since there's an eq and a ge operation for slots, you've got most of the functionality you'd have when comparing vars and when you need to do more complicated stuff you can get_slot and set_slot which are hardly very processor intensive operations.
  2. MartinF

    OSP Code Combat Spear Bracing Kit (Updated)

    it would be possible to code AI for the horses not wanting to run into the spear wall, just iterate over the agents, see if they are close to the wall and then script their behavior to move away from it. You could do this based on horse type, as trained warhorses would be more willing to charge to their deaths than a normal saddle horse, and throw some randomness in there for good measure.

    Equally, giving a limited range of rotation might also be possible but more difficult.
  3. MartinF

    New Jousting (just need animation!)

    it's frustrating that nobody has still been able to work out how to make the horseback animations work. Strange thing is that you would think they are separate animations, since the body position is different to when you're standing upright but if that were true they'd be relatively easy to find. So it has to be some sort of flag, which makes you wonder why the game doesn't just check to see if the agent is on a horse and then plays the proper animation.

    But yeah, apart from that I'm keen to see how you did all this :smile:
  4. MartinF

    Few Noob questions

    Maverick, can you also post your code that is giving those errors? Not the whole files but just the lines that it is giving the errors for. Two of them seem to be simple syntax errors, so probably just a comma left out or something, but the other one is interesting, I've never seen that before.
  5. MartinF

    Hi, One question.

    it might be possible by duplicating an existing entry and then changing the mesh id in the txt file to correlate with your new mesh

    if you open item_kinds.txt you'll see:

    Code:
     itm_horse_meat Horse_Meat Horse_Meat 1  raw_meat 0  34078731 0 12 0 40.000000 100 30 0 0 0 0 0 0 0 40 0 0

    so raw_meat would be the mesh, for example.

    You should be able to duplicate one of the weapon tuples, paste it at the bottom, change the name (itm_) and the mesh and then you can edit the item in the item editor.

    I've never tried that but so no reason why it wouldn't work.
  6. MartinF

    Modding Q&A [For Quick Questions and Answers]

    If you want to learn more about using Wings3D you should check out Highelfs' video tutorials in the stickies on the main page, they are quite good and will teach you how to add more vertices and manipulate them.
  7. MartinF

    Long term use of regs?

    I think that was also what Twan meant, jik.

    And I think that would still be the best option as long as we can't directly use arrays for data storage. Although using a hundred global vars is not necessarily as bad as it would seem as their memory footprint is very small.
  8. MartinF

    Desert Islands, Gorillas, Lizardmen and other OSP ideas, models and textures

    judging by the stuff you make you quite like the mushrooms yourself hehehe

    but great work! way to think outside the box with the birds and insects
  9. MartinF

    What will return to a script

    yeah, see my response in the thread for the invisible agent thing, should be just near this one as I just responded to it again.

    You could make a list of slots in module_constants to use only with a temp party/item/troop and then store your data to that. Would be cleaner and easier for coding than using regs or global vars, if it's a lot of info.
  10. MartinF

    Agents control questions

    uhm.. why would the temporary party not be avialable in a mission?

    you can read/write slots to troops and parties from a mission template, I'm pretty sure. Same way you can scan inventory on a troop, even though the troop is not in the mission, you're identifying what type of troop an agent is and then you look at the general stats for that troop..

    but since I dont know exactly what you want to do, it's possible that I'm off target here.

    if you just want an array to store information in though, that would certainly be a possibility
  11. MartinF

    OSP Kit Combat Battlefield Tactics kit. Multiple formations per team+command revamp!

    In my experience MNB doesn't use floats or doubles.. so 0.1 would be difficult, but you could use 100 and 10
  12. MartinF

    Is there way to check for mounted agents? Is there a 'no loot' flag?

    how about just generally using the agent_get_horse operation?

    If that returns 0, there's no horse. Or at least I'm guessing that would be the case. You could test that quite easily by display_messaging the outcome of agent_get_horse

    Alternatively you could check the inventory for the horse but that won't tell you if the player dismounted, I think it'll still be in the inv, same if it gets knocked out.
  13. MartinF

    Free Camera after Death

    haha naturally gifted.. yeah.. I only spent a couple hundred hours trying to figure it all out :wink:

    It's strange that you're getting the m/n message.. make sure you corrected the victory condition to comment out the (neg|main_hero_fallen) because otherwise it won't trigger.

    Basically all my triggers relating to this should have (main_hero_fallen) as conditions so they should only show up when you're knocked on your ass
  14. MartinF

    Agents control questions

    you could have an invisible agent, technically, but you'd have to actually make an invisible troop which doesn't show up and you should also not forget to remove it since the game will still see it.

    But you don't have to use an agent just because you're in a mission. You can still use a temporary troop/item/party that's not actually in the mission to store temporary information to.

    Like say you make a temp_mission_party, then you can simply use that to store your information to. It's safer, since you can't forget to remove it, and it's also invisible and won't mess up the information in the battle overview or cause the mission to behave in a way you weren't expecting.

    As for the speed of scripted units, check out the native scripts for town walkers for how to set speed.
  15. MartinF

    "Script can fail" error?

    yeah kt0 already explained it.

    Basically envision this.

    You're writing a script that has to return something to reg0

    but in the root of that script (so not in a try_begin/try_end) you have a condition, like let's say (eq, ":my_var", 1),

    If :my_var isn't 1, then the whole script fails and won;t return any information.

    Just in case you didn't realize this could happen, the compiler throws this warning and prompts you to use cf_ in front of the script name so you as a programmer are aware that it won't always return a value.

    Usually when I get this, it means that I messed up my if statements, unless it's a script that's specifically meant to check for a condition
  16. MartinF

    Free Camera after Death

    sure, you just have to store the original player agent.

    Only potential problem might be that you're actually physically moving the player agent with this method.. which you would obviously not want with the jousting.

    But you can move the mission cam and then put it back where you want it (on the player) afterwards. You'll also have to experiment with the mission cam modes, I had some dodgy results. It's supposed to be possible to set it to free or to lock it, but somehow whatever I do if I move it, it locks, so you can't mouse-look anymore.

    What you could also do is something similar to what happens here when you 'switch' to a new player. As soon as you initiate the strike for the joust, the camera zooms up and out so you can see the result, then settles back on the player.
  17. MartinF

    Free Camera after Death

    well it's a bit different in each mission template, but the example I gave is from lead_charge

    most of the templates have a (0,0, ti_once) trigger, somewhere near the top where some global vars are initialized. such as (assign,"$battle_won",0), and also where the script is called for the banner near inventory and the culture specific music. That's the one.

    It doesn't really matter, you can also just make a whole new (0,0, ti_once) trigger, as long as the vars get initialized.

    But if you get the global var never used, I'm guessing it's not this problem.

    Did you add the constants to the mission template? The bit I posted goes in the top, before the actual mission templates (where the common_ stuff is declared) and then in each mission template where you want to use it, you have to add

    sw_deathcam_follow_troop,
    sw_deathcam_valkyrie_move_camera,
    sw_deathcam_cycle_fowards,
    sw_deathcam_cycle_backwards,

    In lead_charge you can put it right under

          common_battle_victory_display,

    for instance. Doesn't really matter, as long as it's in the triggers part of the mission template
  18. MartinF

    Official 3D art thread - Warband

    lol!!

    As if being killed by Jabba wasn't bad enough, you can now get slain by a microphone wielding rock&roll musician!!

    haha, very nice as usual mate.

    Crotch on the jeans still looks wonky tho :wink:
  19. MartinF

    OSP Kit Combat Battlefield Tactics kit. Multiple formations per team+command revamp!

    Exin said:
    I would like to ask something: Is it possible to make it so that regarding the morale, certain troops like High Tier Swadian Cavalry will fight on while Peasants will break and run? Is it possible to have moral affect the soldiers based on troop type?

    You could certainly do something like that. You'd just have to add a slot to all the troops and put some data in there, and then add a bit to the morale script that checks for the basic morale of that troop.

    I'm not sure how it currently works so it might be a major overhaul, but theoretically it's possible.

    @Anton: Firstly, using caps and complaining is usually not the best way to get help. Secondly, like Mord says, it would seem you're not using the module system. So start by reading Jik's tutorial on the module system, it's on the first page atm. After that you should be able to put this in without too much trouble, it's pretty user-friendly
  20. MartinF

    Free Camera after Death

    I've adapted that code so that it won't let you switch players but just jump the view through your surviving troops, a little like the way it works in Counter Strike after you're dead.

    Let me know if you're interested, I can post it quite easily and it's a piece of piss to implement

    [edit]

    ok some ppl were interested so I'll go ahead and post my code:

    this goes in module_scripts:

    Code:
    # script_dmod_cycle_forwards
      # Output: New $dmod_current_agent
      # Used to cycle forwards through valid agents
      ("dmod_cycle_forwards",[
    
                (assign, ":agent_moved", 0),
                (assign, ":first_agent", -1),
                (get_player_agent_no, ":player_agent"),
             (agent_get_team, ":player_team", ":player_agent"),
                   
                (try_for_agents, ":agent_no"),
                    (neq, ":agent_moved", 1),
                    (neq, ":agent_no", ":player_agent"),
                    (agent_is_human, ":agent_no"),
                    (agent_is_alive, ":agent_no"),
                (agent_get_team, ":cur_team", ":agent_no"),
                (eq, ":cur_team", ":player_team"),
    #                (agent_get_troop_id, ":agent_troop", ":agent_no"),
                    (try_begin),
                        (lt, ":first_agent", 0),
                        (assign, ":first_agent", ":agent_no"),
                    (try_end),
                    (gt, ":agent_no", "$dmod_current_agent"),
                    (assign, "$dmod_current_agent", ":agent_no"),
                    (assign, ":agent_moved", 1),
                (try_end),
    
                (try_begin),
                    (eq, ":agent_moved", 0),
                    (neq, ":first_agent", -1),
                    (assign, "$dmod_current_agent", ":first_agent"),
                    (assign, ":agent_moved", 1),
                (else_try),
                    (eq, ":agent_moved", 0),
                    (eq, ":first_agent", -1),
                    (display_message, "@No Troops Left."),
                (try_end),
       
                (try_begin),
                    (eq, ":agent_moved", 1),
                    (str_store_agent_name, 1, "$dmod_current_agent"),
                    (display_message, "@Selected Troop: {s1}"),
                (try_end),
          (assign, "$dmod_move_camera", 1),
        ]),
       
      # script_dmod_cycle_backwards
      # Output: New $dmod_current_agent
      # Used to cycle backwards through valid agents
      ("dmod_cycle_backwards",[
    
                (assign, ":new_agent", -1),
                (assign, ":last_agent", -1),
                (get_player_agent_no, ":player_agent"),
             (agent_get_team, ":player_team", ":player_agent"),         
                   
                (try_for_agents, ":agent_no"),
                    (neq, ":agent_no", ":player_agent"),
                    (agent_is_human, ":agent_no"),
                    (agent_is_alive, ":agent_no"),
                (agent_get_team, ":cur_team", ":agent_no"),
                (eq, ":cur_team", ":player_team"),
     #               (agent_get_troop_id, ":agent_troop", ":agent_no"),
                    (assign, ":last_agent", ":agent_no"),
                    (lt, ":agent_no", "$dmod_current_agent"),
                    (assign, ":new_agent", ":agent_no"),
                (try_end),
    
                (try_begin),
                    (eq, ":new_agent", -1),
                    (neq, ":last_agent", -1),
                    (assign, ":new_agent", ":last_agent"),               
                (else_try),
                    (eq, ":new_agent", -1),
                    (eq, ":last_agent", -1),
                    (display_message, "@No Troops Left."),
                (try_end),
    
                (try_begin),
                    (neq, ":new_agent", -1),
                    (assign, "$dmod_current_agent", ":new_agent"),
                    (str_store_agent_name, 1, "$dmod_current_agent"),
                    (display_message, "@Selected Troop: {s1}"),
                (try_end),
          (assign, "$dmod_move_camera", 1),
       ]),

    this goes in module_mission_templates:

    Code:
    sw_deathcam_follow_troop = (0, 0, 0,[(eq, "$dmod_move_camera", 2),
            (agent_get_position, 1, "$dmod_current_agent"),     
            (get_player_agent_no, ":player_agent"),
            (agent_set_position, ":player_agent", 1)
    
         ],[])
    sw_deathcam_valkyrie_move_camera = (0, 1, 2.1,[(eq, "$dmod_move_camera", 1),
            (agent_get_position, 2, "$dmod_current_agent"),             
            (position_move_z, 2, 300),
            (mission_cam_set_mode,1),     
            (mission_cam_set_position, 2),
            (position_move_z, 2, 600),
            (mission_cam_animate_to_position, 2, 1000),
         ],[
            (mission_cam_set_mode, 0, 1000, 1),
            (assign, "$dmod_move_camera", 2),
         ])   
    sw_deathcam_cycle_fowards =	 (0, 0, 0,[(key_clicked, key_m), (main_hero_fallen),
            (call_script, "script_dmod_cycle_forwards"),
            ], [])
    		
    sw_deathcam_cycle_backwards = (0, 0, 0,[(key_clicked, key_n), (main_hero_fallen),
            (call_script, "script_dmod_cycle_backwards"),
            ], [])

    you can obviously change the names, these are from the Star Wars Calradia mod.

    So that's the basics. Now for implementing it you'll need to do a few more things. If you already have the system like in SoD where the mission doesn't end when you get knocked out, you're good to go. Just put these constants in the mission templates you want to use them in and then after you're knocked out, you can use m and n to cycle through your troops and watch over their shoulder.

    If not, there's a bit more work to be done. You'll have to implement the 'no-death' thing.

    In the constant victory conditions, like common_ and custom_battle_check_victory_condition, you'll find stuff like:

        (neg|main_hero_fallen, 0),

    You'll need to comment these out.


    Then there is common_siege_check_defeat_condition = ( which you'll have to change so it looks something like this:

    Code:
    common_siege_check_defeat_condition = (
      1, 4, ti_once,
      [
        (main_hero_fallen)
        ],
      [
        (assign, "$pin_player_fallen", 1),
    	(display_message, "@You have been knocked out by the enemy. Watch your men continue the fight without you or press Tab to retreat."),
    	(display_message, "@If you choose to watch the fight you can use the M and N keys to change your camera view."),
        # (get_player_agent_no, ":player_agent"),
        # (agent_get_team, ":agent_team", ":player_agent"),
        # (try_begin),
          # (neq, "$attacker_team", ":agent_team"),
          # (neq, "$attacker_team_2", ":agent_team"),
          # (str_store_string, s5, "str_siege_continues"),
          # (call_script, "script_simulate_retreat", 8, 15),
        # (else_try),
          # (str_store_string, s5, "str_retreat"),
          # (call_script, "script_simulate_retreat", 5, 20),
        # (try_end),
        # (assign, "$g_battle_result", -1),
        # (set_mission_result,-1),
        # (call_script, "script_count_mission_casualties_from_agents"),
        # (finish_mission,0),
        ])

    Finally, you'll have to initialize the global variables in every template. This is an example from lead_charge, most templates look slightly different but the basics are the same:

    Code:
          (0, 0, ti_once, [], [(assign,"$battle_won",0),
                               (assign,"$defender_reinforcement_stage",0),
                               (assign,"$attacker_reinforcement_stage",0),
                               (assign,"$g_presentation_battle_active", 0),
                               (call_script, "script_place_player_banner_near_inventory"),
                               (call_script, "script_combat_music_set_situation_with_culture"),
    						   #SW Deathcam
    						   (assign, "$dmod_current_agent", -1),
    						   (assign, "$dmod_move_camera", -1),
                               ]),

    These three basics apply to all templates. So go through all of them and every trigger that fires on [main_hero_fallen] will have to be modified like above one. So change the code so it doesn't end the mission after you die. One more example from the lead_charge template:

    Code:
          (1, 4, ti_once, [(main_hero_fallen)],
              [
                  (assign, "$pin_player_fallen", 1),
    			  (display_message, "@You have been knocked out by the enemy. Watch your men continue the fight without you or press Tab to retreat."),
    			  (display_message, "@If you choose to watch the fight you can use the M and N keys to change your camera view."),
                  # (str_store_string, s5, "str_retreat"),
                  # (call_script, "script_simulate_retreat", 10, 20),
                  # (assign, "$g_battle_result", -1),
                  # (set_mission_result,-1),
                  # (call_script, "script_count_mission_casualties_from_agents"),
                  # (finish_mission,0)
    			  ]),

    You'll also have to change the common_battle_tab_press constant, otherwise you won't be able to get out of the mission properly anymore. Mine looks like this:

    Code:
    common_battle_tab_press = (
      ti_tab_pressed, 0, 0, [],
      [
        (try_begin),
          (eq, "$battle_won", 1),
          (call_script, "script_count_mission_casualties_from_agents"),
          (finish_mission,0),
    	(else_try),
    		(eq, "$pin_player_fallen", 1),
    		(call_script, "script_simulate_retreat", 5, 20),
    		(str_store_string, s5, "str_retreat"),
    		(call_script, "script_count_mission_casualties_from_agents"),
    		(set_mission_result, -1),
    		(finish_mission,0),
        (else_try),
          (call_script, "script_cf_check_enemies_nearby"),
          (question_box,"str_do_you_want_to_retreat"),
        (else_try),
          (display_message,"str_can_not_retreat"),
        (try_end),
        ])


    If you're having trouble with this, a good option would be to get the source code for Sword of Damocles and look at how they changed their mission_templates, as they already have the 'stay in the fight after death' feature in there. Then you can just add the extra triggers and global variables in and it will work.

    Now this feature still needs to be tweaked a little bit in my opinion. Right now the camera soars up into the sky, moves over the troop and then sinks down. This takes a bit long. One way around it, is to only use the 'dmod_follow_troop' trigger (the first one). You can do this by changing the condition block to ,(eq, "$dmod_move_camera", 1), and then commenting out the second trigger (move_camera). Problem with this is that your camera will stay looking in the same direction, it won't look towards where the troop is looking. I was still working on that but haven't had much time to code lately (sorry Hokie..)

    I've been playing around with various camera settings and different ways of doing it but haven't found anything I really liked yet.

    This might not be something for the total newb at modding, but with a bit of thinking it's really pretty basic stuff.

    Kudos for this don't go to me, but to silverkatana and his Valkyrie minmod, I just changed it around.
Back
Top Bottom