Page 327 of 396
Re: Ask a simple question, get a simple answer
Posted: Mon Sep 16, 2019 6:22 pm
by Lorial
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.
Code: Select all
defineCondition{
onStart = function(self, champion)
self:setDuration(200)
end,
onRecomputeStats = function(self, champion)
champion:setCondition("water_breathing")
end,
onTick = function(self, champion)
if not champion:isAlive() then
champion:removeCondition("water_breathing")
end
end,
onStop = function(self, champion)
champion:removeCondition("water_breathing")
end,
}
Re: Ask a simple question, get a simple answer
Posted: Mon Sep 16, 2019 6:31 pm
by Isaac
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.
Code: Select all
-- inside onTick
if math.floor(self:getDuration()) == 190 then
hudPrint("Get to the surface!")
end
Re: Ask a simple question, get a simple answer
Posted: Mon Sep 16, 2019 7:01 pm
by Lorial
Isaac wrote: ↑Mon Sep 16, 2019 6:31 pm
Code: Select all
-- 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?
Re: Ask a simple question, get a simple answer
Posted: Mon Sep 16, 2019 7:04 pm
by Isaac
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.
Re: Ask a simple question, get a simple answer
Posted: Mon Sep 16, 2019 7:16 pm
by Lorial
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.
Re: Ask a simple question, get a simple answer
Posted: Mon Sep 16, 2019 9:22 pm
by Isaac
Notice that the script was updated.
Re: Ask a simple question, get a simple answer
Posted: Tue Sep 17, 2019 6:07 am
by Lorial
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.
Code: Select all
onTick = function(self, champion)
if self:getDuration() >= 9.9 and self:getDuration() < 10 then
hudPrint("")
hudPrint("")
hudPrint("Get to the surface!")
hudPrint("")
end
end,
Re: Ask a simple question, get a simple answer
Posted: Tue Sep 17, 2019 7:50 am
by Isaac
Lorial wrote: ↑Tue Sep 17, 2019 6:07 am
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.
Re: Ask a simple question, get a simple answer
Posted: Sat Sep 21, 2019 5:49 am
by Eleven Warrior
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
Re: Ask a simple question, get a simple answer
Posted: Sat Sep 21, 2019 9:18 am
by THOM
Code: Select all
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