party_set_flags

Users who are viewing this thread

Keedo420

Knight at Arms
I had a question about this operation.... I'm planning on adding a pirate faction to my mod, but I don't want them eliminated in the usual way. The pirates will be a faction that will only be encountered on the sea (with a few exceptions, such as enemies in treasure hunting scenes). My plan is to have their towns be located on small islands and will only be reachable by boat, so only the player will be able to eliminate them. But what I'd like to do is have their towns initially be hidden. The only way to unhide them would be to capture one of their lords and interrogate them. Or possibly get the location from an informant. Once the location is known, I'd use the party_set_flags operation to change the town's flags and unhide them. The format for the command is: (party_set_flag, <party_id>, <flag>, <clear_or_set>),

All examples I've looked at use 0 or 1 for the <clear_or_set> parameter. So I'm guessing 0 would be to remove the flag?

So if the party looked like this by default:
("town_26","Pirate's_Cove", icon_town|pf_town|pf_disabled, no_menu, pt_none, fac_neutral,0,ai_bhvr_hold,0,(-48.0495, -25.0912),[], 25),

Would setting the operation like this work to unhide the town so the player can enter/attack it?:
(party_set_flag, "town_26", pf_disabled, 0),

NOTE: This faction would of course have to be made unjoinable to prevent the player from exploiting the fact that the npc kingdoms could never conquer it, and now that I think about it, this would make any kingdom the player joined undefeatable except by the player, so I'd either have to make the pirate towns be on the coastline of the mainland or make them become neutral locations once conquered. Any thoughts on this?
 
(party_set_flag, "p_town_26", pf_disabled, 0),

Yes, that will enable the town. You can also use the simpler:
Code:
(enable_party, "p_town_26"),

Alternatively, if you want to change pf_always_visible instead of pf_disabled, use the first method. But disabled has worked for me.
 
First off, good call on the missing "p_" I did that in a hurry. I haven't actually written the code yet. But I think the enable_party one would be better now that you mention it. I didn't even see that one in the operations list. :P Thanks.
 
You know, I want pretty much the same thing for my mod. Although my plan was that if you go near the town, it will unhide, you go a bit away and it will hide again.

Hope you manage to solve it out.  :wink:
 
I do not want to pick holes, but does not the flag pf_disabled deny the use of these towns even for the pirates themselves?
Disabling is not just "turning invisible", or is it?

@cdvader:
Just removing the flag pf_always_visible should solve your problem, should it not? I do admit that I did not test this.
 
Do the pirates need to interact with the town?  Maybe you can just change the icon from a small dot to the town when the player is close enough.  Maybe the PF no label will make it seem invisible?
 
A disabled party will still be active for the AI. If you disable all towns and turn on truesight, you'll see parties leave and enter the disabled towns.

Ok, I was saving this for the release of Overlord mod, but I'll share the code to do this:

Code:
# Put in module_scripts:
# HC -  Script to init all centers to be disabled on the world map.
#		Works in conjunction with a simple trigger which calls script check_for_center_visibility. 
("init_center_visibility", [
	(try_for_range, ":center_number", centers_begin, centers_end),
		(party_set_flags, ":center_number", pf_disabled, 1),
	(try_end),
]),

# HC -  Script to enable a center when it becomes within viewing range on the world map.
("check_for_center_visibility", [
	(try_for_range, ":center_number", centers_begin, centers_end),
		#TODO: Short ciruit if the party is already visible.
		(store_distance_to_party_from_party, ":distance", ":center_number", "p_main_party"),

		#Apply the Spotting bonus only during the day.
		(try_begin),
			(neg|is_currently_night),
			(party_get_skill_level, ":spotting_skill", "p_main_party", skl_spotting),
			(val_sub, ":distance", ":spotting_skill"),
		(try_end),
		
		(le, ":distance", 5),
		(party_set_flags, ":center_number", pf_disabled, 0),
	(try_end),
]),

Just put a call to init_center_visibility in the script that inits a new game.

Code:
# Put in module_simple_triggers:
# HC - Check if a center is within view. If so, change the party flag to enabled.
	(0,
	[
		(call_script, "script_check_for_center_visibility"),
	]),
 
Awesome! That's more or less what I was aiming for. Do you happen to know if a center is on water, and the player is in a boat, will the player be able to enter the center as if they were on land? Here's a screenshot of one of the hidden pirate towns I am working on. It's only about 50% finished, but what I was intending to do was put the center on the ocean and once the player knows the location, it would show up on the map when they sailed near it. Then they could dock at the town's port.

mb2s.jpg


In case that idea doesn't work out, I have a backup plan for how the players will get there.
 
Back
Top Bottom