Jump to content

[Request] Pain Randomizer! Quest system


Teila
 Share

Recommended Posts

I am currently building a framework for this based of the Curses model that is in the game currently.Things on the list:-Quest system--Timer&display--quest listings--Quest completion flag-Convert currently listed punish cards into 'curses'--have the ability to further punish--cool display window support---maybe even G15 display support.... Maybe...Let me know if you have any ideas or would like to help! Thanks all.

Link to comment
Share on other sites

Ok.. so slowly teaching myself Lua...

Tackling the Allergy idea currently and struggling a bit. Any help would be awesome!

Here is what I have so far:

AllergyCurse = Class(Curse,function(self)

Curse._ctor(self,

"Allergies",

"It seems your are now allergic to something..."

)

end)

function AllergyCurse:Run()

Curse.Run(self)

TUNING.AddIngredients(ingredients, {inedible=1}, Allergy)

end

ALLERGIES =

{

fruit,

veggie,

meat,

monster,

fish,

egg,

fat,

dairy

}

function RandomAllergy(inst)

--only pick allergies that are not currently running

local availableallergys = {}

for k,allergy in ipairs(ALLERGIES) do

if not allergy:IsRunning() then

table.insert(availableallergys,allergy)

end

end

if #availableallergys > 0 then

availableallergys[ math.random( #availableallergys ) ] = Allergy

end

end

ALLERGYCURSE = AllergyCurse()

Link to comment
Share on other sites

[MENTION=10276]Teila[/MENTION]

Others or the devs may be able to give more insight but as far as I understand so far....

When looking at a given game lua file, any variables or functions declared as "local" are only *visible* within that file (code chunk) and therfore *not* available for you to access from elsewhere. Many of the files (later ones?) seem to have taken on the "black box" idea of hiding its inner workings so in cases like this we don't seem to have any option other than overriding/overwriting the cooking.lua file.

Typically, if you look at the end of any given game lua file, you will see what has been globally defined. So for cooking.lua that would be the "CalculateRecipe" and "IsCookingIngredient" functions and the "recipes" table. Essentially, more public functions need to be added to this file to provide a more useful general API interface of sorts.

I dunno, these sort of issues brings to mind the possible need for a group of us modders to get together and create a temporary API by replacing various game lua files with ones that expose more functionality. Then players would need to install this "master api mod" in order for mods built off of it to work. That way more mods could work together versus fighting over control of the same files.

Specifically, in your case, you need AddIngredients() and ingredients to be global so you can use GLOBAL.AddIngredients(ingredients,....) or some sort of interface to accomplish the same thing.

Also, where is the Allergy variable (true/false value) coming from since it is not declared or set in the code above?

EDIT:

Oh and TUNING.xxxx only refers to the table of values defined in the tuning.lua file

And I think you are really aiming to create a new "allergy" component but not sure if subclassing off of the curses framework is even necessary other than using it as a guide on adding a new component in general. Unless I am misunderstanding your intention.

Edited by WrathOf
Link to comment
Share on other sites

[MENTION=10276]Teila[/MENTION]

...When looking at a given game lua file, any variables or functions declared as "local" are only *visible* within that file (code chunk) and therfore *not* available for you to access from elsewhere. Many of the files (later ones?) seem to have taken on the "black box" idea of hiding its inner workings so in cases like this we don't seem to have any option other than overriding/overwriting the cooking.lua file.

Indeed. I tried to trace back to the food tags that way I would not have to rebuild the food tables each time this curse would come into effect. As such this part of the code does not work and is only a concept.

Typically, if you look at the end of any given game lua file, you will see what has been globally defined. So for cooking.lua that would be the "CalculateRecipe" and "IsCookingIngredient" functions and the "recipes" table. Essentially, more public functions need to be added to this file to provide a more useful general API interface of sorts.

I dunno, these sort of issues brings to mind the possible need for a group of us modders to get together and create a temporary API by replacing various game lua files with ones that expose more functionality. Then players would need to install this "master api mod" in order for mods built off of it to work. That way more mods could work together versus fighting over control of the same files.

After looking at the structure that the coders used for curses in the mod example. I like the idea if using the TUNING.lua as it is made for temporary changes. As such I would like to follow this idea and started to do just that.

Specifically, in your case, you need AddIngredients() and ingredients to be global so you can use GLOBAL.AddIngredients(ingredients,....) or some sort of interface to accomplish the same thing.

I hope I don't have to do that. But indeed going that route may be needed.

Also, where is the Allergy variable (true/false value) coming from since it is not declared or set in the code above?

The allergy variable was an idea I had to be able to build randomization into the selection of the allergy. I was noticing that most variables do not need to be declared as when a variable is created it starts as a nil value until changed. I may have to build a reset into the system. If I have to do that I will indeed make sure it is declared and cleared prior to needing it.

EDIT:

Oh and TUNING.xxxx only refers to the table of values defined in the tuning.lua file

yeah I most likely need to design new table values in the tuning file to help accomplish building all the other curses into the mod. I looked at the random allergy idea and figured if I can do that one it should be easier to finish most of the rest.

Oh, one other thing I found in the code was a framework for a quest system already in place! =]

Link to comment
Share on other sites

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
 Share

×
  • Create New...