Page 5 of 6

Re: WSCT replacement

Posted: Sun Sep 27, 2020 12:37 pm
by xruptor
Phantasm wrote: Sun Sep 27, 2020 7:25 am Any chance to add combat flag to that addon, it would completely let me remove WSCT from addons.
It's not perfect but it still utilizes the built in Warhammer event handlers.

OPEN combattextnames.lua

Find the following:

Code: Select all

function CombatTextNames.Initialize()
    -- hooks
    EA_System_PointGainEntry.SetupText =
        CombatTextNames.HookPointGainTextScaler(
            EA_System_PointGainEntry.SetupText)

    if CombatTextNames.Settings.ResetPositionOnLOS then
        EA_System_EventTracker.Update = CombatTextNames.HookLOSPositioner(
                                            EA_System_EventTracker.Update)
    end

    -- REPLACEMENTS
    EA_System_EventText.AddCombatEventText = CombatTextNames.AddCombatEventText
    EA_System_EventEntry.SetupText = CombatTextNames.SetupText
    EA_System_EventTracker.InitializeAnimationData =
        CombatTextNames.InitializeAnimationData

    EA_System_EventEntry.m_Template = "CombatTextNames_Window_EventTextLabel"
    EA_System_PointGainEntry.m_Template =
        "CombatTextNames_Window_EventTextLabel"
end
Replace with this

Code: Select all

function CombatTextNames.Initialize()
    -- hooks
    EA_System_PointGainEntry.SetupText =
        CombatTextNames.HookPointGainTextScaler(
            EA_System_PointGainEntry.SetupText)

    if CombatTextNames.Settings.ResetPositionOnLOS then
        EA_System_EventTracker.Update = CombatTextNames.HookLOSPositioner(
                                            EA_System_EventTracker.Update)
    end

    -- REPLACEMENTS
    EA_System_EventText.AddCombatEventText = CombatTextNames.AddCombatEventText
    EA_System_EventEntry.SetupText = CombatTextNames.SetupText
    EA_System_EventTracker.InitializeAnimationData =
        CombatTextNames.InitializeAnimationData

    EA_System_EventEntry.m_Template = "CombatTextNames_Window_EventTextLabel"
    EA_System_PointGainEntry.m_Template =
        "CombatTextNames_Window_EventTextLabel"
		
	RegisterEventHandler(SystemData.Events.PLAYER_COMBAT_FLAG_UPDATED, "CombatTextNames.PLAYER_COMBAT_FLAG_UPDATED")
end

local combatcount = 0
function CombatTextNames.PLAYER_COMBAT_FLAG_UPDATED()
  combatcount = combatcount + 1
  if combatcount >= 2 then
    combatcount = 0
    if GameData.Player.inCombat then
	  CombatTextNames.AddCombatEventText(GameData.Player.worldObjNum, L"+Combat", GameData.CombatEvent.INCOMING_MISS, 0)
    else
	  CombatTextNames.AddCombatEventText(GameData.Player.worldObjNum, L"-Combat", GameData.CombatEvent.INCOMING_MISS, 0)
    end
  end
end

find the following

Code: Select all

function CombatTextNames.AddCombatEventText(hitTargetObjectNumber, hitAmount,
                                            textType, abilityID)
    -- skip incoming events if they're toggled off
    if (hitTargetObjectNumber == GameData.Player.worldObjNum) and
        ((hitAmount < 0 and not CombatTextNames.IncomingDamageEnabled) or
            (hitAmount > 0 and not CombatTextNames.IncomingHealsEnabled) or
            (hitAmount == 0 and not CombatTextNames.IncomingMissesEnabled)) then
        return
    end

    if hitAmount ~= 0 and
        (math.abs(hitAmount) < CombatTextNames.Settings.MinHitAmount) then
        return
    end

    local data = GetAbilityData(abilityID)

    -- The SetupText function is going to receive only eventData.amount member.
    -- So we replace eventData.amount with a table that contains all the data we
    -- need. That is, we add ability name there. Doing things the "proper" way
    -- would require replacing more EA code, I'd rather avoid this.
    local eventData = {
        event = COMBAT_EVENT,
        amount = {
            hit = hitAmount,
            name = data.name,
            abilityID = abilityID,
            iconNum = data.iconNum
        },
        type = textType
    }

    if (EA_System_EventText.EventTrackers[hitTargetObjectNumber] == nil) then
        local newTrackerAnchorWindowName =
            "EA_System_EventTextAnchor" .. hitTargetObjectNumber
        CreateWindowFromTemplate(newTrackerAnchorWindowName,
                                 "EA_Window_EventTextAnchor",
                                 "EA_Window_EventTextContainer")
        local tracker = EA_System_EventTracker:Create(
                            newTrackerAnchorWindowName, hitTargetObjectNumber)
        EA_System_EventText.EventTrackers[hitTargetObjectNumber] = tracker

        -- For CombatTextNames.HookLOSPositioner, mark tracker as attached:
        tracker.attachedToObject = true
        tracker.timer = 0
    end

    EA_System_EventText.EventTrackers[hitTargetObjectNumber]:AddEvent(eventData)
end

replace with this

Code: Select all

function CombatTextNames.AddCombatEventText(hitTargetObjectNumber, hitAmount,
                                            textType, abilityID)
											
	local eventData = {}
	
	if type(hitAmount) == "number" then									
		-- skip incoming events if they're toggled off
		if (hitTargetObjectNumber == GameData.Player.worldObjNum) and
			((hitAmount < 0 and not CombatTextNames.IncomingDamageEnabled) or
				(hitAmount > 0 and not CombatTextNames.IncomingHealsEnabled) or
				(hitAmount == 0 and not CombatTextNames.IncomingMissesEnabled)) then
			return
		end

		if hitAmount ~= 0 and
			(math.abs(hitAmount) < CombatTextNames.Settings.MinHitAmount) then
			return
		end
		
		local data = GetAbilityData(abilityID)

		-- The SetupText function is going to receive only eventData.amount member.
		-- So we replace eventData.amount with a table that contains all the data we
		-- need. That is, we add ability name there. Doing things the "proper" way
		-- would require replacing more EA code, I'd rather avoid this.
		eventData = {
			event = COMBAT_EVENT,
			amount = {
				hit = hitAmount,
				name = data.name,
				abilityID = abilityID,
				iconNum = data.iconNum
			},
			type = textType
		}
		
	else
	
		eventData = {
			event = COMBAT_EVENT,
			amount = {
				hit = 0,
				name = hitAmount,
				abilityID = 0,
				iconNum = 0
			},
			type = textType
		}
	
	end


    if (EA_System_EventText.EventTrackers[hitTargetObjectNumber] == nil) then
        local newTrackerAnchorWindowName =
            "EA_System_EventTextAnchor" .. hitTargetObjectNumber
        CreateWindowFromTemplate(newTrackerAnchorWindowName,
                                 "EA_Window_EventTextAnchor",
                                 "EA_Window_EventTextContainer")
        local tracker = EA_System_EventTracker:Create(
                            newTrackerAnchorWindowName, hitTargetObjectNumber)
        EA_System_EventText.EventTrackers[hitTargetObjectNumber] = tracker

        -- For CombatTextNames.HookLOSPositioner, mark tracker as attached:
        tracker.attachedToObject = true
        tracker.timer = 0
    end

    EA_System_EventText.EventTrackers[hitTargetObjectNumber]:AddEvent(eventData)
end
That should do it. The combat alert will have a zero in the front but who cares as long as you can see your state on/off. If for some reason it's not working, you may need to have EnableAbilityNames enabled. Since I'm sending the combat stance event as a ability name.

Re: WSCT replacement

Posted: Sun Sep 27, 2020 1:47 pm
by Phantasm
Thanks a lot for help. I did everything in post above and it works like a charm:)

Re: WSCT replacement

Posted: Mon Sep 28, 2020 1:30 am
by xruptor
Phantasm wrote: Sun Sep 27, 2020 1:47 pm Thanks a lot for help. I did everything in post above and it works like a charm:)
Not a problem. Glad to help and happy it worked for you.

Re: WSCT replacement

Posted: Tue Nov 23, 2021 1:33 am
by navis
Just found out about this addon, interesting but is a bit tricky to configure.
I just wanted to make incoming heals show with names (not truncated) just for my own character. Too bad there isn't a little manual on how to use this.

Re: WSCT replacement

Posted: Fri Dec 24, 2021 11:00 am
by manningus
I dont use wsct for a long time cause i changed default EA addon EASystem_EventText. It shows ability icons now and i increased font size a bit.
Link: https://drive.google.com/file/d/1I1Dt5V ... sp=sharing
[/quote]

This is perfect ! Got one question, how can i change size/font of numbers please ? Thank you

Re: WSCT replacement

Posted: Fri Dec 24, 2021 1:42 pm
by oaliaen

Re: WSCT replacement

Posted: Sun Dec 26, 2021 5:23 pm
by utaL
manningus wrote: Fri Dec 24, 2021 11:00 am I dont use wsct for a long time cause i changed default EA addon EASystem_EventText. It shows ability icons now and i increased font size a bit.
Link: https://drive.google.com/file/d/1I1Dt5V ... sp=sharing
Hey :)

Do you know how to change font and font color ?

Thanks !

Re: WSCT replacement

Posted: Sun Dec 26, 2021 9:18 pm
by manningus
i am very bad in forums so i quoted smth wrong, but yeah i found how to change it..

Normal hits you change in :
addons/..../source/Templates_EventText.xml ->
<Label name="EA_Window_EventTextLabel" font="font_clear_medium_bold" maxchars="32" textalign="center" layer="default"


crits u change in:
addons/..../source/System_EventText.lua
LabelSetFont( self.m_Label, "font_clear_large_bold", WindowUtils.FONT_DEFAULT_TEXT_LINESPACING ) -- added by Fox 14.06.2019 font_default_text_huge

the fonts u can find for example if u create some chat table with text u wantand exit the game, it will be sotred in :
user/martysquare/name/EA_chatwindow/.lua file

Re: WSCT replacement

Posted: Tue Jan 04, 2022 8:50 pm
by oaliaen
manningus wrote: Sun Dec 26, 2021 9:18 pm i am very bad in forums so i quoted smth wrong, but yeah i found how to change it..

Normal hits you change in :
addons/..../source/Templates_EventText.xml ->
<Label name="EA_Window_EventTextLabel" font="font_clear_medium_bold" maxchars="32" textalign="center" layer="default"


crits u change in:
addons/..../source/System_EventText.lua
LabelSetFont( self.m_Label, "font_clear_large_bold", WindowUtils.FONT_DEFAULT_TEXT_LINESPACING ) -- added by Fox 14.06.2019 font_default_text_huge

the fonts u can find for example if u create some chat table with text u wantand exit the game, it will be sotred in :
user/martysquare/name/EA_chatwindow/.lua file
How do i change the color of damage outgoing ?

Re: WSCT replacement

Posted: Sat Jan 15, 2022 10:31 pm
by SuperStar
I can't see the ability icons with repel's EAsystem_EventText. Any idea what's the problem and how can I fix. I downloaded it and put into the addon, it's loaded, no error.