Jump to content

Recommended Posts

http://pastebin.com/CwVWX5Wc

 

Primarily the issue with this code is this:

 

Character stats: 

200 health

150 hunger

200 sanity

 

Perk 1: Increase hp to 300 (max HP and his current health(therefore he's getting healed)) and increase his speed to 1.25 while below 30 sanity.  This effect only lasts 15-20 seconds and can only happen in intervals of 5-10 minutes.

 

Perk 2: Randomly emote /cry below 100 sanity every 30-60 seconds.

 

Right now that code is basically saying:

 

"When below Willows threshold of sanity, whatever it is (I thought it was 0.5 (50%) but it's been going off at like 150 sanity), increase speed and hp"

"When above willows threshold of sanity, reset to normal stats".

 

There's no complexity, it's either on or off.  The speed boost lasts eternal while under willows sanity threshold and never stops unless his sanity is high again.  

I'd prefer to get rid of Willow's threshold completely and just set it to below 30 sanity.  Perk 1 is a pretty good buff, therefore it should only happen for a short time at long intervals while below 30 sanity.  Perk 2 is just an annoyance for being below 100 sanity since he keeps crying all the time.

 

The crying doesn't work either.  He only appears to /cry once when he's low on sanity. I have yet to notice a second time.

This is the second one but I feel that people who may help by looking at the other thread either:

1. Got intimidated by the thread size and just didn't bother

2. Just don't know the answer

3. Gave up helping for whatever reason

I'd like to believe 2 but since I still think this is a developing community, I've came to realize I either get a solution or don't at this point.

Have you tried using DoPeriodicTask(time, function()?

 

I am not completely sure on what can be done since I just started modding this game but you might be able to nest some periodic timers to trigger the desired results.

 

An example of a periodic timer:

-- When item is equipped the owner will gain 5 health every 10 secondslocal function onequip(inst, owner)   --inst.task = inst:DoPeriodicTask(# of seconds, function()   inst.task = inst:DoPeriodicTask(10, function()      owner.components.health:DoDelta(5) -- How much health the owner will gain   end)end

I haven't been home to test the code but I did look through it and it looks superb...

 

I can't really explain how much I appreciate the help, though.  I hate to sound like a pest on here but making Isaac for this game was an idea I just couldn't accept to not have polished the way I thought it of.

 

Without getting too dramatic, I thank you for your help.  The more time I spend staring at .lua, especially example code like yours (and others that have provided), the more likely I'm able to learn it as well.

It works!

 

Beastmode functions exactly like I expect it to.  I might actually increase the sanity at which it goes off since the intervals are so long.

 

Either way, I cannot thank you enough man.  I added your name to the changelog.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
  • Create New...