Frictional Games Forum (read-only)
Hit a wall with crafting two items together - Printable Version

+- Frictional Games Forum (read-only) (https://www.frictionalgames.com/forum)
+-- Forum: Amnesia: The Dark Descent (https://www.frictionalgames.com/forum/forum-6.html)
+--- Forum: Custom Stories, TCs & Mods - Development (https://www.frictionalgames.com/forum/forum-38.html)
+---- Forum: Development Support (https://www.frictionalgames.com/forum/forum-39.html)
+---- Thread: Hit a wall with crafting two items together (/thread-14518.html)

Pages: 1 2


Hit a wall with crafting two items together - Pitfall - 04-06-2012

I am crafting two items together... No problem...
But I need this to be done many times.
Because of the way the script calls the item based on it's name in the editor, this poses a problem.

Is there a work around?
Or any one have some ideas?




RE: Hit a wall with crafting two items together - Your Computer - 04-06-2012

(04-06-2012, 12:32 AM)Pitfall Wrote: Or any one have some ideas?

Be more descriptive.


RE: Hit a wall with crafting two items together - Pitfall - 04-06-2012

I don't know how to. I was planning on making it so players would have to use two common items to craft things like health kits.



RE: Hit a wall with crafting two items together - Your Computer - 04-06-2012

Would using AddUseItemCallback in combination with StringContains--and perhaps local map variables--be an issue?


RE: Hit a wall with crafting two items together - Pitfall - 04-06-2012

(04-06-2012, 01:09 AM)Your Computer Wrote: Would using AddUseItemCallback in combination with StringContains--and perhaps local map variables--be an issue?
Example please.



RE: Hit a wall with crafting two items together - Your Computer - 04-06-2012

PHP Code:
void OnStart()
{
    
AddUseItemCallback("INTERNAL_NAME""NAME_OF_ITEM""NAME_OF_ENTITY""NAME_OF_CALLBACK"true);
    
// Repeat for every item.
}

void NAME_OF_CALLBACK(string &in itemstring &in entity)
{
    if (
StringContains(item"medbox"))
        
AddLocalVarInt("Medbox"1);
    else if (
StringContains(item"medicine"))
        
AddLocalVarInt("Medicine"1);

    if (
GetLocalVarInt("Medbox") > 0
        
&& GetLocalVarInt("Medicine") > 2)
    {
        
AddLocalVarInt("Medbox", -1);
        
AddLocalVarInt("Medicine", -3);
        
// Give medkit...
    
}




RE: Hit a wall with crafting two items together - Pitfall - 04-06-2012


Still a bit of a problem. AddUseItemCallback(); per each item. Things like having many sanity potions (1 of the items used, the other being a container of blood) per map were the name would be potion_sanity_1, potion_sanity_2, etc.



RE: Hit a wall with crafting two items together - Your Computer - 04-06-2012

(04-06-2012, 07:26 AM)Pitfall Wrote: Still a bit of a problem. AddUseItemCallback(); per each item. Things like having many sanity potions (1 of the items used, the other being a container of blood) per map were the name would be potion_sanity_1, potion_sanity_2, etc.

You should be able to make use of a global.hps or inventory.hps instead of the map script.


RE: Hit a wall with crafting two items together - Pitfall - 04-06-2012

(04-06-2012, 07:47 AM)Your Computer Wrote: You should be able to make use of a global.hps or inventory.hps instead of the map script.
You are saying have a global script that contains:
Code:
AddUseItemCallback("Blahblah", "potion_sanity_1", "Blah", "RandomFunction");
AddUseItemCallback("Blahblah", "potion_sanity_2", "Blah", "RandomFunction");
AddUseItemCallback("Blahblah", "potion_sanity_3", "Blah", "RandomFunction");
...



RE: Hit a wall with crafting two items together - Your Computer - 04-06-2012

(04-06-2012, 08:01 AM)Pitfall Wrote: You are saying have a global script that contains:

Yeah.