More problems with getting Lords on ships

正在查看此主题的用户

状态
不接受进一步回复。

Ruthven

Baron
Okay, I did what Hokie said and got my map maker to fix up the map with steppe terrain, made a materials2.brf file replacing the steppe terrain with water texture etc and making a trigger to switch a party's icon when it goes on water.

Basically, it worked. For the player only, though. When the player goes onto "water", the icon changes to a ship and switches back when off the "water". Doing that was easy. However, the same code doesn't work for other parties. Here's my triggers: (tons more exactly like that but with different party names, but you get the gist of it.)

(0.01, 0, 0, [(party_get_current_terrain,":terrain","p_main_party"),
      (eq,":terrain",2)],
  [(party_set_icon,"p_main_party", "icon_ship"),]),

(0.01, 0, 0, [(party_get_current_terrain,":terrain","p_main_party"),
      (neq,":terrain",2)],
  [(party_set_icon,"p_main_party", "icon_player"),]),


  (0.01, 0, 0, [(party_get_current_terrain,":terrain","pt_kingdom_hero_party"),
      (eq,":terrain",2)],
  [(party_set_icon,"pt_kingdom_hero_party", "icon_ship"),]),


(0.01, 0, 0, [(party_get_current_terrain,":terrain","pt_kingdom_hero_party"),
      (neq,":terrain",2)],
  [(party_set_icon,"pt_kingdom_hero_party", "icon_flagbearer_a"),]),


The red is what makes the party turn into a ship by going on steppe terrain. (eq,":terrain",2) The blue is what changes the icon back. (neq,":terrain",2)

So, it works fine for the p_main_party but not for pt_kingdom_hero_party, and I don't know why. I'm guessing it's either because:
It's a party template, not a party
or
the game doesn't care what terrain AI parties go on. (So long as they keep off water/mountains etc.)

Any ideas how to get this working?
 
Well, you could place separate ocean tile slightly above the walkable land to simulate water where you need it. Game only considers connected surface when pathfinding. This is working spectacularly with rives and fords. The problem is that you can't click on map tiles that are beneath other tiles, so you wont be able to direct your party to points that have water above them.

The other way is to assign map_ocean material to some walkable tiles and paint ocean with those. I don't know how Mirathei script works, but it should have some output on type of tile party is standing on. There will be problems with waves animaiton (no waves) as those are hardcoded to real oceans

BTW, does the script allow moving on water, with or without clicking on water tiles?
 
I did something similar to this in my mod by replacing a certain map texture with a transparent one for space.  Can't you just do something like:

1) include a modified materials.brf that switched something like the "map_steppe" material to be "map_ocean"
2) in the map editor put steppe ground everywhere you want ocean (you won't be able to use steppe texture anymore) so the entire map is movable
3) you'd have to have a trigger that ran on the world map that checked the terrain of each party and did the party_set_icon to switch it to a boat when they were on water and back when they were not on water
4) last, in the game menu that starts a battle you'd have to get the current terrain and if it was water then go to a sea battle, otherwise fight on the ground

for #4 i added it in setup_random_scene in module_scripts.py

插入代码块:
	  party_get_current_terrain, ":terrain_type", "p_main_party"),		
         (try_begin),
         (eq, ":terrain_type", rt_steppe),  # SW - switched steppe to a space texture so use ship scene
		(assign, ":scene_to_use", "scn_random_scene_ship"),
        (else_try),
         (eq, ":terrain_type", rt_plain),
                (assign, ":scene_to_use", "scn_random_scene_plain"),
        <...... more code .......>
        (try_end),
 
well I basically already answered this in response to your PM just now, but for everyone's benefit:

You can't get information about a party by using a party template.

Using a commonly used example from the programming world (for classes and instances, which applies quite well here):

Think of the party template as a recipe. It tells the system how to make a particular type of cookie (the party).

After you bake cookies, you don't eat the recipe, you eat the cookies. The same is true here. When you (or the system) spawns a party, it effectively bakes a cookie, using your party template as the recipe. So any action you take needs to be done on the cookie and not on the recipe.

So what you have to do instead, is iterate over your parties, filter out the ones you want to test, and then test.

So:

插入代码块:
(try_for_parties, ":cur_party"),
   (party_get_template_id, ":cur_template, ":cur_party"),
   (eq, ":cur_template", "pt_kingdom_hero_party"),
   (party_get_current_terrain, "cur_terrain", ":cur_party"),
   (eq, ":cur_terrain", 2), #I would steer away from using the number and use the terrain type instead so you don't confuse yourself if you ever have to get back to this code
   (party_set_icon, ":cur_party", "icon_ship"),
(try_end),

And rather than make a whole bunch of loose triggers, just make one or two with try and try_else statements. Will make it a lot more compact and that way you wont have to iterate over all the parties more than once.

if party (this_or_next| is p_mainparty)
(is of template kingdom_hero_party)
    If terrain is terrain 2
      set icon ship
    if not
      set icon default

You can extend the this_or_next bit to include all the different parties you want to change the icons for, and using the trick I describe below, you won't need to manually add a trigger to set the correct icon back to what it's supposed to be since you can get the information from the game.

If you have different parties with different icons, you can store their current icon in a slot before you change it, so you know what to change it back from. Just pick one that's not used yet, like say 220 (just randomly choosing a number, look in module_constants) and call it slot_party_default_icon

Then before you change it, you party_set_slot it to the value you get with party_get_icon, and then when you change it back you can party_get_slot the value from that slot and use that to set it back to what it was before.

If you can't work it out from the above (very poorly written) pseudocode, let me know and I can help you out.
 
I'm so glad I asked you.  :grin:

I should be able to work that out, thanks.

EDIT: It works so far, I'm just testing out the resetting of the icon...
 
MartinF 说:
well I basically already answered this in response to your PM just now, but for everyone's benefit:

You can't get information about a party by using a party template.

Using a commonly used example from the programming world (for classes and instances, which applies quite well here):

Think of the party template as a recipe. It tells the system how to make a particular type of cookie (the party).

After you bake cookies, you don't eat the recipe, you eat the cookies. The same is true here. When you (or the system) spawns a party, it effectively bakes a cookie, using your party template as the recipe. So any action you take needs to be done on the cookie and not on the recipe.

So what you have to do instead, is iterate over your parties, filter out the ones you want to test, and then test.

So:

插入代码块:
(try_for_parties, ":cur_party"),
   (party_get_template_id, ":cur_template, ":cur_party"),
   (eq, ":cur_template", "pt_kingdom_hero_party"),
   (party_get_current_terrain, "cur_terrain", ":cur_party"),
   (eq, ":cur_terrain", 2), #I would steer away from using the number and use the terrain type instead so you don't confuse yourself if you ever have to get back to this code
   (party_set_icon, ":cur_party", "icon_ship"),
(try_end),

And rather than make a whole bunch of loose triggers, just make one or two with try and try_else statements. Will make it a lot more compact and that way you wont have to iterate over all the parties more than once.

if party (this_or_next| is p_mainparty)
(is of template kingdom_hero_party)
    If terrain is terrain 2
      set icon ship
    if not
      set icon default

You can extend the this_or_next bit to include all the different parties you want to change the icons for, and using the trick I describe below, you won't need to manually add a trigger to set the correct icon back to what it's supposed to be since you can get the information from the game.

If you have different parties with different icons, you can store their current icon in a slot before you change it, so you know what to change it back from. Just pick one that's not used yet, like say 220 (just randomly choosing a number, look in module_constants) and call it slot_party_default_icon

Then before you change it, you party_set_slot it to the value you get with party_get_icon, and then when you change it back you can party_get_slot the value from that slot and use that to set it back to what it was before.

If you can't work it out from the above (very poorly written) pseudocode, let me know and I can help you out.


:smile:  Coooooookieeeeees
 
Ok this doesnt have anything to do with what im going to ask now...
(actually it does a bit) i want to make that when you fight in the forest material the game will by itself go and enter (the scenes of forest i make)
so when i fight in a forest its gonna choose one of those like 30 foresty scenes...
 
MISHO 说:
Ok this doesnt have anything to do with what im going to ask now...
(actually it does a bit) i want to make that when you fight in the forest material the game will by itself go and enter (the scenes of forest i make)
so when i fight in a forest its gonna choose one of those like 30 foresty scenes...
Sorry, you'll have to ask somewhere else. This thread has served it's purpose, therefore, lock.
 
状态
不接受进一步回复。
后退
顶部 底部