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


Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Script Help Creating and Destroying Tinderboxes
hunchbackproduction Offline
Junior Member

Posts: 36
Threads: 13
Joined: Jul 2013
Reputation: 0
#1
Creating and Destroying Tinderboxes

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

Scripting level is over 9000!
08-04-2013, 03:54 PM
Website Find
Your Computer Offline
SCAN ME!

Posts: 3,456
Threads: 32
Joined: Jul 2011
Reputation: 235
#2
RE: Creating and Destroying Tinderboxes

Tinderboxes cannot be directly accessed.

Tutorials: From Noob to Pro
08-04-2013, 04:44 PM
Website Find
hunchbackproduction Offline
Junior Member

Posts: 36
Threads: 13
Joined: Jul 2013
Reputation: 0
#3
RE: Creating and Destroying Tinderboxes

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

Scripting level is over 9000!
(This post was last modified: 08-04-2013, 05:38 PM by hunchbackproduction.)
08-04-2013, 04:57 PM
Website Find
Rapture Offline
Posting Freak

Posts: 1,078
Threads: 79
Joined: May 2011
Reputation: 30
#4
RE: Creating and Destroying 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.
08-04-2013, 10:41 PM
Find




Users browsing this thread: 1 Guest(s)