Paulpolska
Member
Posts: 144
Threads: 29
Joined: Jun 2011
Reputation:
0
|
Help with GetLocalVarInt
I have script that we must put three wheels to machine after my next function must show message if GetLocalVarInt = 3. Of course don't show
void OnStart()
{
AddEntityCollideCallback("Player", "ScriptArea_1", "Plax", true, 1);
AddEntityCollideCallback("cogwheel_tiny01_4", "StickyArea_3", "CollideWheel", false, 1);
AddEntityCollideCallback("cogwheel_tiny01_5", "StickyArea_1", "CollideWheel", false, 1);
AddEntityCollideCallback("cogwheel_tiny01_6", "StickyArea_2", "CollideWheel", false, 1);
}
void CollideWheel(string &in asParent, string &in asChild, int alState)
{
AddLocalVarInt("asChild", 1);
PlaySoundAtEntity("", "impact_metal_low", "Player", 0.05f, false);
}
void StartSectionDead(string &in asChild, int alVal)
{
if(GetLocalVarInt("asChild") != 3) {
SetMessage("Journal", "Slime", 0);
}
}
|
|
07-04-2011, 05:52 PM |
|
DamnNoHtml
Senior Member
Posts: 469
Threads: 34
Joined: Sep 2010
Reputation:
16
|
RE: Help with GetLocalVarInt
I don't see anywhere where "StartSectionDead" is actually being called.
Also, != 3 means not equal to 3.
Creator of Wake, Through the Portal, Insomnia, and Cycles What to do with HPL3....
|
|
07-04-2011, 05:54 PM |
|
Paulpolska
Member
Posts: 144
Threads: 29
Joined: Jun 2011
Reputation:
0
|
RE: Help with GetLocalVarInt
If i set "==" too is don't work. Hmm how I call this function when three wheels is putting ?
I check it but still is dead
void CollideWheel(string &in asParent, string &in asChild, int alState)
{
AddLocalVarInt("asChild", 1);
PlaySoundAtEntity("", "impact_metal_low", "Player", 0.05f, false);
if(GetLocalVarInt("asChild") == 3) {
AddEntityCollideCallback("Player", "ScriptArea_2", "StartSectionDead", false, 1);
}
}
void StartSectionDead(string &in asParent, string &in asChild, int alState)
{
SetMessage("Journal", "Slime", 0);
}
|
|
07-04-2011, 06:02 PM |
|
Kyle
Posting Freak
Posts: 911
Threads: 36
Joined: Sep 2010
Reputation:
7
|
RE: Help with GetLocalVarInt
You must set a local var int first be adding.
Use this:
SetLocalVarInt("asChild", 0); in your void OnStart()
It's just all messed up... :/
|
|
07-04-2011, 06:36 PM |
|
palistov
Posting Freak
Posts: 1,208
Threads: 67
Joined: Mar 2011
Reputation:
57
|
RE: Help with GetLocalVarInt
You don't need to use quotation marks when using the asChild reference. asChild is already a string, and you use " " to denote a string. You're basically saying ""asChild"". Also, you need to script the collide callback in your OnStart, as well as declare the variable beforehand. Like Kyle said, use SetLocalVarInt() to declare your variable. Since we don't know what your asChild is named, you'll need to do that on your own.
|
|
07-05-2011, 12:30 AM |
|
Paulpolska
Member
Posts: 144
Threads: 29
Joined: Jun 2011
Reputation:
0
|
RE: Help with GetLocalVarInt
Easy I finished this problem yesterday ;] thanks all
|
|
07-05-2011, 12:06 PM |
|
|