Magasztos
Member
Posts: 54
Threads: 21
Joined: Jun 2012
Reputation:
0
|
Can someone tell me what is wrong with this script? (again)
I'm having trouble with a script once again (usually I can solve it myself but I tried something new just now)
There is most likely a problem with the "if" & "else" stuff because this is the first time I've ever tried that and also when I load the map I get the message "unexpected end of file (65, 2)"
In this case 65, 2 is the end of my file.
void OnStart()
{
AddUseItemCallback("", "hammer_1", "padlock_1", "BreakPadlock", true);
AddUseItemCallback("", "dagger", "corpse_1", "KnifeActive", true);
AddUseItemCallback("", "knife_1", "ScriptArea_1", "KnifeActive2", true);
AddEntityCollideCallback("lever_1", "ScriptArea_2", "AcidPrepare", true, 1);
AddUseItemCallback("", "dagger", "ScriptArea_1", "GiveMessage", true);
}
void BreakPadlock(string &in asItem, string &in asEntity)
{
SetEntityActive("Padlock_1", false);
SetEntityActive("Padlock_2", true);
CreateParticleSystemAtEntity("", "ps_hit_wood", "AreaDust", false);
PlaySoundAtEntity("", "break_wood_metal.snt", "prison_1", 0.0f, false);
}
void KnifeActive(string &in asItem, string &in asEntity)
{
SetEntityActive("corpse_1", false);
SetEntityActive("corpse_2", true);
SetEntityActive("knife_1", true);
RemoveItem("dagger");
PlaySoundAtEntity("", "slime_attack_normal_hit.snt", "knife_1", 0.0f, false);
CreateParticleSystemAtEntity("", "blood.ps", "BloodArea", false);
}
void KnifeActive2(string &in asItem, string &in asEntity)
{
SetEntityActive("knife_2", true);
RemoveItem("knife_1");
}
void AcidPrepare(string &in asParent, string &in asChild, int alState)
{
if(GetSwingDoorClosed("Extract") == false)
{
SetMessage("Messages", "CloseDoor", 0);
}
else
{
AddTimer("", 2.0, "TimerSwitchShovel");
CreateParticleSystemAtEntity("", "blood.ps", "BloodArea2", false);
SetEntityActive("glass_1", false);
SetEntityActive("glass_2", true);
}
void GiveMessage(string &in asItem, string &in asEntity)
{
SetMessage("Messages", "DaggerClean", 0);
}
void OnEnter()
{
}
void OnLeave()
{
}
~The Hulk is always greener on the other side~
(This post was last modified: 07-21-2012, 08:45 PM by Magasztos.)
|
|
07-21-2012, 03:37 PM |
|
Adny
Posting Freak
Posts: 1,766
Threads: 6
Joined: Mar 2012
Reputation:
173
|
RE: Can someone tell me what is wrong with this script? (again)
You were missing a "}" at the end of the if/else statement, here's the revision:
void AcidPrepare(string &in asParent, string &in asChild, int alState)
{
if(GetSwingDoorClosed("Extract") == false)
{
SetMessage("Messages", "CloseDoor", 0);
}
else
{
AddTimer("", 2.0, "TimerSwitchShovel");
CreateParticleSystemAtEntity("", "blood.ps", "BloodArea2", false);
SetEntityActive("glass_1", false);
SetEntityActive("glass_2", true);
}
}
I rate it 3 memes.
|
|
07-21-2012, 03:42 PM |
|
Magasztos
Member
Posts: 54
Threads: 21
Joined: Jun 2012
Reputation:
0
|
RE: Can someone tell me what is wrong with this script? (again)
(07-21-2012, 03:42 PM)andyrockin123 Wrote: You were missing a "}" at the end of the if/else statement, here's the revision:
void AcidPrepare(string &in asParent, string &in asChild, int alState)
{
if(GetSwingDoorClosed("Extract") == false)
{
SetMessage("Messages", "CloseDoor", 0);
}
else
{
AddTimer("", 2.0, "TimerSwitchShovel");
CreateParticleSystemAtEntity("", "blood.ps", "BloodArea2", false);
SetEntityActive("glass_1", false);
SetEntityActive("glass_2", true);
}
}
Thank you so much, because of the } that was already there I didn't notice I was supposed to put another one there for the first {
Once again thanks :p
~The Hulk is always greener on the other side~
|
|
07-21-2012, 03:44 PM |
|
Kreekakon
Pick a god and pray!
Posts: 3,063
Threads: 70
Joined: Mar 2012
Reputation:
124
|
RE: Can someone tell me what is wrong with this script? (again)
void AcidPrepare(string &in asParent, string &in asChild, int alState)
is missing one of its brackets, specifically the ending one.
EDIT: Damn it, got ninjaed!!
(This post was last modified: 07-21-2012, 03:46 PM by Kreekakon.)
|
|
07-21-2012, 03:45 PM |
|
Magasztos
Member
Posts: 54
Threads: 21
Joined: Jun 2012
Reputation:
0
|
RE: Can someone tell me what is wrong with this script? (again)
(07-21-2012, 03:45 PM)Kreekakon Wrote: void AcidPrepare(string &in asParent, string &in asChild, int alState)
is missing one of its brackets, specifically the ending one.
EDIT: Damn it, got ninjaed!!
Well look at the bright side...you could have got ninjaed with 1 minute diffrence...
~The Hulk is always greener on the other side~
|
|
07-21-2012, 05:04 PM |
|
|