Need help with a trigger

  • Thread starter Thread starter Cruger
  • Start date Start date

Users who are viewing this thread

Cruger

I've had some stuck bugs in my mod lately, where parties for some strange reason would get out on the deep, blue sea, or some random river, and get stuck there.. So I made a trigger to get rid of that, but as it always happens is it not working, and now I need a smarter brain than my own to tell why..

here is the trigger
#Remove stucked parties
(0.1, 0, 0.0, [],
[(try_for_parties, ":cur_party"),
  (party_get_current_terrain, ":terrain", ":cur_party"),
  (eq, ":terrain", 0 ),#water
  (eq, ":terrain", 8 ),#river
  (remove_party, ":cur_party"),
(try_end),]),

Also.. Do "remove_party" remove the parties permanently, or do they respawn after?

Thanks..
 
You probably want this instead:

#Remove stucked parties
(0.1, 0, 0.0, [],
[(try_for_parties, ":cur_party"),
  (party_get_current_terrain, ":terrain", ":cur_party"),
  (this_or_next|eq, ":terrain", 0 ),#water
  (eq, ":terrain", 8 ),#river
  (remove_party, ":cur_party"),
(try_end),]),

Your version says:
- all those guys in water
- AND all those guys standing in a river

You might also want to check to see that you're not accidentally removing a town or placeholder or spawnpoint or something.  Just check the type slot.

As far as I know, remove_party will remove that particular party permanently.  New parties will be spawned of that type given your other triggers/scripts/dialogs/etc.  I usually party_clear before remove_party but I don't know if it's necessary. 
 
kt0 said:
You probably want this instead:

#Remove stucked parties
(0.1, 0, 0.0, [],
[(try_for_parties, ":cur_party"),
  (party_get_current_terrain, ":terrain", ":cur_party"),
  (this_or_next|eq, ":terrain", 0 ),#water
  (eq, ":terrain", 8 ),#river
  (remove_party, ":cur_party"),
(try_end),]),

Your version says:
- all those guys in water
- AND all those guys standing in a river

You might also want to check to see that you're not accidentally removing a town or placeholder or spawnpoint or something.  Just check the type slot.

As far as I know, remove_party will remove that particular party permanently.  New parties will be spawned of that type given your other triggers/scripts/dialogs/etc.  I usually party_clear before remove_party but I don't know if it's necessary.

thanks for your tip, I'll update this when I have tested and seen if this get rid of the stucked parties.. :)

Btw, I don't want parties to be permanently removed, as it is often lords there get stuck, but on the other side don't they always automaticly respawn?

EDIT: I think it works now, becouse my game almost instantly crash, seems like the game don't like this, so I'll have to make a workaround..
 
If it's lord parties that are giving you trouble, you'll probably want to teleport them back to land.  There are a bunch of conditions where lords/lord parties are referenced elsewhere which are tricky to get right.  Really, though, this is just band-aiding the issue.  It's probably better to fix it so they don't end up in water or get stuck in rivers and such. 
 
kt0 said:
If it's lord parties that are giving you trouble, you'll probably want to teleport them back to land.  There are a bunch of conditions where lords/lord parties are referenced elsewhere which are tricky to get right.  Really, though, this is just band-aiding the issue.  It's probably better to fix it so they don't end up in water or get stuck in rivers and such.

teleporting was the first thing I thought about, but I could'nt find any operations that could help me doing it.. So went off with removing them..

anyways, fixing the water bugs are really hard, but I guess I have to give it one more go :)
 
Good luck with this I have the same problem in my mod.  For some reason lords instead of crossing at the ford occasionally just try to go straight through the river and get stuck.  I'm not sure why the ai thinks it can do this do you have any ideas how to baby the ai a little so they don't do this Kto?
By which I mean should I make the river, or the fords bigger?  Cruger I'll try to work on a teleporting script for us both to use in the meantime.
 
Cruger said:
teleporting was the first thing I thought about, but I could'nt find any operations that could help me doing it.. So went off with removing them..
party_set_position should do what you want. 

Berserker Pride said:
Good luck with this I have the same problem in my mod.  For some reason lords instead of crossing at the ford occasionally just try to go straight through the river and get stuck.  I'm not sure why the ai thinks it can do this do you have any ideas how to baby the ai a little so they don't do this Kto?
By which I mean should I make the river, or the fords bigger?  Cruger I'll try to work on a teleporting script for us both to use in the meantime.
With exactly one exception, I've never seen a party in Native run into the water or get stuck (follow the spy quest at Tihr).  That would lead me to believe that it's an issue with the map rather than the pathfinding though Calradia is pretty uninteresting nautically speaking.  What that issue is, I can't say with any certainty, but I'd guess it had to do with elevation, crossing widths like you mention or something along those lines.  I've never made a map but I've seen similar bugs in other mods that replace theirs. 

I can't think of any small AI tweaks that would likely help, sadly.  If it were me and I couldn't find a map fix, I'd probably start hacking up the AI which I've found to be both time consuming and error prone.  As a quick first check, I'd ensure that the AI's destination point isn't located underwater (check every instance of party_set_ai_target_position).  If that didn't work (and I suspect it wouldn't) I'd try to pull the higher level pathing into the module system through a very rough node network.  A simple next hop routing table a la internet routing with a hand-placed node network would probably suffice.  If that didn't fix it, well, I'd be out of ideas  :mrgreen:

That probably doesn't help much, though. 
 
If they could somehow implement an ai mesh for the world map that would solve a lot of pathfinding issues.  As it is now complicated maps with chokepoints seem to have these problems.  Native seems to work because the map is pretty open.  But that also makes it rediculously easy to invade your neighbor.  Ok well I have a preliminary code worked out for the teleport.
Code:
(1, 0, 0.0, [],
[(try_for_parties, ":cur_party"),
   (party_get_current_terrain, ":terrain", ":cur_party"),
   (this_or_next|eq, ":terrain", 0 ),#water
   (eq, ":terrain", 8 ),#river
   (assign, ":closest_dist", 100000),      
            (try_for_range, ":cur_town", towns_begin, towns_end),        
                (store_distance_to_party_from_party, ":dist", ":cur_town", ":cur_party"),        
                (lt, ":dist", ":closest_dist"),        
                (assign, ":closest_dist", ":dist"),        
            (try_end),      
   (party_relocate_near_party, ":cur_party",":cur_town",1),
(try_end),]),
Hope it has no errors I'm going to test it right away.  It checks which town is the closest to the trapped party then teleports them to it.
 
Berserker Pride said:
If they could somehow implement an ai mesh for the world map that would solve a lot of pathfinding issues.  As it is now complicated maps with chokepoints seem to have these problems.  Native seems to work because the map is pretty open.  But that also makes it rediculously easy to invade your neighbor.  Ok well I have a preliminary code worked out for the teleport.
Code:
(1, 0, 0.0, [],
[(try_for_parties, ":cur_party"),
   (party_get_current_terrain, ":terrain", ":cur_party"),
   (this_or_next|eq, ":terrain", 0 ),#water
   (eq, ":terrain", 8 ),#river
   (assign, ":closest_dist", 100000),      
            (try_for_range, ":cur_town", towns_begin, towns_end),        
                (store_distance_to_party_from_party, ":dist", ":cur_town", ":cur_party"),        
                (lt, ":dist", ":closest_dist"),        
                (assign, ":closest_dist", ":dist"),        
            (try_end),      
   (party_relocate_near_party, ":cur_party",":cur_town",1),
(try_end),]),
Hope it has no errors I'm going to test it right away.  It checks which town is the closest to the trapped party then teleports them to it.


Thats great!
I really hope it works.. You'll be my hero if it does :P

edit: It works! I got teleported back on land after I teleported myself out on water! You are great beserker pride :D! The only problem is that it is always is the same town you get teleported back to, but it is not much of an issue
 
Back
Top Bottom