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
[HELP] Script Enabling/Variables
Cruzore Offline
Senior Member

Posts: 301
Threads: 2
Joined: Jun 2012
Reputation: 37
#11
RE: [HELP] Script Enabling/Variables

tell us exactly what you are trying to achieve, what the problem is and if there's an error message.
"There still is no restriction, I'm able to commit the scripts even if I haven't done the previous action leading up."
That doesn't make sense in any way I can think off.

Think, before you speak Google, before you post
(This post was last modified: 07-04-2012, 09:32 PM by Cruzore.)
07-04-2012, 09:31 PM
Find
himynamebob1 Offline
Member

Posts: 57
Threads: 12
Joined: Jun 2012
Reputation: 0
#12
RE: [HELP] Script Enabling/Variables

The purpose of the variables is to prevent the player of putting a glass jar on the ground until they stab a knife into a keg of wine. But, the script is ignoring the variables and allows me to put down the jar before I even stab the knife in.
07-04-2012, 09:34 PM
Find
Cruzore Offline
Senior Member

Posts: 301
Threads: 2
Joined: Jun 2012
Reputation: 37
#13
RE: [HELP] Script Enabling/Variables

Looking at the names of your script gives me headaches, so i'll just explain it like this:
So, you want to only put down a jar if you used the knife first.
void OnStart()
{
AddUseItemCallback("randomname1", "knife", "keg", "KnifeTheKeg", false);
AddUseItemCallback("randomname2", "jar", "keg", "JarTheKeg", false);
AddLocalVarInt("SomeVariable", 0);
}
void KnifeTheKeg(string &in asItem, string &in asEntity)
{
RemoveItem(asItem);
//fancy stuff like sounds etc here
AddLocalVarInt("SomeVariable", 1);

}
JarTheKeg(string &in asItem, string &in asEntity)
{
if(GetLocalVarInt("SomeVariable")==1)
{
RemoveItem(asItem);
//Your other stuff here, like fancy stuff and what should happen
}
}

This is just an example

Think, before you speak Google, before you post
07-04-2012, 09:49 PM
Find
himynamebob1 Offline
Member

Posts: 57
Threads: 12
Joined: Jun 2012
Reputation: 0
#14
RE: [HELP] Script Enabling/Variables

It did not work.
07-05-2012, 05:11 AM
Find
Cruzore Offline
Senior Member

Posts: 301
Threads: 2
Joined: Jun 2012
Reputation: 37
#15
RE: [HELP] Script Enabling/Variables

Woops, I made a mistake myself.
void OnStart()
{
AddUseItemCallback("randomname1", "knife", "keg", "KnifeTheKeg", false);

}
void KnifeTheKeg(string &in asItem, string &in asEntity)
{
RemoveItem(asItem);
//fancy stuff like sounds etc here
AddUseItemCallback("randomname2", "jar", "keg", "JarTheKeg", false);

}
JarTheKeg(string &in asItem, string &in asEntity)
{
RemoveItem(asItem);
//Your other stuff here, like fancy stuff and what should happen

}
That should work. And even without variables, by just placing the callbacks in the right position.

Think, before you speak Google, before you post
07-05-2012, 12:15 PM
Find
himynamebob1 Offline
Member

Posts: 57
Threads: 12
Joined: Jun 2012
Reputation: 0
#16
RE: [HELP] Script Enabling/Variables

That works with the keg but not the fire.
07-05-2012, 09:21 PM
Find
Cruzore Offline
Senior Member

Posts: 301
Threads: 2
Joined: Jun 2012
Reputation: 37
#17
RE: [HELP] Script Enabling/Variables

what fire? You only mentioned that the keg wouldn't work. You only said something like "I want to let the jar be only placeable once you knifed the keg" and nothing about a fire...?
EDIT: Oh, I see. I think there was a similiar topic, wait a minute.

Think, before you speak Google, before you post
(This post was last modified: 07-05-2012, 09:42 PM by Cruzore.)
07-05-2012, 09:41 PM
Find
himynamebob1 Offline
Member

Posts: 57
Threads: 12
Joined: Jun 2012
Reputation: 0
#18
RE: [HELP] Script Enabling/Variables

After the jar is full I would like the player to take it to a furnace then have to light the furnace before they can cook the containments.
07-05-2012, 09:42 PM
Find
Cruzore Offline
Senior Member

Posts: 301
Threads: 2
Joined: Jun 2012
Reputation: 37
#19
RE: [HELP] Script Enabling/Variables

I don't know if it works, but try this:
inside the JarTheKeg function, place this:

AddUseItemCallback("randomname3", "tinderbox_1", "Your furnace Name Here", "LightTheFire", true);

then, add this function somewhere:

void LightTheFire(string &in asItem, string &in asEntity)
{
AddUseItemCallback("randomname4", "jar", "Your furnace Name Here", "JarTheFire", true);
}

then, another function:

void JarTheFire(string &in asItem, string &in asEntity)
{
stuff you want to happen here.
}

However, I am not sure if it works like this with the tinderbox. I'm assuming by "checking if the furnace is on" you mean using a tinderbox on a unlit fireplace or something. If so, then this might work. You can also do this with a lever or something, but it's a different code then.

Think, before you speak Google, before you post
07-05-2012, 09:48 PM
Find
himynamebob1 Offline
Member

Posts: 57
Threads: 12
Joined: Jun 2012
Reputation: 0
#20
RE: [HELP] Script Enabling/Variables

The player is able to receive other tinderboxes previously in the CS though.
07-05-2012, 09:59 PM
Find




Users browsing this thread: 1 Guest(s)