Ask for help about creating mods and scripts for Grimrock 2 or share your tips, scripts, tools and assets with other modders here. Warning: forum contains spoilers!
I am looking for a way to add a turokesque hudPrint("Get to the surface!") for the extended waterbreathing condition.
How can I add this on a specific tick/time before the end of the duration, say at 190 seconds.
Pompidom wrote: ↑Mon Sep 16, 2019 5:25 pm
Weapons and objects don't have unique names in my mod, they're simply bought from shops.
You can for instance blow all your money on 8 lightning staffs with 4 dual staff wielding mages. (Just an example)
So it has to be implemented directly in the define object code of the staff if that's possible
The id ~staff~, was simply an example name. In the charging function you would examine the object to determine whether to set charges.
There are many ways to determine if it should be charged; the fact that it HAS any charge is one of them. You could inspect the UIname, or the GameEffect strings (for identifying information—that you have put there). You could name the item component, and check for that. You could define a custom trait, and check for it.
Lorial wrote: ↑Mon Sep 16, 2019 6:22 pm
I am looking for a way to add a turokesque hudPrint("Get to the surface!") for the extended waterbreathing condition.
How can I add this on a specific tick/time before the end of the duration, say at 190 seconds.
-- inside onTick
if self:getDuration() >189 then
hudPrint("Get to the surface!")
end
Great, thanks for the quick response.
Now since the party might not be under water anymore, is there a way to check whether the party is submerged at that exact moment and show the message only then?
Isaac wrote: ↑Mon Sep 16, 2019 7:04 pm
Essentially no. The easiest way is a hack.
You check for the water automap tile, but you also need to check the party elevation, because they could be on a bridge.
Well..., not gonna bother with that. Guess I'll rather use my grammar hack then and rephrase it to "The water breathing spell is starting to fade." or some such.
Isaac wrote: ↑Mon Sep 16, 2019 9:22 pm
Notice that the script was updated.
Due to the hud spam I came to that same conclusion right away, but the == did not get recognized, for whatever reason - works that way for all my equip/unEquips. Now that I think of it, I had trouble with time and timers in general trying to get an event to start exactly at a given moment.
Instead I fiddled around a bit and ended up with this makeshift version which blocks 3 of the 4 visible lines with empty lines.
It also seems like the duration is counting down, not up. The code below gives a warning message 10 seconds before the spell runs out.
onTick = function(self, champion)
if self:getDuration() >= 9.9 and self:getDuration() < 10 then
hudPrint("")
hudPrint("")
hudPrint("Get to the surface!")
hudPrint("")
end
end,
Isaac wrote: ↑Mon Sep 16, 2019 9:22 pm
Notice that the script was updated.
Due to the hud spam I came to that same conclusion right away
That's what the update fixed. There is no longer hud-spam; it flashes once, at 190 seconds.
It also seems like the duration is counting down, not up.
It is counting down.
*Note, though it's very unlikely, it is possible that a different hudPrint() could get cleared by your expiring condition, before the player has a chance to read the message.
How do I add exp to the party in coding I cant remember how to do it ty. oh and with huprint eg: Party gains 100 exp etc... and plus a sound fx added into the code ty again mb
function champXP()
for i=1,4 do
local ch = party.party:getChampion(i)
if ch:isAlive() then
ch:gainExp(50)
hudPrint(" "..ch:getName().." gained 50 XP.")
end
end
playSound("level_up")
end
THOM formaly known as tschrage _______________________________________________ My MOD (LoG1):Castle RingfortThread My MOD (LoG2):Journey To JusticeThread | Download