Spawn agent.

Users who are viewing this thread

grailknighthero

Sergeant Knight
What is wrong with this?  After about 3-10 seconds I start the mission this is in, M&B freezes without any error messages and is listed as not responding in task manager.  I have looked around the forums for spawn_agent, and I found Mirathei's code in his Magic Mod, and our code isnt much different.

(ti_before_mission_start, 0, 0, [], [(call_script, "script_change_banners"),(eq, "$g_custom_battle_scenario", 3),(assign, "$cust_grand_stand_enemy_num", 50),]),

(1, 0, 0, [(eq, "$g_custom_battle_scenario", 3),
                (lt, "$cust_grand_stand_enemy_num", 86),
                (store_mission_timer_a,":mission_time"),
                (ge,":mission_time",10),
                (store_enemy_count,":num_attackers"),
                (lt,":num_attackers",25),
                ],
          [(store_random_in_range, ":rand", 0, 30),
            (try_begin),
                (lt, ":rand", 2),
                (assign, ":new_trp_id", "trp_veteran_marauder_horseman"),
            (else_try),
                (lt, ":rand", 5),
                (assign, ":new_trp_id", "trp_veteran_marauder"),
            (else_try),
                (lt, ":rand", 11),
                (assign, ":new_trp_id", "trp_marauder_horseman"),
            (else_try),
                (lt, ":rand", 17),
                (assign, ":new_trp_id", "trp_marauder"),
            (else_try),
                (lt, ":rand", 25),
                (assign, ":new_trp_id", "trp_bondsman"),
            (else_try),
                (assign, ":new_trp_id", "trp_berserker"),
            (try_end),
            (display_message, "@agent would have been spawned here"),
            (set_spawn_position, pos16),
            (spawn_agent,":new_trp_id"),
            (agent_set_team, reg0, 1),
            (val_add, "$cust_grand_stand_enemy_num", 1),]),
 
Are you sure the problem is with the agents?  From your description it's locking up before it passes the 10 second mark.
 
Ok, I removed the spawn agent, replaced it with a display message, and it is fine.  Weird thing is that (store_attacker_count,":num_a"), and (store_enemy_count,":num_attackers"), are both giving an enemy amount of 19, even though there are clearly 50 enemies on the field  :???:  I was wrong on when it kept freezing though.  It was at about 10 seconds into the fight.

Edit: a for statement going through agents and counting those who are enemies returns 50 like it should.

Edit again: adding back in the spawn agent, it froze after we lowered their amount to less than 25 and crashed a minute later, giving a M&B has encountered an error message, asking if I wanted to send a report....
 
Have you tested setting the troop_id and spawn_agent by itself to be sure it works?  As I'm sure you've noticed it's not used anywhere in Native.
 
No I have not.  Ive been really busy lately and M&B is going to have to go into the background for a few weeks...I might test it out later tonight.  Ill get the troop name from the variable and display it and see what it says.  Ill also try to use spawn agent with a trp id instead of a variable. 

I have noticed that in header operations that the code to use spawn agent (the commented out stuff) is wrong and I reported that in the bug thread.
 
This has the same result  :???:

(store_random_in_range, ":rand", 0, 30),
            (set_spawn_position, pos16),
            (try_begin),
                (lt, ":rand", 2),
                (assign, ":new_trp_id", "trp_veteran_marauder_horseman"),
                (spawn_agent,"trp_veteran_marauder_horseman"),
            (else_try),
                (lt, ":rand", 5),
                (assign, ":new_trp_id", "trp_veteran_marauder"),
                (spawn_agent,"trp_veteran_marauder"),
            (else_try),
                (lt, ":rand", 11),
                (assign, ":new_trp_id", "trp_marauder_horseman"),
                (spawn_agent,"trp_marauder_horseman"),
            (else_try),
                (lt, ":rand", 17),
                (assign, ":new_trp_id", "trp_marauder"),
                (spawn_agent,"trp_marauder"),
            (else_try),
                (lt, ":rand", 25),
                (assign, ":new_trp_id", "trp_bondsman"),
                (spawn_agent,"trp_bondsman"),
            (else_try),
                (assign, ":new_trp_id", "trp_berserker"),
                (spawn_agent,"trp_berserker"),
            (try_end),
            (str_store_troop_name,s10,":new_trp_id"),
            (display_message, "@{s10} would have been spawned here"),
            #(spawn_agent,":new_trp_id"),
            (agent_set_team, reg0, 1),
            (val_add, "$cust_grand_stand_enemy_num", 1),
 
To be honest in between spamming forums, inciting hatred and trying fix the bugs in my own crappy code I haven't made the time to play with this.  I've read the threads on here and a few on MBX and it seems to be a problematic operation for most people.  IIRC its suggested using spawn_agent only for friendlies and use this instead for enemies.

add_reinforcements_to_entry            = 1930 # (add_reinforcements_to_entry,<mission_template_entry_no>,<value>),

Wish I could be of some actual help:sad:
 
No problem.  The only reason I am using it is to save on lag for lower end computers in a custom battle, because 80 enemies and 30 friendlies are enough to make my computer lag.  I'll most likely take it out.  The reason why I am not using add reinforcements is because it's a custom battle and I didn't want to have to make parties for custom battles, although I probably will later just so I can cut down on the lag.  cheeseOnToast said he would make LODs for his Marauder so maybe that will help when he gets it done.  Thanks for trying.
 
Back
Top Bottom