Naval Battles

Currently viewing this thread:

bjorne.

Sergeant Knight
Well the thing is.

I will make my naval battle in my mod so that you only use Marine Soldiers there..
How it should work in ideal. Is that when you enter a sea battle you will get the same amount of marines as you have regular troops..
Now. How do I do this? What I've planned so far would be something like this..

Code:
		 (disable_party,"p_main"),
                                 (add_troop_to_site,"marine_troop",<scene_id>,<entry_no>),
	                 (remove_troop_from_site,"marine_troop",<scene_id>),
		 (enable_party, "p_main"),
Though I see that it couldn't work 100%. So I turn to you guys. Do you have any idea of how to solve this?
 

cdvader

Try this. It should be pretty much self-explanatory at what it does (a simple script, after all). Also should work. :razz:

Code:
    <other menu stuff>
    (try_begin),
	   #(store_encountered_party, ":encountered_party"),
	    (store_party_size_wo_prisoners, ":a_size", "p_main_party"),
		#(store_party_size_wo_prisoners, ":b_size", ":encountered_party"),
       (store_party_size_wo_prisoners, ":b_size", "$g_encountered_party"),
		 (val_div, ":a_size", 2),
		 (val_div, ":b_size", 2),
		 (modify_visitors_at_scene, "scn_sea"),
		 (reset_visitors),
		 (set_visitor, 1, "trp_player"),
		 (set_visitors, 2, "trp_marine", ":a_size"), #Allies.
		 (set_visitors, 3, "trp_marine", ":a_size"), #Allies,
		 (set_visitors, 4, "trp_marine", ":b_size"), #Enemy.
		 (set_visitors, 5, "trp_marine", ":b_size"), #Enemy.
	 (try_end),
	 <other menu stuff>
 

bjorne.

Sergeant Knight
Yea. But.. How can I add on more to this. I mean so if you have recruits on land. You'll get worse naval troops. If you have veterans. You'll get better naval troops.
And so the same amount of land soldiers you have will be the same as the amount of naval troops you'll get... Or maybe that ain't possible...
 

Ruthven

Baron
WBM&BVC
bjorne. said:
Yea. But.. How can I add on more to this. I mean so if you have recruits on land. You'll get worse naval troops. If you have veterans. You'll get better naval troops.
And so the same amount of land soldiers you have will be the same as the amount of naval troops you'll get... Or maybe that ain't possible...
It's possible, but you'd either have to make a big expansion on cdvader's code or make a new one altogether that gets checked by a trigger on the overland map. Cdvader's code only changes the visitors when you enter a scene, for this it'd be easier to just change troops when you go on water, store the troop in a new slot and put 'em back once you're off the water again.
 

cdvader

Okay, not sure if this is what you want, but feel free to give it a shot.
#-------------------------------------

    <other menu stuff>
    (try_begin),
(modify_visitors_at_scene, "scn_sea"),
(reset_visitors),
(try_begin),
    (try_for_range, ":veteran", rhodok_veterans_begin, rhodok_veterans_end),
    (eq, ":continue", 0),
    (party_count_members_of_type, ":type", "p_main_party", ":veteran"),
(gt, ":type", 0),
(assign, ":temp", ":type"),
(val_div, ":temp", 2),
(assign, reg1, ":temp"),
(assign, ":troop", "trp_veteran_marine"),
(else_try),
    (try_for_range, ":normal", rhodok_normal_marines_begin, rhodok_normal_marines_end),
    (eq, ":continue", 0),
    (party_count_members_of_type, ":type", "p_main_party", ":normal"),
(gt, ":type", 0),
(assign, ":temp", ":type"),
(val_div, ":temp", 2),
(assign, reg2, ":temp"),
(assign, ":troop", "trp_normal_marine"),
(try_end),
(try_end),
(else_try),
    (try_for_range, ":veteran", swadian_veterans_begin, swadian_veterans_end),
    (eq, ":continue", 0),
    (party_count_members_of_type, ":type", "p_main_party", ":veteran"),
(gt, ":type", 0),
(assign, ":temp", ":type"),
(val_div, ":temp", 2),
(assign, reg1, ":temp"),
(assign, ":troop", "trp_veteran_marine"),
(else_try),
    (try_for_range, ":normal", swadian_normal_marines_begin, swadian_normal_marines_end),
    (party_count_members_of_type, ":type", "p_main_party", ":normal"),
(gt, ":type", 0),
(assign, ":temp", ":type"),
(val_div, ":temp", 2),
(assign, reg2, ":temp"),
(assign, ":troop", "trp_normal_marine"),
(try_end),
(try_end),
(try_end),
(set_visitor, 1, "trp_player"),
(set_visitors, 5, ":troop", reg1), #Allies.
(set_visitors, 6, ":troop", reg1), #Allies.
(set_visitors, 7, ":troop", reg2), #Allies.
(set_visitors, 8, ":troop", reg2), #Allies.
(set_visitors, 10, ":troop", reg1), #Enemy.
(set_visitors, 11, ":troop", reg1), #Enemy.
(set_visitors, 12, ":troop", reg2), #Enemy.
(set_visitors, 13, ":troop", reg2), #Enemy.
(try_end),
<other menu stuff>

#-------------------------------------

Clean version: http://www.2shared.com/file/8133351/8e780d51/script.html.

Hopefully, this script is self-explanatory of what it does. It also should work (untested, though). You need to expand it, too, for other kingdoms.
 

bjorne.

Sergeant Knight
This is precisely what I wanted. Jesus.. I where way of track with my thinking. Though my coding skills cannot match with any of your guys..
But I'll learn more by doing it... right?

Well one thing. Is this just for one country? and what country? and I see alot of faction names. So where do I changed the one to give it to another country?
 

cdvader

This is for two factions. The Rhodoks and the Swadians. To add a new faction, just copy-paste the first try_begins else_try and put it before the last try_end (which is before the "set_visitor, player").

I strongly suggest you do this to all factions and also do another one for factions which are not tied to a kingdom. Something like this.
Code:
		(else_try),
		    (try_for_range, ":other", all_other_marines_begin, all_other_marines_end),
		        (party_count_members_of_type, ":type", "$g_encountered_party", ":other"),
				(gt, ":type", 0),
				(assign, ":temp", ":type"),
				(assign, ":temp_2", ":type"),
				(val_div, ":temp", 2),
				(val_div, ":temp_2", 2),
				(assign, reg1, ":temp"),
				(assign, reg2, ":temp_2"),
				(assign, ":troop", "trp_outlaw_marine"),
			(try_end),

And for the constants, do something like this.
Code:
all_other_marines_begin = "trp_looter"
all_other_marines_end   = "trp_buccaneer"
 

bjorne.

Sergeant Knight
so you mean I have to do one of these to

Swadians vs. Rhodroks
Swadians vs. Nords
Swadians vs. Veagirs
Nords vs. Rhodroks

etc etc.?
 

cdvader

No, no, the script automatically sets the battle enemies (through entry points in your mission template, forgot to mention that one, you need to re-set entry points).

I've re-done the script, fixing a few dumb mistakes (mostly from testing a few things) and done all the units, etc: http://www.2shared.com/file/8138205/22a1d03b/script.html.
#-------------------------------------

    <other menu stuff>
    (try_begin),
(modify_visitors_at_scene, "scn_sea"),
(reset_visitors),
(try_begin),
    (try_for_range, ":veteran", rhodok_veterans_begin, rhodok_veterans_end),
    (party_count_members_of_type, ":type", "p_main_party", ":veteran"),
(gt, ":type", 0),
(assign, ":temp", ":type"),
(val_div, ":temp", 2),
(assign, reg1, ":temp"),
(assign, ":veteran_troop", "trp_rhodok_veteran_marine"),
(else_try),
    (try_for_range, ":normal", rhodok_normal_marines_begin, rhodok_normal_marines_end),
    (party_count_members_of_type, ":type", "p_main_party", ":normal"),
(gt, ":type", 0),
(assign, ":temp", ":type"),
(val_div, ":temp", 2),
(assign, reg2, ":temp"),
(assign, ":normal_troop", "trp_rhodok_normal_marine"),
(try_end),
(try_end),
(else_try),
    (try_for_range, ":veteran", swadian_veterans_begin, swadian_veterans_end),
    (party_count_members_of_type, ":type", "p_main_party", ":veteran"),
(gt, ":type", 0),
(assign, ":temp", ":type"),
(val_div, ":temp", 2),
(assign, reg1, ":temp"),
(assign, ":veteran_troop", "trp_swadian_veteran_marine"),
(else_try),
    (try_for_range, ":normal", swadian_normal_marines_begin, swadian_normal_marines_end),
    (party_count_members_of_type, ":type", "p_main_party", ":normal"),
(gt, ":type", 0),
(assign, ":temp", ":type"),
(val_div, ":temp", 2),
(assign, reg2, ":temp"),
(assign, ":normal_troop", "trp_swadian_normal_marine"),
(try_end),
(try_end),
(else_try),
    (try_for_range, ":veteran", vaegir_veterans_begin, vaegir_veterans_end),
    (party_count_members_of_type, ":type", "p_main_party", ":veteran"),
(gt, ":type", 0),
(assign, ":temp", ":type"),
(val_div, ":temp", 2),
(assign, reg1, ":temp"),
(assign, ":veteran_troop", "trp_vaegir_veteran_marine"),
(else_try),
    (try_for_range, ":normal", vaegir_normal_marines_begin, vaegir_normal_marines_end),
    (party_count_members_of_type, ":type", "p_main_party", ":normal"),
(gt, ":type", 0),
(assign, ":temp", ":type"),
(val_div, ":temp", 2),
(assign, reg2, ":temp"),
(assign, ":normal_troop", "trp_vaegir_normal_marine"),
(try_end),
(try_end),
(else_try),
    (try_for_range, ":veteran", nord_veterans_begin, nord_veterans_end),
    (party_count_members_of_type, ":type", "p_main_party", ":veteran"),
(gt, ":type", 0),
(assign, ":temp", ":type"),
(val_div, ":temp", 2),
(assign, reg1, ":temp"),
(assign, ":veteran_troop", "trp_nord_veteran_marine"),
(else_try),
    (try_for_range, ":normal", nord_normal_marines_begin, nord_normal_marines_end),
    (party_count_members_of_type, ":type", "p_main_party", ":normal"),
(gt, ":type", 0),
(assign, ":temp", ":type"),
(val_div, ":temp", 2),
(assign, reg2, ":temp"),
(assign, ":normal_troop", "trp_nord_normal_marine"),
(try_end),
(try_end),
(else_try),
    (try_for_range, ":veteran", khergit_veterans_begin, khergit_veterans_end),
    (party_count_members_of_type, ":type", "p_main_party", ":veteran"),
(gt, ":type", 0),
(assign, ":temp", ":type"),
(val_div, ":temp", 2),
(assign, reg1, ":temp"),
(assign, ":veteran_troop", "trp_khergit_veteran_marine"),
(else_try),
    (try_for_range, ":normal", khergit_normal_marines_begin, khergit_normal_marines_end),
    (party_count_members_of_type, ":type", "p_main_party", ":normal"),
(gt, ":type", 0),
(assign, ":temp", ":type"),
(val_div, ":temp", 2),
(assign, reg2, ":temp"),
(assign, ":normal_troop", "trp_khergit_normal_marine"),
(try_end),
(try_end),
(try_end),
(try_begin),
    (try_for_range, ":veteran", rhodok_veterans_begin, rhodok_veterans_end),
    (party_count_members_of_type, ":type", "$g_encountered_party", ":veteran"),
(gt, ":type", 0),
(assign, ":temp", ":type"),
(val_div, ":temp", 2),
(assign, reg1, ":temp"),
(assign, ":e_veteran_troop", "trp_rhodok_veteran_marine"),
(else_try),
    (try_for_range, ":normal", rhodok_normal_marines_begin, rhodok_normal_marines_end),
    (party_count_members_of_type, ":type", "$g_encountered_party", ":normal"),
(gt, ":type", 0),
(assign, ":temp", ":type"),
(val_div, ":temp", 2),
(assign, reg2, ":temp"),
(assign, ":e_normal_troop", "trp_rhodok_normal_marine"),
(try_end),
(try_end),
(else_try),
    (try_for_range, ":veteran", swadian_veterans_begin, swadian_veterans_end),
    (party_count_members_of_type, ":type", "$g_encountered_party", ":veteran"),
(gt, ":type", 0),
(assign, ":temp", ":type"),
(val_div, ":temp", 2),
(assign, reg1, ":temp"),
(assign, ":e_veteran_troop", "trp_swadian_veteran_marine"),
(else_try),
    (try_for_range, ":normal", swadian_normal_marines_begin, swadian_normal_marines_end),
    (party_count_members_of_type, ":type", "$g_encountered_party", ":normal"),
(gt, ":type", 0),
(assign, ":temp", ":type"),
(val_div, ":temp", 2),
(assign, reg2, ":temp"),
(assign, ":e_normal_troop", "trp_swadian_normal_marine"),
(try_end),
(try_end),
(else_try),
    (try_for_range, ":veteran", vaegir_veterans_begin, vaegir_veterans_end),
    (party_count_members_of_type, ":type", "$g_encountered_party", ":veteran"),
(gt, ":type", 0),
(assign, ":temp", ":type"),
(val_div, ":temp", 2),
(assign, reg1, ":temp"),
(assign, ":e_veteran_troop", "trp_vaegir_veteran_marine"),
(else_try),
    (try_for_range, ":normal", vaegir_normal_marines_begin, vaegir_normal_marines_end),
    (party_count_members_of_type, ":type", "$g_encountered_party", ":normal"),
(gt, ":type", 0),
(assign, ":temp", ":type"),
(val_div, ":temp", 2),
(assign, reg2, ":temp"),
(assign, ":e_normal_troop", "trp_vaegir_normal_marine"),
(try_end),
(try_end),
(else_try),
    (try_for_range, ":veteran", nord_veterans_begin, nord_veterans_end),
    (party_count_members_of_type, ":type", "$g_encountered_party", ":veteran"),
(gt, ":type", 0),
(assign, ":temp", ":type"),
(val_div, ":temp", 2),
(assign, reg1, ":temp"),
(assign, ":e_veteran_troop", "trp_nord_veteran_marine"),
(else_try),
    (try_for_range, ":normal", nord_normal_marines_begin, nord_normal_marines_end),
    (party_count_members_of_type, ":type", "$g_encountered_party", ":normal"),
(gt, ":type", 0),
(assign, ":temp", ":type"),
(val_div, ":temp", 2),
(assign, reg2, ":temp"),
(assign, ":e_normal_troop", "trp_nord_normal_marine"),
(try_end),
(try_end),
(else_try),
    (try_for_range, ":veteran", khergit_veterans_begin, khergit_veterans_end),
    (party_count_members_of_type, ":type", "$g_encountered_party", ":veteran"),
(gt, ":type", 0),
(assign, ":temp", ":type"),
(val_div, ":temp", 2),
(assign, reg1, ":temp"),
(assign, ":e_veteran_troop", "trp_khergit_veteran_marine"),
(else_try),
    (try_for_range, ":normal", khergit_normal_marines_begin, khergit_normal_marines_end),
    (party_count_members_of_type, ":type", "$g_encountered_party", ":normal"),
(gt, ":type", 0),
(assign, ":temp", ":type"),
(val_div, ":temp", 2),
(assign, reg2, ":temp"),
(assign, ":e_normal_troop", "trp_khergit_normal_marine"),
(try_end),
(try_end),
(try_end),
(set_visitor, 1, "trp_player"),
(set_visitors, 5, ":veteran_troop", reg1), #Allies.
(set_visitors, 6, ":veteran_troop", reg1), #Allies.
(set_visitors, 7, ":normal_troop", reg2), #Allies.
(set_visitors, 8, ":normal_troop", reg2), #Allies.
(set_visitors, 10, ":e_veteran_troop", reg1), #Enemy.
(set_visitors, 11, ":e_veteran_troop", reg1), #Enemy.
(set_visitors, 12, ":e_normal_troop", reg2), #Enemy.
(set_visitors, 13, ":e_normal_troop", reg2), #Enemy.
(try_end),
<other menu stuff>

#-------------------------------------

What the script does is first tell the engine we're gonna modify the scene "sea", then we reset the entry points, afterwards we set the veteran and normal troops for us and then for our enemies.

For example, this is how we set the Nord Veteran Troop for player team: first, we'll get all the veteran troops into the variable :veteran, then we count how many :veteran troops there are, then we make sure there are more than 0 :veteran troops, if there are, then we get out our :temp (temporary) variable and assign the value of :type to it (:type is the number of the :veteran troops), we divide :temp with 2, assign :temp's value to reg1 (registry, only numbers) and assign :veteran_troop to trp_nord_veteran_marine.

Hopefully that cleared some stuff up. Btw, yes, I'm aware the script is rather large now. :razz:
 

cdvader

Well, there's also (yet) another thing what you might want to edit.

Right now, if you have like, 30 Rhodok Normals and 50 Swadian Normals, it will run the checks and 50 Marines will spawn, not 80. So, for this, I believe a simple check would do it. Something like this.
Code:
(try_begin),
    (gt, reg1, 0),
    (val_add, reg1, ":temp"),
(else_try),
    (assign, reg1, ":temp"),
(try_end),

And add (assign, reg1, 0), to the beginning of all the stuff (before the try_for_ranges).
 
Top Bottom