I may be wrong but when you set a timer with an interval, the timer starts at the interval set and will wait til the count down to trigger initially. If you want your hudprint to immediately trigger you must also include a 'run once' line along side the timer.Zo Kath Ra wrote: ↑Sat Jan 26, 2019 1:28 am Timer:
timerInterval = 5
triggerOnStart = true
currentLevelOnly = true
The timer is connected to a script that prints "test".
It should print "test" as soon as the game starts, but the first print happens after 5 seconds.
What am I doing wrong?
Ask a simple question, get a simple answer
-
- Posts: 73
- Joined: Sun Apr 12, 2015 2:57 pm
Re: Ask a simple question, get a simple answer
Re: Ask a simple question, get a simple answer
Call the command to start it. You can put it in the script to run at load. This works whether or not the timer is active [started].
Code: Select all
function test() print("test") end
timer_1.timer:start()
Re: Ask a simple question, get a simple answer
The dragon boss in the default campaign has text appearing in the middle of the screen.
How to make it happen?
How to make it happen?
Re: Ask a simple question, get a simple answer
You have to use the onDrawGui party hook for that.
PartyComponent.onDrawGui(self, context)
It must be defined it in the party object to become active—connectors by themselves don't work unless it's already defined.
Within the hook function you gain access to the graphics context object, and its many features; two of which are for drawing text.
https://github.com/JKos/log2doc/wiki/Ob ... icscontext
The concept here, is that within the onDrawGui hook function, you can issue drawing commands with the context object. This will draw on the current frame [only]. In practice, to actually see the drawing for more than a split second, you have to draw it for each frame. So arrange the drawing commands in the hook to render the text when it is called; as it is for each frame.
If you want to be able to start & stop the effect, then you need to enclose the drawing commands behind a condition; boolean true/false works well. That way it does not call the drawing commands when the condition is false.
You can set the font size via GraphicsContext.font("large")
—Known valid values for font are: "tiny", "small", "medium", "large"
Centering is not automatic, and will be different for different resolutions/and aspects. The context object does provide the screen dimensions with: context.width & context.height
PartyComponent.onDrawGui(self, context)
It must be defined it in the party object to become active—connectors by themselves don't work unless it's already defined.
Within the hook function you gain access to the graphics context object, and its many features; two of which are for drawing text.
https://github.com/JKos/log2doc/wiki/Ob ... icscontext
The concept here, is that within the onDrawGui hook function, you can issue drawing commands with the context object. This will draw on the current frame [only]. In practice, to actually see the drawing for more than a split second, you have to draw it for each frame. So arrange the drawing commands in the hook to render the text when it is called; as it is for each frame.
If you want to be able to start & stop the effect, then you need to enclose the drawing commands behind a condition; boolean true/false works well. That way it does not call the drawing commands when the condition is false.
You can set the font size via GraphicsContext.font("large")
—Known valid values for font are: "tiny", "small", "medium", "large"
Centering is not automatic, and will be different for different resolutions/and aspects. The context object does provide the screen dimensions with: context.width & context.height
Re: Ask a simple question, get a simple answer
Mkay, I suppose I can scratch this feature off my list
Re: Ask a simple question, get a simple answer
Well... You asked "how".
What [precisely] do you need?
What [precisely] do you need?
Re: Ask a simple question, get a simple answer
No it's fine, I was simply hoping it would be something easy like "hudprint"
I wanted to use it for level transitions. It's not important.
It's one of those things, too much work for what it is
I understand your explanation, but I have no idea how to do it. So it's something I simply place on the backburner until I figure out how to do it myself or let someone do it for me
I wanted to do something like you find in most rpg's when transitioning to a new map/zone
The name of the map like for example "Fire Tower A1"or something like that
or "sayings" like "Into the Fray" or "Knee-deep in the dead"
"A sinister Turn" when you enter a map where you will be betrayed by some npc.
I wanted to use it for level transitions. It's not important.
It's one of those things, too much work for what it is
I understand your explanation, but I have no idea how to do it. So it's something I simply place on the backburner until I figure out how to do it myself or let someone do it for me
I wanted to do something like you find in most rpg's when transitioning to a new map/zone
The name of the map like for example "Fire Tower A1"or something like that
or "sayings" like "Into the Fray" or "Knee-deep in the dead"
"A sinister Turn" when you enter a map where you will be betrayed by some npc.
Re: Ask a simple question, get a simple answer
Try this:
Or
Code: Select all
--Call this from a script, with the text you wish to be displayed. — script_entity_1.script.intro("Into the fray!")
function intro(text)
GameMode.fadeOut(0x00000, 0)
if type(text) == "string" then
party.party:rest(text)
end
end
Code: Select all
--Place invisible floor triggers; each one connected to their own function that passes a unique message when triggered.
function intro(text)
GameMode.fadeOut(0x00000, 0)
if type(text) == "string" then
party.party:rest(text)
end
end
function map1()
intro("Into the fray!")
end
function map2()
intro("The Black Crypt")
end
function map3()
intro("Swamp Tour")
end
Re: Ask a simple question, get a simple answer
Mh - this solution just works, if the party sleeps while the text pops up, right?
Can you change the size of the text?
Can you change the size of the text?
Re: Ask a simple question, get a simple answer
The one above? It forces a rest state with a caption; it fades when they move. It is possible (but complicates it) to have the function wake the party after a few seconds. I did have it that way for a while (using two different methods, a timer, and a delayedCall), but eventually removed the feature.