Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Hit a wall with crafting two items together
Pitfall Offline
Member

Posts: 51
Threads: 5
Joined: Jun 2011
Reputation: 1
#1
Hit a wall with crafting two items together

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?

04-06-2012, 12:32 AM
Website Find
Your Computer Offline
SCAN ME!

Posts: 3,456
Threads: 32
Joined: Jul 2011
Reputation: 235
#2
RE: Hit a wall with crafting two items together

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

Be more descriptive.

Tutorials: From Noob to Pro
04-06-2012, 12:49 AM
Website Find
Pitfall Offline
Member

Posts: 51
Threads: 5
Joined: Jun 2011
Reputation: 1
#3
RE: Hit a wall with crafting two items together

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.
04-06-2012, 12:54 AM
Website Find
Your Computer Offline
SCAN ME!

Posts: 3,456
Threads: 32
Joined: Jul 2011
Reputation: 235
#4
RE: Hit a wall with crafting two items together

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

Tutorials: From Noob to Pro
04-06-2012, 01:09 AM
Website Find
Pitfall Offline
Member

Posts: 51
Threads: 5
Joined: Jun 2011
Reputation: 1
#5
RE: Hit a wall with crafting two items together

(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.
04-06-2012, 01:16 AM
Website Find
Your Computer Offline
SCAN ME!

Posts: 3,456
Threads: 32
Joined: Jul 2011
Reputation: 235
#6
RE: Hit a wall with crafting two items together

PHP Code: (Select All)
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...
    
}


Tutorials: From Noob to Pro
04-06-2012, 01:40 AM
Website Find
Pitfall Offline
Member

Posts: 51
Threads: 5
Joined: Jun 2011
Reputation: 1
#7
RE: Hit a wall with crafting two items together


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.
04-06-2012, 07:26 AM
Website Find
Your Computer Offline
SCAN ME!

Posts: 3,456
Threads: 32
Joined: Jul 2011
Reputation: 235
#8
RE: Hit a wall with crafting two items together

(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.

Tutorials: From Noob to Pro
04-06-2012, 07:47 AM
Website Find
Pitfall Offline
Member

Posts: 51
Threads: 5
Joined: Jun 2011
Reputation: 1
#9
RE: Hit a wall with crafting two items together

(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:
AddUseItemCallback("Blahblah", "potion_sanity_1", "Blah", "RandomFunction");
AddUseItemCallback("Blahblah", "potion_sanity_2", "Blah", "RandomFunction");
AddUseItemCallback("Blahblah", "potion_sanity_3", "Blah", "RandomFunction");
...
(This post was last modified: 04-06-2012, 08:01 AM by Pitfall.)
04-06-2012, 08:01 AM
Website Find
Your Computer Offline
SCAN ME!

Posts: 3,456
Threads: 32
Joined: Jul 2011
Reputation: 235
#10
RE: Hit a wall with crafting two items together

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

Yeah.

Tutorials: From Noob to Pro
04-06-2012, 08:02 AM
Website Find




Users browsing this thread: 4 Guest(s)