Frictional Games Forum (read-only)

Full Version: Creating and Destroying Tinderboxes
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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
Tinderboxes cannot be directly accessed.
(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 ?
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.