ToME: the Tales of Maj'Eyal

Everything about ToME
It is currently Tue Sep 26, 2017 7:13 am

All times are UTC




Post new topic Reply to topic  [ 4 posts ] 
Author Message
PostPosted: Tue May 29, 2012 2:37 pm 
Offline

Joined: Sat May 19, 2012 3:30 pm
Posts: 4
Hello everyone,

I wanted to make something like in TRPGs, you move and attack in a single turn, and then enemies move & attack.
So I modified GameEnergyBased.lua to make entities recover energy only every 10 game turns, each time recovering 1000 energy. And modified enoughEnergy() and useEnergy() to let actors acts before energy goes down to zero; also made move to cost 300 energy, and attack cost 600 energy.
It worked as expected, mostly. The problem is at player running: Say I have 100 energy left, I can run as normal; but if I have 400 or more energy, I will stop running after 1 step, and then get locked there, still "running", but can't continue moving. Why? :|

Any comment will be appreciated, and also thanks for your attention :wink:


Top
 Profile  
 
PostPosted: Tue May 29, 2012 10:27 pm 
Offline
Retired Ninja

Joined: Fri May 28, 2010 4:38 pm
Posts: 3756
If I understand correctly you're asking about 'running' and not moving in which case I ran into the same issue with Fae when I put together an action point system.

The issue was that the game would still be paused and that the runStep function assumes that the first step will consume enough energy to unpause the game for you. So the solution was to manually unpause the game when the player started running.

I put this in the player class.

Code:
-- Superload runStep to drop a game.paused = false in for Action Points to work
local previous_runStep = _M.runStep
function _M:runStep()
    game.paused = false
    return previous_runStep(self)
end


Sorry if it's messy, I'm on my Step Mother's laptop and don't have a text editor in front of me.

*edit* here's the commit and a link to the repo if you want to take a look at some other things I did to deal with an Action Point style system.
https://github.com/edge2054/Fae/commit/ ... 42e06e0a92

_________________
Jack's Cheese and Bread Snack


Top
 Profile  
 
PostPosted: Wed May 30, 2012 1:04 pm 
Offline

Joined: Sat May 19, 2012 3:30 pm
Posts: 4
edge2054 wrote:
The issue was that the game would still be paused and that the runStep function assumes that the first step will consume enough energy to unpause the game for you. So the solution was to manually unpause the game when the player started running.
/ab8df4a98abc2e88b9efc205a5297342e06e0a92


Thank you very much :D The auto-explore part are also very useful, it's so kind of you :)


Top
 Profile  
 
PostPosted: Wed May 30, 2012 3:40 pm 
Offline
Retired Ninja

Joined: Fri May 28, 2010 4:38 pm
Posts: 3756
Happy to help :)

_________________
Jack's Cheese and Bread Snack


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group