Page 1 of 2

Cursed Questions

Posted: Wed Jun 03, 2015 2:50 am
by L0771
- Questions -

Please, consider before posting:
  • Explain what you want to do
  • Explain your question
  • Add images
  • Add a save/map
  • Respect the rules

Re: Cursed Questions

Posted: Wed Jun 10, 2015 12:03 pm
by Dariel92
RU:Привет) Я хотел спросить - в твоем моде если подключен мод кислород есть пунктик где прописывается сколько урона будет наносить отравленный воздух в зависимости от загрязнения. Не мог бы ты сказать что нужно прописать? А то я до сих пор путаюсь в lua, а так хочется добавить эту функцию к своему варианту мода кислород.
EN:hi) I wanted to ask - in your fashion if the connected mod oxygen have a thing where prescribed how much damage will inflict a poison depending on air pollution. Could you tell what to prescribe? But I still confused in lua, and so want to add this function to his own version of the mod oxygen.

Re: Cursed Questions

Posted: Wed Jun 10, 2015 7:01 pm
by L0771
Dariel92 wrote:hi) I wanted to ask - in your fashion if the connected mod oxygen have a thing where prescribed how much damage will inflict a poison depending on air pollution. Could you tell what to prescribe? But I still confused in lua, and so want to add this function to his own version of the mod oxygen.
Ok, i take note for add this in the tutorial.
If you have oxygen mod installed, my mod detects automatically and does nothing, the damage from oxygen mod is 5/sec or something like that, the oxygen will show in the [Oxygen] menu of cursed gui, but don't do damage.
If you don't have oxygen mod, you can active or desactive the damage (from options), this damage is by pollution, starting from 2000 adding 3 dmg/sec every 2000 of pollution (if you have 10k of pollution, will get 15 of damage / sec and will die in 7 sec), this damage can be reduced with "hp regen" talent tier 5.

And that function are on Cursed-Exp > Scripts > functions_pollution.lua > line 17
If you have questions about the code i don't have problem to reply, but don't waste your time trying to find something, isn't a good code, i just do what i think in the moment...

Re: Cursed Questions

Posted: Fri Jun 12, 2015 12:49 am
by varn
Does the Fisher/Miner/Turret/Wall upgrade benefit their counterpart in any way other than giving a new slot for each one? Say I don't want more fishers than 6, but I'd like them to get stronger, would I get anything from using more talents on Fisher upgrade?

Re: Cursed Questions

Posted: Fri Jun 12, 2015 1:04 am
by L0771
varn wrote:Does the Fisher/Miner/Turret/Wall upgrade benefit their counterpart in any way other than giving a new slot for each one? Say I don't want more fishers than 6, but I'd like them to get stronger, would I get anything from using more talents on Fisher upgrade?
For this, i think is easier if you see this formula
fisher.exp = fisher.exp + 0.1 * (1 + [upgrade fishers] * 0.025 + [explore level] * 0.05 )

Every "upgrade x" gives 2.5% more of exp for that build and some stats gives more exp for some builds, this are uploaded at Tutorial
Mining: Every level gives 5% of experience to Cursed drills
Explore: Every level gives 5% of experience to Cursed fishers
Defense: Every level gives 10% of experience to Cursed walls
Bow: Every level gives 5% of experience to Cursed turrets

Re: Cursed Questions

Posted: Fri Jun 12, 2015 2:08 am
by varn
L0771 wrote:
varn wrote:Does the Fisher/Miner/Turret/Wall upgrade benefit their counterpart in any way other than giving a new slot for each one? Say I don't want more fishers than 6, but I'd like them to get stronger, would I get anything from using more talents on Fisher upgrade?
For this, i think is easier if you see this formula
fisher.exp = fisher.exp + 0.1 * (1 + [upgrade fishers] * 0.025 + [explore level] * 0.05 )

Every "upgrade x" gives 2.5% more of exp for that build and some stats gives more exp for some builds, this are uploaded at Tutorial
Mining: Every level gives 5% of experience to Cursed drills
Explore: Every level gives 5% of experience to Cursed fishers
Defense: Every level gives 10% of experience to Cursed walls
Bow: Every level gives 5% of experience to Cursed turrets
Thanks. I saw that in the tutorial, I just wasn't sure if the talent did anything more or only that. So it gives no more blood/faster production, only more xp.
One more question about buildings. Will we ever be able to move leveled buildings or they are meant to lose all xp when moved. It's really annoying that I have to start a fisher or a mine over when I move it because of it being in the way or running out of resourse.

Re: Cursed Questions

Posted: Fri Jun 12, 2015 2:33 am
by L0771
varn wrote:Thanks. I saw that in the tutorial, I just wasn't sure if the talent did anything more or only that. So it gives no more blood/faster production, only more xp.
One more question about buildings. Will we ever be able to move leveled buildings or they are meant to lose all xp when moved. It's really annoying that I have to start a fisher or a mine over when I move it because of it being in the way or running out of resourse.
I prefer give more production, but i can't do it.

You can rebuild a cursed drill, when you "mine" a cursed drill, go to builds and select option "rebuild" and all stats (-20% experience) are copied for the next mine you build, i'm thinking make a new function for all buildings, more for the walls, you need feed a wall from 0 again...
Sometimes i see too many code and i don't remember what does each line :lol: for this i don't do it now.

Re: Cursed Questions

Posted: Fri Jun 12, 2015 9:41 am
by varn
Does the vanilla turret damage/speed upgrade affect the cursed turret?

Re: Cursed Questions

Posted: Fri Jun 12, 2015 7:12 pm
by L0771
varn wrote:Does the vanilla turret damage/speed upgrade affect the cursed turret?
Nop, because is a type = "turret" (like a bitter's turret), player's turrets are gun-turret and laser-turrets, but cursed turrets can be modified by others mods.
Happen the same with arrows :)

Re: Cursed Questions

Posted: Mon Jun 15, 2015 2:52 am
by Tim2162286
I may just not know where to look, but how exactly does the cursed generator work? I have it connected to the power network, but it does not appear to be doing anything. Is there a particular item i need to put in the inventory slot, or am I doing something else wrong? Sorry, I cant figure out how to get a screenshot uploaded, I have only been playing a few weeks now, so don't know everything yet.

*Edit I found your post where you explained the generators function, it just runs off the extra bodies.

Re: Cursed Questions

Posted: Mon Jun 15, 2015 1:19 pm
by buc01
Could anyone explain to me what the class you select at the start of the game does exactly? i chose miner and i cant figure out if it has given me something special or a new ability or something :S

Re: Cursed Questions

Posted: Mon Jun 15, 2015 1:23 pm
by varn
buc01 wrote:Could anyone explain to me what the class you select at the start of the game does exactly? i chose miner and i cant figure out if it has given me something special or a new ability or something :S
It gives you x2 xp in the according skill, mining for you. I chose crafter, but explorer sounds great too, mining is not worth IMO, because once you get the cursed tool to high levels you can grind it faster than any other skill

Re: Cursed Questions

Posted: Mon Jun 15, 2015 4:27 pm
by Qcor
Tim2162286 wrote: *Edit I found your post where you explained the generators function, it just runs off the extra bodies.
That is correct however in this version of mod the generator is a bit weak. 1st body will generate about 25kW. It is not linear so each body added will generate a bit more but still IMO it's not worth it (at least in this version).
That said, he already stated that generator in new ver is buffed. For now it's roughly x 1.5 but who knows.. maybe it will be even more.

Re: Cursed Questions

Posted: Mon Jun 15, 2015 8:29 pm
by Tim2162286
Qcor wrote:
Tim2162286 wrote: *Edit I found your post where you explained the generators function, it just runs off the extra bodies.
That is correct however in this version of mod the generator is a bit weak. 1st body will generate about 25kW. It is not linear so each body added will generate a bit more but still IMO it's not worth it (at least in this version).
That said, he already stated that generator in new ver is buffed. For now it's roughly x 1.5 but who knows.. maybe it will be even more.
Not only is it weak until you compleatly fill it (very expensive), it does not seem to reliably work for me.

Re: Cursed Questions

Posted: Mon Jun 15, 2015 9:50 pm
by Qcor
now that you mentioned it I took a closer look and it appears that you're right.
It generates HALF of what it supposed to generate according to the formula. To be more precise it operates at full capacity but only half of the time... as in it goes for like 3sec then it's idle for next 3sec etc etc
Strange..

Re: Cursed Questions

Posted: Mon Jun 15, 2015 9:55 pm
by Tim2162286
I can get the generator to run continuously, but only at about 1/5 power if i connect it to my main power system, and only if i have more energy production than consumption.
I don't know why it does that, i have used other mods that also use the accumulator entity type as a generator and they work perfectly.

Re: Cursed Questions

Posted: Mon Jun 15, 2015 11:16 pm
by Qcor
yeah.. it's broken for sure.
I think I localized the cause.. trying to fix it now. If I succeed I'll post the code you need to replace.
Not sure how it will go... 0 experience in this strange lua stuff :(

Re: Cursed Questions

Posted: Tue Jun 16, 2015 12:50 am
by Tim2162286
thanks, i have some programing experience, so if you tell me where you think the problem is i can try and look at it as well.

Re: Cursed Questions

Posted: Tue Jun 16, 2015 1:11 am
by Tim2162286
Definitly found the issue, it is in lines 34-35, commenting them out gives constant output, but doesn't increase like it should when the generator levels, will works some more on it.

Code: Select all

local output_flow_limit = math.floor(0.1 * (i - 1)^2 + (i - 1) * 25 + 25)
	if  i == datos.maxgenerator then
		output_flow_limit = math.floor(0.25 * (i - 1)^2 + (i - 1) * 25 + 25)
	end
	--generator.energy_source.output_flow_limit = output_flow_limit .. "kW"
	--generator.energy_source.buffer_capacity = output_flow_limit * 60 * 5 .. "kW"
using this code causes the generator to output a constant 300 kw regardless of generator level (this is lines 30-35)

*Edit- after more testing, the issue appears to be that the generator only outputs at its maximum, but is limited to generating about 260 kW. the reason it doesn't work continuously is that it fills its buffer up, then compleatly discharges it at its output rate. not sure how to modify that maximum charge rate though.

Re: Cursed Questions

Posted: Tue Jun 16, 2015 2:17 am
by Qcor
well.. yes and no
Yes, this is a PART of a problem.. and NO, it's not the solution.

The problem is that generator has an internal buffer. Every 300 ticks it is filled. To be precise it's energy is being set to a specific number.
All would be cool but this number is too small to keep it running for whole 300 ticks.
If that was all then the fix would be rly easy.

For last 3 hours I was experimenting with this and it just blows my mind... Basically I changed it so that:
1) the buffer is of size X
2) each tick the buffer energy is set to X
3) buffer can be emptied at a max rate of X/tick

And that still causes some strange fluctuations.. WHY ?? because.. logic.. :( No idea how sth so straight forward could fail but well.. I started to learn about it 3h ago so maybe I'm just a noob.

Anyway.. I changed it again and it mostly works. It's power output is as should be and it's constant. Only downside is that one of power production meters shows good value and the other shows bad one.
Example: my generator is lvl 19 so it, in theory, generates max of 507KW. The power meter in top left shows 507.. and the second one shows 580 :shock:
top one is right, and the other shows more because I made the buffer twice the size and set the buffer energy to 2*X instead of X. It rly shouldn't matter because max output was and still is = 507.. so rly no idea.. some strange logic.

Just replace files attached and all should work properly...
ontick.lua
(30.09 KiB) Downloaded 483 times
cursed-generator.lua
(62.61 KiB) Downloaded 464 times

[edit]
It LOOKS like the top indicator shows how much energy was actually provided to the network while the second one shows how much was "added"/produced inside all generators... am I right ?
It just boggles my mind... some1 pls explain that to me:
So lets say I have a generator producing 50/tick with a buffer of 100 and max output of 50/tick. Each tick I set the power in the buffer to 100.
First indicator shows 50 which seems reasonable, and second shows sth like 55.
That would mean that I 'added'/produced 55, right? sooo.. it was 45, I set it to 100.. producing 55.
But how it could be 45 if I can output MAX 50?! That would mean that in last tick network took 55 from the buffer.. :shock:
[/edit]