Cloaking Device Modmod

still no sound
promotion show AS2D sound on
but nothing there is not such sound
in sound folder

There should be a sound AS2D_CLOAK_ON in the Audio 2D scripts file in Assets\XML\Audio. Please go into that file and see if you find this sound effect (and the AS2D_CLOAK_OFF) sound.

Most sounds are not in the Sounds folder of Star Trek\Assets\Sounds, but rather they are in the Sounds folder in CustomAssets\Sounds.
 
yes is in every star trek mod {xml}"AS2D error""AS2d ON""AS2d OFF"
no in costum asset do
i have nothing in costum asset
that the problem i got it now
thanks
 
So, to be perfectly clear... when you go into Assets\XML\Audio2DScripts.xml, the second and third entries are this?

Code:
	<Script2DSound>
		<ScriptID>AS2D_CLOAK_ON</ScriptID>
		<SoundID>SND_CLOAK_ON</SoundID>
		<SoundType>GAME_MUSIC</SoundType>
		<iMinVolume>80</iMinVolume>
		<iMaxVolume>80</iMaxVolume>
		<iPitchChangeDown>0</iPitchChangeDown>
		<iPitchChangeUp>0</iPitchChangeUp>
		<iMinLeftPan>-1</iMinLeftPan>
		<iMaxLeftPan>-1</iMaxLeftPan>
		<iMinRightPan>-1</iMinRightPan>
		<iMaxRightPan>-1</iMaxRightPan>
		<bLooping>0</bLooping>
		<iMinTimeDelay>0</iMinTimeDelay>
		<iMaxTimeDelay>0</iMaxTimeDelay>
		<bTaperForSoundtracks>0</bTaperForSoundtracks>
		<iLengthOfSound>0</iLengthOfSound>
		<fMinDryLevel>1.0</fMinDryLevel>
		<fMaxDryLevel>1.0</fMaxDryLevel>
		<fMinWetLevel>0.0</fMinWetLevel>
		<fMaxWetLevel>0.0</fMaxWetLevel>
		<iNotPlayPercent>0</iNotPlayPercent>
	</Script2DSound>
	<Script2DSound>
		<ScriptID>AS2D_CLOAK_OFF</ScriptID>
		<SoundID>SND_CLOAK_OFF</SoundID>
		<SoundType>GAME_MUSIC</SoundType>
		<iMinVolume>80</iMinVolume>
		<iMaxVolume>80</iMaxVolume>
		<iPitchChangeDown>0</iPitchChangeDown>
		<iPitchChangeUp>0</iPitchChangeUp>
		<iMinLeftPan>-1</iMinLeftPan>
		<iMaxLeftPan>-1</iMaxLeftPan>
		<iMinRightPan>-1</iMinRightPan>
		<iMaxRightPan>-1</iMaxRightPan>
		<bLooping>0</bLooping>
		<iMinTimeDelay>0</iMinTimeDelay>
		<iMaxTimeDelay>0</iMaxTimeDelay>
		<bTaperForSoundtracks>0</bTaperForSoundtracks>
		<iLengthOfSound>0</iLengthOfSound>
		<fMinDryLevel>1.0</fMinDryLevel>
		<fMaxDryLevel>1.0</fMaxDryLevel>
		<fMinWetLevel>0.0</fMinWetLevel>
		<fMaxWetLevel>0.0</fMaxWetLevel>
		<iNotPlayPercent>0</iNotPlayPercent>
	</Script2DSound>

And when you go into AudioDefines.xml, located in the same folder, the second and third entries are this?

Code:
		<SoundData>
			<SoundID>SND_CLOAK_ON</SoundID>
			<Filename>Sounds/CloakOn</Filename>
			<LoadType>DYNAMIC_RES</LoadType>
			<bIsCompressed>1</bIsCompressed>
			<bInGeneric>1</bInGeneric>
		</SoundData>
		<SoundData>
			<SoundID>SND_CLOAK_OFF</SoundID>
			<Filename>Sounds/CloakOff</Filename>
			<LoadType>DYNAMIC_RES</LoadType>
			<bIsCompressed>1</bIsCompressed>
			<bInGeneric>1</bInGeneric>
		</SoundData>

However, in your My Games\Beyond the Sword\CustomAssets\Sounds folder, you do not have a CloakOn.wav and a CloakOff.wav file?

Did you install the mod correctly? Step 3, from the readme, is: "Copy the "Art" and "Sounds" folders to My Games\Beyond the Sword\customAssets." Inside the Sounds folder there should be CloakOn.wav, CloakOff.wav, TechDing.mp3, along with several folders...
 
I've merged this into 3.0 (with the exception of the AI stuff) with my modifications (the buttons are available to any unit when the cloaking device tech is researched) and it works fine (with the exception of an attribute clone on my end, which doesn't concern any of your code), but I want to change it to give a different promotion (without the attack penalty) for a couple of specific units (the klingon and romulan UUs). Do you have any idea of how I could do this? I'm not familiar enough with actions buttons to make the change.

PS: How are the intended changes to the worldbuilder modmod going?
 
I've merged this into 3.0 (with the exception of the AI stuff) with my modifications (the buttons are available to any unit when the cloaking device tech is researched) and it works fine (with the exception of an attribute clone on my end, which doesn't concern any of your code), but I want to change it to give a different promotion (without the attack penalty) for a couple of specific units (the klingon and romulan UUs). Do you have any idea of how I could do this? I'm not familiar enough with actions buttons to make the change.

PS: How are the intended changes to the worldbuilder modmod going?

The promotions are applied in handleInput, located in CvMainInterface.py. After my changes to it below, there's some Final Frontier specific code for the city screen

Code:
	# Will handle the input for this screen...
	def handleInput (self, inputClass):
		
		# PROTO
		
		print("\n\n\ngetNotifyCode: %s" %(inputClass.getNotifyCode()))
		print("getData: %s" %(inputClass.getData()))
		print("getFlags: %s" %(inputClass.getFlags()))
		print("getID: %s" %(inputClass.getID()))
		print("getFunctionName: %s" %(inputClass.getFunctionName()))
		print("getButtonType: %s" %(inputClass.getButtonType()))
		print("getData1: %s" %(inputClass.getData1()))
		print("getData2: %s" %(inputClass.getData2()))
		print("getOption: %s" %(inputClass.getOption()))
		print("isShiftKeyDown: %s" %(inputClass.isShiftKeyDown()))
		print("isCtrlKeyDown: %s" %(inputClass.isCtrlKeyDown()))
	
#Added in Cloaking Devices -- TC01
		if (inputClass.getNotifyCode() == 11 and inputClass.getData1() == 660 and inputClass.getData2() == 660):
			self.iPushedButtonUnit = g_pSelectedUnit
			self.iPushedButtonUnit.setHasPromotion(gc.getInfoTypeForString('PROMOTION_CLOAK'), true)
			g_pSelectedUnit.changeMoves(60)
			CyAudioGame().Play2DSound('AS2D_CLOAK_ON')

		if (inputClass.getNotifyCode() == 11 and inputClass.getData1() == 661 and inputClass.getData2() == 661):
			self.iPushedButtonUnit = g_pSelectedUnit
			self.iPushedButtonUnit.setHasPromotion(gc.getInfoTypeForString('PROMOTION_CLOAK'), false)
			g_pSelectedUnit.changeMoves(60)
			CyAudioGame().Play2DSound('AS2D_CLOAK_OFF')
#End of Cloaking Device code -- TC01

You could add an if statement to get the unit's civilization, and add a different promotion depending on which civilization it was, like this bit of code for the decloak button:

Code:
if self.iPushedButtonUnit.getOwner() == gc.getInfoTypeForString('CIVILIZATION_ROMULAN') or self.iPushedButtonUnit.getOwner() == gc.getInfoTypeForString('CIVILIZATION_KLINGON')):
	self.iPushedButtonUnit.setHasPromotion(gc.getInfoTypeForString('PROMOTION_CLOAK_2'), false)
else:
	self.iPushedButtonUnit.setHasPromotion(gc.getInfoTypeForString('PROMOTION_CLOAK'), false)

I haven't had much free time to mod, and so haven't made much progress with the worldbuilder. But this week I should have some more time, and that's one of several projects I intend to work on.
 
Managed to get it with a couple if statements. Thanks! Look forward to seeing the worldbuilder changes (I finally have enough time to work on the mod properly again, so I'm getting "the fundamentals" in before working on the new civs, wonders, and traits).

This new way of working with cloaking should hopefully change the dynamic with regards to the Klingon and Romulan UUs and make them more interesting.
 
I reckon so - not too mention it's both much more Trek-like and more fun to be able to turn Cloak on/off! :thumbsup:
 
Since you're no longer using the promotion, how have you restricted cloaking to specific units? By specifying units that you want to be able to cloak in CvMainInterface.py (where I had the promotion check?)

If you haven't done so already, it might be nice to add a bCloak tag (or something like that) to CIV4UnitInfos.xml, and then have bCloak do nothing but be used here, so you could say "if pUnit.isCloak()" instead of individually checking units. That would help make things more modder-friendly- all they have to do is set bCloak to 1 in CIV4UnitInfos to make a unit able to cloak.

Also, I just released v1.0 of the Worldbuilder utility. I don't think there's anything else I need to do for that, except possibly fix some bugs...
 
I'm adding a bNoCloaking tag and will restrict some units (including possibly the Borg as it would be an interesting trade-off, no cloaking but powerful ships and an assimilation ability, but it's subject to forum review) but I'm having SDK issues again...:wallbash: When will I be able to add something to the SDK on my own without issues?
 
I installed cloaking devices version 1.2 and I can conquer star systems while cloaked or uncloaked. However, if my unit decloaks, he cannot conquer cities or be seen by barbarians anymore, from that point forward. ???
 
No. I conducted a few tests via the World builder. When my ship was newly created with the cloaking device promotion, I could then attack normally, or cloak, and still attack normally. But after that, if I decloak or cloak again at all for the rest of the game, I cannot conquer star systems. It is as though I am not actually decloaking.
 
Have you tested the combat change? I think the way you have it will work fine, but I'm not an expert on how combat works (iCombatPercent is the only modifier that applies directly to the unit at all times - with everything else applying to the defender, I think the only interference will be from combat promotions, as the percents may add instead of multiply). For 3.0 I plan to clone bOnlyDefensive to the promotions.

I thought it would work too. But after a few tests it seems like it might not be working... the promotion is definitely giving minus 100% strength, but it doesn't seem to be stopping me from attacking and destroying a 1 strength shuttle with my 5-strength cloaked Prometheus (this was done in Millennium since my Star Trek mod has Wormholes installed and I haven't made the two modcomps compatible) with 99.99% odds. Which shouldn't be happening. But, same cloaked Prometheus (well, a different one, but I did the same thing) has 0.19% odds against a fellow Prometheus that I gave to the barbarians.


Not sure what is happening.

When the iCombat is a negative number, it works by the following equation, where to find the modified strenghth you: -100% = x/2, where x is the initial strenghth vaule. Consequently, -200% = x/4 and so forth. As you can see, no matter what you set this iCombat to, a unit will still be able to attack (in terms of being allowed, as their strenghth value will never be zero using this method. If you want a 'practical' zero a -10000% iCombat basically makes any unit useless in combat (Such a large number is need, due to the fact that a borg tataical cube 2, for instance, start with such a high strength value, that even with a -1000% iCombat modifier, it still will have a combat strenghth of 2.5.

In addition to this I have been observing the AI behavior with the 1.2 mod, and it does seem to be working (to some degree). I think the question we need to ask is, 'How best to set up cloaking, so that the AI can successfully use it, and to use it as an advantage, not a hinderance. Because I am no expert of how (or if even possible) to code the AI to use cloaking in even an elementary way (when compared to a cagey human) I think perhaps the following set up could be used.

1. Cloaking device should be given to units as a starting promotion only, according to cannon (And perhaps the cloaking tech could be used for the drill1, drill2 avalibility, and a new building that gives these{I have done this in may current game and seems to be working well, however, I was able to add only one promotion for this building "Espionage Centre-+2 espionage, +1 great spy points, 10% thwart spies, drill1 promotion for ships built, cost 120, availible with cloaking", does anyone know how to add two promotions with a building?}.

2. Allow all cloaked ships to fire while cloaked with a -25% to -75% (not sure needs to be balanced and tested) iCombat modifier. Yes I know this is not cannon, but I cannot see the poor AI being able to use it effectively otherwise. So, with the decloak in solar system setting, the AI get a ships that it can really use, full strenghth on the defence (in system) and a ship that can pick of weak or undefended units while skulking around. (Just as a side note, how can we get a cloked ship to be able to enter neutral territory without a DOW?)

3. As, TC01 suggested, moving the cloaking device to future tech worked well with the above mods.

Anyway, these are just my ideas, and in the games I played they seem to be working fairly well, thoughts?
 
No. I conducted a few tests via the World builder. When my ship was newly created with the cloaking device promotion, I could then attack normally, or cloak, and still attack normally. But after that, if I decloak or cloak again at all for the rest of the game, I cannot conquer star systems. It is as though I am not actually decloaking.


I tested this as well in Star Trek 3.00 ("Star Trek" Mod). Decloaking doesn't work properly. After decloaking ships cannot conquer or defend star systems.
 
It seems my problem still exists; each time I research cloaking devices, I gain the ability to cloak every unit unless the 'bcannotcloak' is flagged. I tried a 'clean install' of 3.0 and then patched up to 3.23, but the issue still exists. I don't have all my game discs available at the moment, but I was going to try a complete reinstall of Civ 4. I have tried modding the cloaking promotion in the units folder, but none of the changes show up in game. Any tips, or should I just try and clean install?
 
It seems my problem still exists; each time I research cloaking devices, I gain the ability to cloak every unit unless the 'bcannotcloak' is flagged. I tried a 'clean install' of 3.0 and then patched up to 3.23, but the issue still exists. I don't have all my game discs available at the moment, but I was going to try a complete reinstall of Civ 4. I have tried modding the cloaking promotion in the units folder, but none of the changes show up in game. Any tips, or should I just try and clean install?

The way the game is set up in 3.0, all units are able to cloak unless bCannotCloak is flagged. That is deanej's intention.

My intention, when I wrote this mod, was to only allow cloaking if the unit had a Cloaking Device promotion. That is not the way it is set up in Star Trek 3.0. Maybe I could release another version of this mod that would set it up that way.

So you're not actually having a "problem".

(The problem we were having was that despite "Decloaking", invisibility was not actually being removed from a unit).
 
I understand now. I modified the python file to look for the promotion and added cost requirement to the XML. I wanted it to be more exclusive but I can see the desire to have it for everyone to use.

Actually my knowledege of Python is very limited, so I would GREATLY appreciate it if you could release a version that has the cloaking attached to the promotion and not the tech... thanks!
 
Back
Top Bottom