Jump to content
Sign in to follow this  
Ravendark

Transfer Master Model/status states to Slaves

Recommended Posts

Is there a way to transfer the model condition state of a master to its slave or spawn. By existing module or script?

I want to be able to transfer DAMAGED, REALLY_DAMAGED, RUBBLE from a building that has a spawn module to its spawned.

 

OR would i need to lua the **** out of it and use something like?

<ModelConditionEvent Name="TransferDamagedState">
            <Conditions>+DAMAGED</Conditions>
</ModelConditionEvent>
<ModelConditionEvent Name="TransferReally_DamagedState">
            <Conditions>+REALLY_DAMAGED</Conditions>
</ModelConditionEvent>
<ModelConditionEvent Name="TransferRubbleState">
            <Conditions>+RUBBLE</Conditions>
</ModelConditionEvent>

<EventList Name="MasterTellSpawnFunctions" Inherit="BaseScriptFunctions">
        <EventHandler EventName="TransferDamagedState" ScriptFunctionName="TransferDamageStateFunction" DebugSingleStep="false"/>
        <EventHandler EventName="TransferReally_DamagedState" ScriptFunctionName="TransferDamageStateFunction" DebugSingleStep="false"/>
        <EventHandler EventName="TransferRubbleState" ScriptFunctionName="TransferDamageStateFunction" DebugSingleStep="false"/>
</EventList>
Function TransferDamageStateFunction( self )
    If ObjectTestModelCondition(Self, "DAMAGED") Then ObjectBroadcastEventToAllies( 111, "CopyDamaged", 5 )
       Elseif ObjectTestModelCondition(Self, "REALLY_DAMAGED") Then ObjectBroadcastEventToAllies( 222, "CopyReallyDamaged", 5 )
       Elseif ObjectTestModelCondition(Self, "RUBBLE") Then ObjectBroadcastEventToAllies( 333, "CopyRubble", 5 )
       Elseif ObjectTestModelCondition(Self, "RUBBLE")=/=1 and ObjectTestModelCondition(Self, "REALLY_DAMAGED")=/= 1 and ObjectTestModelCondition(Self, "DAMAGED")=/=1 Then ObjectBroadcastEventToAllies( 000, "CopyPrestine", 5 )
   End
End

for the slave/spawn:

<ScriptedEvent Name="CopyDamaged" /> 
<ScriptedEvent Name="CopyReallyDamaged" /> 
<ScriptedEvent Name="CopyRubble" /> 
<ScriptedEvent Name="CopyPrestine" />
<EventList Name="MyLittleSpawnyFunctions" Inherit="BaseScriptFunctions">
        <EventHandler EventName="CopyDamaged" ScriptFunctionName="SetDamagedStateFunction" DebugSingleStep="false"/>
        <EventHandler EventName="CopyReallyDamaged" ScriptFunctionName="SetDamagedStateFunction" DebugSingleStep="false"/>
        <EventHandler EventName="CopyRubble" ScriptFunctionName="SetDamagedStateFunction" DebugSingleStep="false"/>
        <EventHandler EventName="CopyPrestine" ScriptFunctionName="SetDamagedStateFunction" DebugSingleStep="false"/>
</EventList>

 

function SetDamagedStateFunction(self, data)
     if data == "111" then
        ExecuteAction("UNIT_SET_MODELCONDITION","DAMAGED",self)
        Elseif data == "222" then
        ExecuteAction("UNIT_SET_MODELCONDITION","REALLY_DAMAGED",self)
        Elseif data == "333" then
        ExecuteAction("UNIT_SET_MODELCONDITION","RUBBLE",self)
        Elseif data == "000" then
        ExecuteAction("UNIT_CLEAR_MODELCONDITION","DAMAGED","REALLY_DAMAGED","RUBBLE",self)
     end
end

 

Btw any improvement in my lua skillz, because this felt like a olympic summersault effort on my part, just hoping i nailed the landing :o

 

Share this post


Link to post

Does the 'AggregateHealth' attribute in the 'SpawnBehaviorModuleData' not work?

Share this post


Link to post

I am assuming it probably will, but i don't really want to share the dmg or health, just have the slaved object match the condition states of its master, if it uses the masters health i need to account for it being repairable/destructable. Instead of using the spawm module i could also use a none linked dummy object probably...but in either cases i need both objects to match damaged states. The slave object is basicly all visuals and geometry, where the master object controls spawn and live and die of the whole chain.

 

I am basicly rethinking my gate system, and instead of using weapons and replaceself modules i want a master gate, that does 2 things:

Spawn the center gate mechanism and spawn 2 component towers , one on each side. But if the master gate object takes damage, and dies, the whoel chain dies.

If for some reason the towers or gate mechanism die, i would need a way to rebuild them (nod turet hub coding or such with auto rebuild/repair). I just want the main gate object to be targetable/destructable while the center mechanism are untargetable/immortal inthill the master dies.

 

Make sense?

Edited by Ravendark

Share this post


Link to post

The master does not need to be destructible or repairable, neither does the slave.

Share this post


Link to post

The master does not need to be destructible or repairable, neither does the slave.

The master is basicly the control object. Altho the towers will be selectable so you can builds walls from them, their damaged looks should be visual only, i don't want them to be able to get destroyed because i dont want them needing some sort of repair/rebuild option. If the master dies everything dies with it and you rebuild the whole gate thing like new.

same for middle gate mechanism...it dies when the master dies, can't be attacked on it self, basicly the only thing that can be damaged is the master and if it is destroyed its spawns suicided with it. So i want the towers and mehcanism be pure visual on the damage states.

 

If i use the progogate coding it would/could kill the spawns?

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
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×