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


Thread Rating:
  • 1 Vote(s) - 4 Average
  • 1
  • 2
  • 3
  • 4
  • 5
What's wrong..?
DannieWest Offline
Member

Posts: 156
Threads: 13
Joined: Apr 2011
Reputation: 0
#1
What's wrong..?

This is my script, what's wrong with it?

void OnStart()
{
AddUseItemCallback("", "Honey", "mansion_1", "UsedHoneyOnDoor", true);
}

void UsedHoneyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("mansion_1", false, true);
PlaySoundAtEntity("", "unlock_door.snt", "mansion_1", 0.0f, true);
RemoveItem("Honey");
}

void AddEntityCollideCallback("Player", "ScriptArea_1", "AddPropImpulse", true, 0);
{
AddPropImpulse(Hatchet_1, 0, 10, 0, "world");
}

I want the hatchet to fly open when the player enters ScriptArea_1, but I get an error saying "Unexpected token "{". The first part works..
05-04-2011, 01:23 PM
Find
Russ Money Offline
Senior Member

Posts: 360
Threads: 25
Joined: Dec 2010
Reputation: 4
#2
RE: What's wrong..?

void AddEntityCollideCallback("Player", "ScriptArea_1", "AddPropImpulse", true, 0);

Remove the ; at the end.

05-04-2011, 01:33 PM
Find
DannieWest Offline
Member

Posts: 156
Threads: 13
Joined: Apr 2011
Reputation: 0
#3
RE: What's wrong..?

(05-04-2011, 01:33 PM)Russ Money Wrote: void AddEntityCollideCallback("Player", "ScriptArea_1", "AddPropImpulse", true, 0);

Remove the ; at the end.

Did that, and now it said "Expected data type"... Huh
05-04-2011, 01:41 PM
Find
Russ Money Offline
Senior Member

Posts: 360
Threads: 25
Joined: Dec 2010
Reputation: 4
#4
RE: What's wrong..?

AddPropImpulse(Hatchet_1, 0, 10, 0, "world");

Also needs to be "Hatchet_1"

05-04-2011, 01:46 PM
Find
DannieWest Offline
Member

Posts: 156
Threads: 13
Joined: Apr 2011
Reputation: 0
#5
RE: What's wrong..?

(05-04-2011, 01:46 PM)Russ Money Wrote: AddPropImpulse(Hatchet_1, 0, 10, 0, "world");

Also needs to be "Hatchet_1"

No change, same error >.<
05-04-2011, 01:49 PM
Find
Acies Offline
Posting Freak

Posts: 1,643
Threads: 60
Joined: Feb 2011
Reputation: 73
#6
RE: What's wrong..?

void AddEntityCollideCallback("Player", "ScriptArea_1", "AddPropImpulse", true, 0);
{
AddPropImpulse(Hatchet_1, 0, 10, 0, "world");
}

this part is wrong. You should put the:
void OnStart()
{
AddUseItemCallback("", "Honey", "mansion_1", "UsedHoneyOnDoor", true);
AddEntityCollideCallback("Player", "ScriptArea_1", "HatchSwing", true, 0);
}

void HatchSwing(string &in asParent, string &in asChild, int alState)
{
AddPropImpulse("Hatchet_1", 0, 10, 0, "world");
}

There are often two parts to something happening:
1. Set up the script (This part should be done OnEnter or OnStart.)
2. Define what happens when it executes (This part should be done after Onstart or OnEnter)

[Image: mZiYnxe.png]


(This post was last modified: 05-04-2011, 02:11 PM by Acies.)
05-04-2011, 02:06 PM
Find
DannieWest Offline
Member

Posts: 156
Threads: 13
Joined: Apr 2011
Reputation: 0
#7
RE: What's wrong..?

Quote:There are often two parts to something happening:
1. Set up the script (This part should be done OnEnter or OnStart.)
2. Define what happens when it executes (This part should be done after Onstart or OnEnter)
So basicly, all stuff that is going to happen in the map could be put in between the first two barracks, or w/e they're called, and then u put out definitions to them below?

Sorry, still not working. Got an error saying Unexpected end of file. ..? This is the script now:
"void OnStart()
{
AddUseItemCallback("", "Honey", "mansion_1", "UsedHoneyOnDoor", true);
AddEntityCollideCallback("Player", "ScriptArea_1", HatchSwing", true, 0);
}

void UsedHoneyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("mansion_1", false, true);
PlaySoundAtEntity("", "unlock_door.snt", "mansion_1", 0.0f, true);
RemoveItem("Honey");
}

void HatchSwing(string &in asParent, string &in asChild, int alState)
{
AddPropImpulse("Hatchet_1", 0, 10, 0, "world");
}"
05-04-2011, 02:31 PM
Find
Roenlond Offline
Senior Member

Posts: 331
Threads: 3
Joined: Apr 2011
Reputation: 0
#8
RE: What's wrong..?

(05-04-2011, 02:31 PM)DannieWest Wrote:
Quote:There are often two parts to something happening:
1. Set up the script (This part should be done OnEnter or OnStart.)
2. Define what happens when it executes (This part should be done after Onstart or OnEnter)
So basicly, all stuff that is going to happen in the map could be put in between the first two barracks, or w/e they're called, and then u put out definitions to them below?

Sorry, still not working. Got an error saying Unexpected end of file. ..? This is the script now:
"void OnStart()
{
AddUseItemCallback("", "Honey", "mansion_1", "UsedHoneyOnDoor", true);
AddEntityCollideCallback("Player", "ScriptArea_1", HatchSwing", true, 0);
}

void UsedHoneyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("mansion_1", false, true);
PlaySoundAtEntity("", "unlock_door.snt", "mansion_1", 0.0f, true);
RemoveItem("Honey");
}

void HatchSwing(string &in asParent, string &in asChild, int alState)
{
AddPropImpulse("Hatchet_1", 0, 10, 0, "world");
}"

Spoiler below!

"void OnStart()
{
AddUseItemCallback("", "Honey", "mansion_1", "UsedHoneyOnDoor", true);
AddEntityCollideCallback("Player", "ScriptArea_1", "HatchSwing", true, 0);
}

void UsedHoneyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("mansion_1", false, true);
PlaySoundAtEntity("", "unlock_door.snt", "mansion_1", 0.0f, true);
RemoveItem("Honey");
}

void HatchSwing(string &in asParent, string &in asChild, int alState)
{
AddPropImpulse("Hatchet_1", 0, 10, 0, "world");
}"


Missed the bold quote on hatchswing. "AddEntityCollideCallback("Player", "ScriptArea_1", "HatchSwing", true, 0);"
(This post was last modified: 05-04-2011, 03:00 PM by Roenlond.)
05-04-2011, 02:59 PM
Find
DannieWest Offline
Member

Posts: 156
Threads: 13
Joined: Apr 2011
Reputation: 0
#9
RE: What's wrong..?

LOL!
Well, thanks alot! Now the map is working, only prob is the hatch dun move anything... do I have to low values? Tried changing to 100 and then 1000, but nothing happens :o
05-04-2011, 03:13 PM
Find
MrBigzy Offline
Senior Member

Posts: 616
Threads: 18
Joined: Mar 2011
Reputation: 8
#10
RE: What's wrong..?

Yea, usually I have values around 5000 for small rocks D:

If it's a hatch affected by gravity, you'll need to use a timer and give it a bunch of pushes in a row.
05-04-2011, 03:36 PM
Find




Users browsing this thread: 1 Guest(s)