Using the catalog

HL.Clockwork

New Member
Reaction score
5
Hi, i have seen some suggetions to use the catalog funktions to solve some issuses. example set or get unit values.

is there any nice tut about this?

i would like to know: how can i exatly set or get data values of units.
set weap dmg or get weap dmg? maybe an example codequote with some extended explanatory notes.

thanks ;)
 

HL.Clockwork

New Member
Reaction score
5
first, thank you ;)


this is what i try to get the path of the effect damage.

Trigger:
  • Variable - Set dmg 2 = (Count of values in Effects "MK_DMG" "CEffectDamage_Amount" for Player Any Player)


but it does not work ;(

MK_DMG is the id of my effect. using the number seems to be gone, the editor shows a list. and the last field should be right to refer to the amount.

Error.msg ingame: Trigger Error in `gt_funktionname_Func`: Catalog field "could not be read (Core: a required object could not be found)
 
Reaction score
54
Haven't tried this but in my experience, you do not write in what's behind the _, so in your case, it would be just Amount instead of CEffectDamage_Amount.
 

HL.Clockwork

New Member
Reaction score
5
Haven't tried this but in my experience, you do not write in what's behind the _, so in your case, it would be just Amount instead of CEffectDamage_Amount.

works, thanks ;)

but now i see the next problem, game crashes. Is the use of catalog funktion limited ?

Trigger:
  • testcrit
    • Events
      • TriggerAddEventUnitDamaged(null, c_unitDamageTypeAny, c_unitDamageEither, "MK_DMG")
    • Local Variables
      • attacker = null <unit>
      • dmg_int = 0 <int>
      • dmg_string = "" <string>
      • rnd = 0 <int>
      • crit_dmg = 0.0 <fixed>
    • Conditions
      • Comparison((UnitGetType((EventUnitDamageSourceUnit()))), ==, "Marine")
    • Actions
      • SetVariable(attacker, (EventUnitDamageSourceUnit()))
      • SetVariable(rnd, (RandomInt(0, 100)))
      • SetVariable(dmg_string, (CatalogFieldValueGet(c_gameCatalogEffect, "MK_DMG", "Amount", (UnitGetOwner(attacker)))))
      • SetVariable(dmg_int, (StringToInt(dmg_string)))
      • SetVariable(crit_dmg, (ArithmeticReal((IntToFixed(dmg_int)), *, 0.5)))
      • TriggerDebugOutput(1, (CombineText("Damage from Catalog: ", (IntToText(dmg_int)))), true)
      • IfThenElse()
        • if
          • Comparison(rnd, <=, 20)
        • then
          • CatalogFieldValueSet(c_gameCatalogEffect, "MK42Crit", "Amount", (UnitGetOwner(attacker)), (FixedToString(crit_dmg, 2)))
          • UnitCreateEffectUnit(attacker, "MK42Crit", (EventUnit()))
          • TriggerDebugOutput(1, (CombineText("Crit DMG:", (FixedToText(crit_dmg, c_fixedPrecisionAny)))), true)
        • else


game crashes after random amount of attack from the unit.
 

HL.Clockwork

New Member
Reaction score
5
oh sorry ;)

Trigger:
  • test crit
    • Events
      • Unit - Any Unit takes Fatal or Non-Fatal Any damage (from MK42 Machinegun effects)
    • Local Variables
      • attacker = No Unit <Unit>
      • dmg_int = 0 <Integer>
      • dmg_string = "" <String>
      • rnd = 0 <Integer>
      • crit_dmg = 0.0 <Real>
    • Conditions
      • (Unit type of (Damaging unit)) == Marine
    • Actions
      • Variable - Set attacker = (Damaging unit)
      • Variable - Set rnd = (Random integer between 0 and 100)
      • Variable - Set dmg_string = (Value of Effects "MK_DMG" "Amount" for player (Owner of attacker))
      • Variable - Set dmg_int = (Integer(dmg_string))
      • Variable - Set crit_dmg = ((Real(dmg_int)) * 0.5)
      • Debug - Display ("Damage from Catalog: " + (Text(dmg_int))) as debug output using Type 1, and Do display it in the game window
      • General - If (Conditions) then do (Actions) else do (Actions)
        • If
          • rnd <= 20
        • Then
          • Catalog - Set value of Effects "MK42Crit" "Amount" for player (Owner of attacker) to (String(crit_dmg) with 2 decimal places)
          • Environment - Create Elite Squad MK42 Machinegun (Crit) on (Triggering unit) from attacker
          • Debug - Display ("Crit DMG:" + (Text(crit_dmg) with Any Precision decimal places)) as debug output using Type 1, and Do display it in the game window
        • Else
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top