Pitfall
Member
Posts: 51
Threads: 5
Joined: Jun 2011
Reputation:
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 |
|
Your Computer
SCAN ME!
Posts: 3,456
Threads: 32
Joined: Jul 2011
Reputation:
235
|
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.
|
|
04-06-2012, 12:49 AM |
|
Pitfall
Member
Posts: 51
Threads: 5
Joined: Jun 2011
Reputation:
1
|
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 |
|
Your Computer
SCAN ME!
Posts: 3,456
Threads: 32
Joined: Jul 2011
Reputation:
235
|
RE: Hit a wall with crafting two items together
Would using AddUseItemCallback in combination with StringContains--and perhaps local map variables--be an issue?
|
|
04-06-2012, 01:09 AM |
|
Pitfall
Member
Posts: 51
Threads: 5
Joined: Jun 2011
Reputation:
1
|
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 |
|
Your Computer
SCAN ME!
Posts: 3,456
Threads: 32
Joined: Jul 2011
Reputation:
235
|
RE: Hit a wall with crafting two items together
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 item, string &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... } }
|
|
04-06-2012, 01:40 AM |
|
Pitfall
Member
Posts: 51
Threads: 5
Joined: Jun 2011
Reputation:
1
|
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 |
|
Your Computer
SCAN ME!
Posts: 3,456
Threads: 32
Joined: Jul 2011
Reputation:
235
|
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.
|
|
04-06-2012, 07:47 AM |
|
Pitfall
Member
Posts: 51
Threads: 5
Joined: Jun 2011
Reputation:
1
|
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 |
|
Your Computer
SCAN ME!
Posts: 3,456
Threads: 32
Joined: Jul 2011
Reputation:
235
|
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.
|
|
04-06-2012, 08:02 AM |
|
|