Frictional Games Forum (read-only)
[SCRIPT] Creating and Destroying Tinderboxes - 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: [SCRIPT] Creating and Destroying Tinderboxes (/thread-22322.html)



Creating and Destroying Tinderboxes - hunchbackproduction - 08-04-2013

void PickedUpTinderbox1(string &in asEntity, string &in type)
{
if (GetGlobalVarInt("Tinderboxes") < 20)
{
AddGlobalVarInt("Tinderboxes", 1);
}
if (GetGlobalVarInt("Tinderboxes") == 20)
{
SetMessage("Chemical", "manytinder", 1);
RemoveItem("tinderbox_1");
CreateEntityAtArea("tinderbox_1", "tinderbox.ent", "Player", true);
}
}

Here you can see that my code is supposed to destroy a tinderbox from my inventory and create one in the game world if I pick up a tinderbox and already have 20. In game I have named my tinderboxes "tinderbox_1" all the way to "tinderbox_20". The 21st tinderbox I put in the map to test is named "tinderbox_1"

However when I test this out, no tinderboxes are destoryed in my inventory (The count of tinderboxes shows 21)!
and no tinderbox is spawned in the gameworld...
Only the message informing me I have to many tinderboxes shows up. Any help would be appreciated Big Grin


RE: Creating and Destroying Tinderboxes - Your Computer - 08-04-2013

Tinderboxes cannot be directly accessed.


RE: Creating and Destroying Tinderboxes - hunchbackproduction - 08-04-2013

(08-04-2013, 04:44 PM)Your Computer Wrote: Tinderboxes cannot be directly accessed.

Alright thanks for the information, Luckily I think I have another way of solving this problem :3

Ok, so I fixed that problem by setting player walk and run speed to zero when the tinderbox count reached 20.

However is there no way of removing a tinderbox from the inventory ? Apart from lighting up lamps in the environment ?

RemoveItem("tinderbox.ent"); ? I doubt that will work tho...

Does this only apply to tinderboxes ?


RE: Creating and Destroying Tinderboxes - Rapture - 08-04-2013

If you want, you can swap the intended way Tinderboxes/Oil works.

Oil can be changed so you can use that as your Tinderboxes.

And tinderboxes can be used to light up objects that you have to carry around.