Facebook Twitter YouTube Frictional Games | Forum | Newsletter | Dev Blog | Dev Wiki | Support


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

Posts: 156
Joined: Apr 2011
Reputation: 0
Post: #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 all posts by this user Quote this message in a reply
Russ Money Offline
Senior Member

Posts: 360
Joined: Dec 2010
Reputation: 3
Post: #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 all posts by this user Quote this message in a reply
DannieWest Offline
Member

Posts: 156
Joined: Apr 2011
Reputation: 0
Post: #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 all posts by this user Quote this message in a reply
Russ Money Offline
Senior Member

Posts: 360
Joined: Dec 2010
Reputation: 3
Post: #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 all posts by this user Quote this message in a reply
DannieWest Offline
Member

Posts: 156
Joined: Apr 2011
Reputation: 0
Post: #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 all posts by this user Quote this message in a reply
Acies Online
Posting Freak

Posts: 1,629
Joined: Feb 2011
Reputation: 68
Post: #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 all posts by this user Quote this message in a reply
DannieWest Offline
Member

Posts: 156
Joined: Apr 2011
Reputation: 0
Post: #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 all posts by this user Quote this message in a reply
Roenlond Offline
Senior Member

Posts: 331
Joined: Apr 2011
Reputation: 0
Post: #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 all posts by this user Quote this message in a reply
DannieWest Offline
Member

Posts: 156
Joined: Apr 2011
Reputation: 0
Post: #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 all posts by this user Quote this message in a reply
MrBigzy Offline
Senior Member

Posts: 616
Joined: Mar 2011
Reputation: 8
Post: #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 all posts by this user Quote this message in a reply
Post Reply 




User(s) browsing this thread: 1 Guest(s)