Sea Battles

Started by Jubal, December 14, 2008, 03:31:09 PM

Previous topic - Next topic

Guest

What/where are the files? I've searched for the files named, and they don't exist anywhere on my entire computer. Do I need to create them?

Jubal

You need a copy of;
- Python, the language by which M&B modding works
- the ModuleSystem, a set of Python scripts released by the developers which can be compiled to make mods.

These can both be found on the TaleWorlds official forum.
The duke, the wanderer, the philosopher, the mariner, the warrior, the strategist, the storyteller, the wizard, the wayfarer...

cdvader

#17
Hey man. This is some nice contribution you've made to the whole modding community, etc. So I thought I'd help you with some issues you had previously. Hope I will help.

In this thread, http://forums.taleworlds.net/index.php/topic,53962.0.html, I saw you were having problems by "connecting" scene props. You can "connect" objects by using the (position_transform_position_to_parent) or (position_transform_position_to_local). I recommend using the transform to local variant.

And in this thread, http://forums.taleworlds.net/index.php/topic,72933.msg1893703.html#msg1893703, I saw you had a pretty ... no offense: crappy code. Try this code, it should work.


   #CdVader - Ship Collision fixer.
#Put this in your ship's mission template.
   (1, 0, ti_once, [],
   [(scene_prop_get_instance, ":player_ship", "spr_player_ship", 0),
(scene_prop_get_instance, ":enemy_ship", "spr_enemy_ship", 0),
(prop_instance_get_position, pos1, ":player_ship"),
    (prop_instance_get_position, pos2, ":enemy_ship"),
(try_begin),
   (get_distance_between_positions, pos1, pos2),
(lt, ":distance", 400),
(position_move_z, pos1, 200),
(position_move_z, pos2, -200),
(prop_instance_animate_to_position, pos1, ":player_ship", 400), #4 seconds.
(prop_instance_animate_to_position, pos2, ":enemy_ship", 400), #4 seconds.
(try_end),
(assign, "$boardedd", 1),
]),


Again, I hope I helped,
cdvader.

PS: Download this file for the "cleaner" version.

Attachments:

deathincarnatelolz

Quote from: "cdvader"Hey man. This is some nice contribution you've made to the whole modding community, etc. So I thought I'd help you with some issues you had previously. Hope I will help.

In this thread, http://forums.taleworlds.net/index.php/topic,53962.0.html, I saw you were having problems by "connecting" scene props. You can "connect" objects by using the (position_transform_position_to_parent) or (position_transform_position_to_local). I recommend using the transform to local variant.

And in this thread, http://forums.taleworlds.net/index.php/topic,72933.msg1893703.html#msg1893703, I saw you had a pretty ... no offense: crappy code. Try this code, it should work.


   #CdVader - Ship Collision fixer.
#Put this in your ship's mission template.
   (1, 0, ti_once, [],
   [(scene_prop_get_instance, ":player_ship", "spr_player_ship", 0),
(scene_prop_get_instance, ":enemy_ship", "spr_enemy_ship", 0),
(prop_instance_get_position, pos1, ":player_ship"),
    (prop_instance_get_position, pos2, ":enemy_ship"),
(try_begin),
   (get_distance_between_positions, pos1, pos2),
(lt, ":distance", 400),
(position_move_z, pos1, 200),
(position_move_z, pos2, -200),
(prop_instance_animate_to_position, pos1, ":player_ship", 400), #4 seconds.
(prop_instance_animate_to_position, pos2, ":enemy_ship", 400), #4 seconds.
(try_end),
(assign, "$boardedd", 1),
]),


Again, I hope I helped,
cdvader.

PS: Download this file for the "cleaner" version.
Where do I put the ship code??

And where do I put this:

Spoiler: click to toggle

cdvader

Quote from: "Deathincarniatelolz"Where do I put the ship code??
You mean my Ship Collision fixer? It goes to your "ship_battle" mission template, but do not use it yet. Jubal needs to play around with the values on the script.

Quote from: "Deathincarniatelolz"And where do I put this:
As Jubal said, you need to put it in your "Town" menu.

Jubal

Thanks, I'll test this soon. Just got back from holiday.
The duke, the wanderer, the philosopher, the mariner, the warrior, the strategist, the storyteller, the wizard, the wayfarer...

mr wabbit

Interesting I have tested and found it to work fine though a few little issues I thought I would bring up

Ships can take some time to reach each, also the smoke particals overlay on the deck of the ship so makes the ship look like its sinking.
Camp menu needs sorting
After battles you become a person running on water though maintain the ship status

I wouldnt find playing around sometime.

Also whats the verdict on cdvader's little collision fix
Also at the start the bandits swamp thir its impossible to get close

Also you can buy ships from all towns though not able to move from other towns easily ie constant do you want to disembark.

Lastly a little thing I noticed, not changed it in case it was purposefull chances unlikily.
QuoteAdd this to module_party_templates;
Code:
("sea_pierats","Sea Pirates",icon_ship|pf_is_ship|carries_goods(2),0,fac_outlaws,bandit_personality,[(trp_sea_raider,20,35)]),

Last but not least the strings dont seem to work I am probley being silly and placed them wrong am rather tired, oh and highlighted a spelling issue
Module_strings;
QuoteThese show you which command you have given yur ship;
Code:
("hold", "Drop the anchor and hold here!"),
("skirmish", "Skirmish with the enemy!"),
("board", "Close in and board the enemy ship!"),
("numberofships", "{reg60}"),

Hope all this helps I hope to go though more detail soon

Jubal

The yur is not purposeful, the pierats is.

I'm working on an updated version of all this code, the stuff I've got in SR now hopefully has some major improvements.
The duke, the wanderer, the philosopher, the mariner, the warrior, the strategist, the storyteller, the wizard, the wayfarer...

COGlory

Sorry for the necro, but....

It keeps saying that (store_random,":spawn_point",num_sea_pirate_spawn_points),

is not defined.  I've gone to party_templates.py and checked, and the spawn points were sea_pirate_spawn_point
and
sea_pirate_spawn_point_2
and
sea_pirate_spawn_point_3

so I tried changing them in the script and it still didn't work.  Any help?  Thanks!

Jubal

Try changing that to a constant which is the number of sea pirate spwans you have?
The duke, the wanderer, the philosopher, the mariner, the warrior, the strategist, the storyteller, the wizard, the wayfarer...

COGlory

Change into a constant?  How?

Also, has anyone had any problems during a land battle it keeps saying "[Debug Line Reached]

COGlory

Alright, I changed it into a constant, and it still gives me errors, only they say:

"sea_pirate_spawn_point" not defined

COGlory

Since I still actually use this thread for a reference, the module_game_menus.py code should be this:

    ("sail_from_port",[(party_slot_eq,"$current_town",slot_party_type, spt_town),
                       # (party_slot_eq,"$current_town",slot_town_near_shore, 1),  #Should remain commented when code implemented.  ~CO
                       ], "Buy a ship (2000 denars)",  #Note: (--Code needs to be revised to check if player has gold.  ~CO--) <--DONE!  ~CO
     [(store_troop_gold, ":gold", "trp_player"),
  (assign, "$g_player_icon_state", pis_ship),
  (try_begin), #begin check if player has gold
    (ge, ":gold", 2000), #if players gold is 2000 or greater, then give ship
        (party_set_flags, "p_main_party", pf_is_ship, 1),
        (troop_remove_gold, "trp_player", 2000),
        (party_get_position, pos1, "p_main_party"),
(map_get_water_position_around_position, pos2, pos1, 6),
        (party_set_position, "p_main_party", pos2),
        (assign, "$g_main_ship_party", -1),
        (change_screen_return),
  (else_try), #if not, then display message
    (display_message, "@You don't have enough denars!"),  
  (try_end),
      ]),


Otherwise, you can buy the ship even if you don't have 2000 denars.

Jubal

Yesh, on my version I simply stopped the menu appearing if you had under 2000 denars, but I never added that to the public code for some reason. Thanks, anyhow.
The duke, the wanderer, the philosopher, the mariner, the warrior, the strategist, the storyteller, the wizard, the wayfarer...

COGlory

Well, for anyone wondering how to do that:


    ("sail_from_port",[(party_slot_eq,"$current_town",slot_party_type, spt_town),
        (store_troop_gold, ":gold_check", "trp_player"),
        (eq, ":gold_check", 2000),      
                       ],
                  "Buy a ship (2000 denars)",


:P

(Good idea, by the way.)