Indeed, I just saw that. Thanks for the answer
Is there a way to make feedback appear ingame ?
For floating text in script:Civ5 Method = Events.GameplayAlertMessage(sMessage)
There was also a more complicated method you could use to create floating text over a tile when X happened at that tile.
So far I have not found an equivalency for civ6.
Game.AddWorldViewText(0, "your text", x, y, 0)
UI.AddWorldViewText(0, "your text", x, y, 0)
function StatusMessage( str:string, fDisplayTime:number, type:number )
if (type == ReportingStatusTypes.DEFAULT or
type == ReportingStatusTypes.GOSSIP) then -- A type we handle?
local kTypeEntry :table = m_kMessages[type];
if (kTypeEntry == nil) then
-- New type
m_kMessages[type] = {
InstanceManager = nil,
MessageInstances= {}
};
kTypeEntry = m_kMessages[type];
-- Link to the instance manager and the stack the UI displays in
if (type == ReportingStatusTypes.GOSSIP) then
kTypeEntry.InstanceManager = m_gossipIM;
else
kTypeEntry.InstanceManager = m_statusIM;
end
end
local pInstance:table = kTypeEntry.InstanceManager:GetInstance();
table.insert( kTypeEntry.MessageInstances, pInstance );
local timeToDisplay:number = (fDisplayTime > 0) and fDisplayTime or DEFAULT_TIME_TO_DISPLAY;
pInstance.StatusLabel:SetText( str );
pInstance.Anim:SetEndPauseTime( timeToDisplay );
pInstance.Anim:RegisterEndCallback( function() OnEndAnim(kTypeEntry,pInstance) end );
pInstance.Anim:SetToBeginning();
pInstance.Anim:Play();
Controls.StackOfMessages:CalculateSize();
Controls.StackOfMessages:ReprocessAnchoring();
end
end
<?xml version="1.0" encoding="utf-8" ?>
<Context Name="AutoPlay_InGame" >
<Container Size="full,full">
<Stack ID="StackOfMessages" Anchor="C,T" StackGrowth="Bottom" Offset="0,120"/>
</Container>
<Instance Name="StatusMessageInstance">
<Container ID="Root" Anchor="C,T" Size="650,40" AutoSize="V">
<AlphaAnim ID="Anim" Anchor="C,T" AlphaBegin="0" AlphaEnd="1" Speed="3" Size="650,parent" Cycle="OneBounce" EndPause="10" AutoSize="V">
<Grid Anchor="C,T" Style="EnhancedToolTip" MinSize="54,54" Size="parent+10,parent-10" Color="255,255,255,255" AutoSize="V" InnerPadding="10,30">
<Label ID="StatusLabel" Anchor="C,C" Style="BodyText18" Offset="0,-2" WrapWidth="parent-20" />
</Grid>
</AlphaAnim>
</Container>
</Instance>
<Instance Name="GossipMessageInstance">
<Container ID="Root" Anchor="C,T" AutoSize="1" >
<AlphaAnim ID="Anim" Anchor="C,T" Size="650,82" AutoSize="V" AlphaBegin="0" AlphaEnd="1" Speed="3" Cycle="OneBounce" EndPause="10" >
<Image Anchor="C,T" Offset="2,0" Size="650,82" AutoSize="V" AutoSizePadding="0,-38" Texture="Parchment_Pattern" StretchMode="Tile" >
<Grid Offset="-25,-25" Size="parent,parent" AutoSize="1" AutoSizePadding="25,0" InnerPadding="10,0" Texture="Controls_GoldBox" SliceTextureSize="132,132" SliceCorner="66,66" MinSize="132,132" >
<Grid Anchor="C,T" Offset="0,28" Size="parent-9,parent" AutoSize="V" InnerPadding="0,0" Texture="Controls_GossipContainer" SliceTextureSize="70,70" SliceCorner="35,35" MinSize="70,70" Color="74,67,60,150" >
<Label ID="StatusLabel" Anchor="C,C" Style="BodyTextParchment18" WrapWidth="parent-20"/>
</Grid>
</Grid>
</Image>
</AlphaAnim>
</Container>
</Instance>
</Context>
For floating text in script:
or in UI:Code:Game.AddWorldViewText(0, "your text", x, y, 0)
Code:UI.AddWorldViewText(0, "your text", x, y, 0)
the first 0 can be replaced by an EventSubTypes (like EventSubTypes.DAMAGE), no idea for the second.
To replace GameplayAlertMessage I re-use code from the Firaxis automation scripts:
UI context lua
Code:function StatusMessage( str:string, fDisplayTime:number, type:number ) if (type == ReportingStatusTypes.DEFAULT or type == ReportingStatusTypes.GOSSIP) then -- A type we handle? local kTypeEntry :table = m_kMessages[type]; if (kTypeEntry == nil) then -- New type m_kMessages[type] = { InstanceManager = nil, MessageInstances= {} }; kTypeEntry = m_kMessages[type]; -- Link to the instance manager and the stack the UI displays in if (type == ReportingStatusTypes.GOSSIP) then kTypeEntry.InstanceManager = m_gossipIM; else kTypeEntry.InstanceManager = m_statusIM; end end local pInstance:table = kTypeEntry.InstanceManager:GetInstance(); table.insert( kTypeEntry.MessageInstances, pInstance ); local timeToDisplay:number = (fDisplayTime > 0) and fDisplayTime or DEFAULT_TIME_TO_DISPLAY; pInstance.StatusLabel:SetText( str ); pInstance.Anim:SetEndPauseTime( timeToDisplay ); pInstance.Anim:RegisterEndCallback( function() OnEndAnim(kTypeEntry,pInstance) end ); pInstance.Anim:SetToBeginning(); pInstance.Anim:Play(); Controls.StackOfMessages:CalculateSize(); Controls.StackOfMessages:ReprocessAnchoring(); end end
and the corresponding XML:
Code:<?xml version="1.0" encoding="utf-8" ?> <Context Name="AutoPlay_InGame" > <Container Size="full,full"> <Stack ID="StackOfMessages" Anchor="C,T" StackGrowth="Bottom" Offset="0,120"/> </Container> <Instance Name="StatusMessageInstance"> <Container ID="Root" Anchor="C,T" Size="650,40" AutoSize="V"> <AlphaAnim ID="Anim" Anchor="C,T" AlphaBegin="0" AlphaEnd="1" Speed="3" Size="650,parent" Cycle="OneBounce" EndPause="10" AutoSize="V"> <Grid Anchor="C,T" Style="EnhancedToolTip" MinSize="54,54" Size="parent+10,parent-10" Color="255,255,255,255" AutoSize="V" InnerPadding="10,30"> <Label ID="StatusLabel" Anchor="C,C" Style="BodyText18" Offset="0,-2" WrapWidth="parent-20" /> </Grid> </AlphaAnim> </Container> </Instance> <Instance Name="GossipMessageInstance"> <Container ID="Root" Anchor="C,T" AutoSize="1" > <AlphaAnim ID="Anim" Anchor="C,T" Size="650,82" AutoSize="V" AlphaBegin="0" AlphaEnd="1" Speed="3" Cycle="OneBounce" EndPause="10" > <Image Anchor="C,T" Offset="2,0" Size="650,82" AutoSize="V" AutoSizePadding="0,-38" Texture="Parchment_Pattern" StretchMode="Tile" > <Grid Offset="-25,-25" Size="parent,parent" AutoSize="1" AutoSizePadding="25,0" InnerPadding="10,0" Texture="Controls_GoldBox" SliceTextureSize="132,132" SliceCorner="66,66" MinSize="132,132" > <Grid Anchor="C,T" Offset="0,28" Size="parent-9,parent" AutoSize="V" InnerPadding="0,0" Texture="Controls_GossipContainer" SliceTextureSize="70,70" SliceCorner="35,35" MinSize="70,70" Color="74,67,60,150" > <Label ID="StatusLabel" Anchor="C,C" Style="BodyTextParchment18" WrapWidth="parent-20"/> </Grid> </Grid> </Image> </AlphaAnim> </Container> </Instance> </Context>
then for example : StatusMessage( "My message", 3, ReportingStatusTypes.DEFAULT )
function printBlah()
local localPlayer = Players[Game.GetLocalPlayer()];
local pUnits = localPlayer:GetUnits()
for k,v in pUnits:Members() do
local name = GameInfo.Unit.GetName(v)
print(name)
end
print("bloh blah")
end
Events.TurnEnd.Add(printBlah)
I think it might also fire when Barb Camp is cleared.have not so far seen the event fire for anything except a unit stepping on a Goody Hut
Oh, TurnBegin and TurnEnd are not so useless if you want to add some code that affects all players.Events.TurnBegin(iInteger)
Is seems that it's bugged with Districts. It fires only once for other build-types.the event fired twice in this instance with identical data