Jump to content
Stygs

Infantry Stealth Upgrade

Recommended Posts

My idea was simple: Have an upgrade that makes a squad stealthed. Sounds pretty straight forward.

 

So I added this simply code to the squad members (since the Shadow Teams InvisibilityUpdate is also defined in the soldiers not the squad object).

 

Except it doenst have any effect ingame - no tranparency, no sound or FX when attacking...

 

Any idea what I missed here? (base objects doent have anything stealth releated)

 

			<InvisibilityUpdate
				id="ModuleTag_Invisibility"
				UpdatePeriod="0.5s"
				OpacityMin="40%"
				OpacityMax="70%" >
				<InvisibilityNugget
					EnteringStealthFX="FX_NODInfantryStealthTransitionOn"
					LeavingStealthFX="FX_NODInfantryStealthTransitionOff"
					ForbiddenStatus="IS_FIRING_WEAPON IS_AIMING_WEAPON SPECIAL_ABILITY_PACKING_UNPACKING_OR_USING USING_ABILITY ENCLOSED" />
				<RequiresUpgrade>Upgrade_FORGOTTENCameoflage</RequiresUpgrade>
			</InvisibilityUpdate>
			<StealthUpgrade
				id="ModuleTag_InvisibilityTrigger">
				<TriggeredBy>Upgrade_FORGOTTENCameoflage</TriggeredBy>
			</StealthUpgrade>

Edited by Stygs

Share this post


Link to post
Draws:ScriptedModelDraw

AffectedByStealth="True"
InvertStealthOpacity="False"


Behaviors: 

<InvisibilityUpdate
				id="3BD7F2F5"
				Options="STARTS_ACTIVE"
				UpdatePeriod="1s"
				BroadcastRange="0"
				OpacityMin="40%"
				OpacityMax="100%">
				<InvisibilityNugget
					ForbiddenConditions="PREATTACK_A FIRING_A FIRING_OR_PREATTACK_A RELOADING_A PREATTACK_B FIRING_B FIRING_OR_PREATTACK_B RELOADING_B PREATTACK_C FIRING_C FIRING_OR_PREATTACK_C RELOADING_C USING_WEAPON_A USING_WEAPON_B USING_WEAPON_C"
					ForbiddenConditionExceptions=""
					ForbiddenWeaponSets=""
					ForbiddenStatus="IS_FIRING_WEAPON USING_ABILITY IS_AIMING_WEAPON SPECIAL_ABILITY_PACKING_UNPACKING_OR_USING"
					CamouflageLevel="0"
					InvisibilityType="STEALTH"
					Options=""
					EnteringStealthFX=""
					LeavingStealthFX=""
					HintDetectableStates="IS_ATTACKING"
					NoStealthForAttackWindow="0s" />
			</InvisibilityUpdate>

 

You have these also, right?

Share this post


Link to post

The draws aren't needed unless you add a stealth draw like the stealth tank's mesh.

 

Everything that has empty "' can be left out because they are not required, anything you leave out will also revert to default settings.

 

Basicly styggs coding should work...the only thing i can hint at is...you misspelled camouflage in your upgrades...i would check if that is a consistent misspelling or just in this module...either way i would double check the upgrades..also try with starts active instead of a upgrade system to see if that works!

 

You might also add a ReinvisibilityDelay="#s" to your object's parameters..not sure if that is required tho.

Edited by Ravendark

Share this post


Link to post

ReinvisibilityDelay is allready part of the base objects, the spelling is the same in all files and it works fnie when set to STARTS_ACTIVE.

 

Really running out of ideas here xD

Share this post


Link to post

I had similar issue with the nod stealth lab year and half ago~

 

I tried to make it stealth the entire map only upon being captured (with upgrade method) And it didn't worked unless I made it starts active from the very beginning (which ruin the point...)

 

It may be engine/code issue?

Edited by Egozi44

Share this post


Link to post

Thats the code from the Nod Shadow unit.

 

I'm not sure how that would work as an upgrade tho but...

 

In another post I talked about getting the Zone squad upgrades to work in the Space Cmd Uplink. What finally did it for me was using the gamedependency tag and setting it to the GDISpaceCommandUplink .... once that was pointing to the building it was researching from, that worked.

 

Have you or could you try that?

Share this post


Link to post

Just did a quick test of it and it works...used the commando as unit and tried the following:

 

<GrantUpgradeCreate
	id="ModuleTag_GrantUpgradeCreate" 
	UpgradeToGrant="Upgrade_GivestealthtoCommando"
/>
			<InvisibilityUpdate
				id="ModuleTag_Invisibility002"
				UpdatePeriod="0.5s">
				<InvisibilityNugget />
				<RequiresUpgrade>Upgrade_GivestealthtoCommando</RequiresUpgrade>
			</InvisibilityUpdate>
			<StealthUpgrade
				id="ModuleTag_InvisibilityTrigger002">
				<TriggeredBy>Upgrade_GivestealthtoCommando</TriggeredBy>
			</StealthUpgrade>

and the upgrade

 

 

 

<UpgradeTemplate
        id="Upgrade_GivestealthtoCommando"
        Type="OBJECT" >
</UpgradeTemplate>
 

No idea what the problem could be. i use the grant on create to save time making a upgrade+button but i would be suprised that makes the difference. If i have some more time tomorow i might try a player upgrade instead of a object one to see if that makes the difference.

 

I also gave the module ID's a unique name because i thought it was conflicting with the inherit ones from the base object..but in hindsight only vehicles inherit the stealthfield upgrade and not infantry so i doubt that is the problem aswell.

 

Either way stealthing infantry by upgrade works for me, only thing i can think of is something with the upgrade?

 

Edit: even copy pasted your stealthmodule coding into mine and it works.

Edited by Ravendark

Share this post


Link to post

Have you tried it with a player upgrade? Gave the same code with an diffrent trigger upgrade to a vehicle and it didnt have any effect either.

Other than not working with player upgrades, I cant think of any other reason D:

Share this post


Link to post

I think this is a bug of the internal upgrade stack refreshing process. You can try to grant the upgrade remove it again and grant again two times and see if it works then (if you purely work with beaviour modules). If your motivation is high you can do the lua way of solving this. Upgrade triggers status -> status triggers lua script event -> lua function triggers your stealth upgrade but in a certain way overcoming the upgrade stack bug:

 

			<StatusBitsUpgrade
				id="ModuleTag_StatusBitUpgrade01"
				StatusToSet="RIDER1">
				<TriggeredBy>Upgrade_PreStealthTrigger</TriggeredBy>
			</StatusBitsUpgrade>

scriptevents.xml

        <ObjectStatusEvent Name="StealthTrigger">
	       <Conditions>+RIDER1</Conditions>
	</ObjectStatusEvent>

	<EventList Name="StealthTriggerEvent" Inherit="BaseScriptFunctions">
		 <EventHandler EventName="StealthTrigger"	ScriptFunctionName="GiveStealthUpgrade" DebugSingleStep="false"/>
	</EventList>


scripts.lua


function GiveStealthUpgrade(self)
    ObjectGrantUpgrade(self, "Upgrade_RefreshDummy")    --refresh upgrade stack
    ObjectRemoveUpgrade(self, "Upgrade_RefreshDummy") 
    ObjectGrantUpgrade(self, "Upgrade_Stealth")         --your actual upgrade, finally
end

If you want another example see my source code for the toggleable autoshield ai mode here. Hope that helps.

Edited by Mjjstral

Share this post


Link to post

Not sure if its really related to refreshing as the Nod claoking field uses the same mechanic and is working fine.

 

From what I can tell, it only works with Object upgrades, as soon as I use an Player upgrade the whole thing stopps working.

Guess I need to trigger an object upgrade once the player one is researched.

Share this post


Link to post

Ye just noticed the same. Player upgrade isn't triggering it. Even when using the grant on create module it doesn't work with a player upgrade.

 

Idd cloaking field uses the object type.

 

You could also just let your infantry start with active invisibility.

Have them also start with a dummy object status that is a stealth prevention status,ForbiddenStatus="RIDER_1" ...or any status not really used ingame atm or so. You can either do this by lua with a on create or use the grantupgradecreate module for a dummy upgrade that enables that statusbitupgrade.

 

Then have your actual player upgrade remove the statusbit ...bit like the firehawk loadout switch does it. Without that dummy status the infantry will/should get stealthed.

 

This way the invisibility is intrinsic and not triggered by any sort of upgrades just by changing object status and/or modelconditions.

Edited by Ravendark

Share this post


Link to post

Thats... quite a nice idea and seems to work fine so far in my test.

 

Thanks! :)

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

×