ZeMaster091
Junior Member
Posts: 3
Threads: 2
Joined: Mar 2013
Reputation:
0
|
Unexpected Token
This is my .hps
////////////////////////////
// Run first time starting map
void OnStart()
{
AddUseItemCallback(""e, "hollow_needle_1", "First_Door", "UsedKeyOnDoor", true);
}
void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("First_Door", false, true);
PlaySoundAtEntity("", "unlock_door", "First_Door", 0, false);
RemoveItem("hollow_needle_1");
}
{
AddEntityCollideCallback("Player", "SlamDoor", "CollideRoomTwo", true, 1);
}
void CollideRoomTwo(string &in asParent, string &in asChild, int alState)
{
SetSwingDoorClosed("First_Door", true, true);
}
////////////////////////////
// Run when entering map
void OnEnter()
{
}
////////////////////////////
// Run when leaving map
void OnLeave()
{
}
How can I fix this?
|
|
03-10-2013, 12:32 AM |
|
PutraenusAlivius
Posting Freak
Posts: 4,713
Threads: 75
Joined: Dec 2012
Reputation:
119
|
RE: Unexpected Token
You put the AddEntityCollideCallback part to the void OnStart() section.
"Veni, vidi, vici."
"I came, I saw, I conquered."
|
|
03-10-2013, 12:39 AM |
|
ZeMaster091
Junior Member
Posts: 3
Threads: 2
Joined: Mar 2013
Reputation:
0
|
RE: Unexpected Token
I'm confused. I'm trying to do what you say but I'm still getting errors
|
|
03-10-2013, 12:52 AM |
|
PutraenusAlivius
Posting Freak
Posts: 4,713
Threads: 75
Joined: Dec 2012
Reputation:
119
|
RE: Unexpected Token
(03-10-2013, 12:52 AM)ZeMaster091 Wrote: I'm confused. I'm trying to do what you say but I'm still getting errors
In the script, there should be a part that say
right?
Put the
{ AddEntityCollideCallback("Player", "SlamDoor", "CollideRoomTwo", true, 1); }
to the void OnStart() section, so that it will look like
void OnStart() { AddEntityCollideCallback("Player", "SlamDoor", "CollideRoomTwo", true, 1); AddUseItemCallback("", "hollow_needle_1", "First_Door", "UsedKeyOnDoor", true); }
In the guide's and tutorials, there are void OnStart()'s right? Well, you can't have two of those. Just put the command in the void OnStart() section of the tutorial to your own void OnStart() part.
For Example:
Tutorial says AddEntityCollideCallback to spawn a monster when you collide with it. Script on tutorial (in the void OnStart() part.) says this.
AddEntityCollideCallback("Player", "Door", "PlayerCollide", true, 1);
But, you follow another one that allows you to unlock a locked door. The void OnStart() part says:
AddUseItemCallback("", "Jar of Acid", "Door2", "DestroyDoor", true);
/End Example.
Since you can't have to void OnStart()'s, just put the AddEntityCollideCallback and AddUseItemCallback to your void OnStart() part.
"Veni, vidi, vici."
"I came, I saw, I conquered."
|
|
03-10-2013, 01:12 AM |
|
ZeMaster091
Junior Member
Posts: 3
Threads: 2
Joined: Mar 2013
Reputation:
0
|
RE: Unexpected Token
(03-10-2013, 01:12 AM)JustAnotherPlayer Wrote: (03-10-2013, 12:52 AM)ZeMaster091 Wrote: I'm confused. I'm trying to do what you say but I'm still getting errors
In the script, there should be a part that say
right?
Put the
{ AddEntityCollideCallback("Player", "SlamDoor", "CollideRoomTwo", true, 1); }
to the void OnStart() section, so that it will look like
void OnStart() { AddEntityCollideCallback("Player", "SlamDoor", "CollideRoomTwo", true, 1); AddUseItemCallback("", "hollow_needle_1", "First_Door", "UsedKeyOnDoor", true); }
In the guide's and tutorials, there are void OnStart()'s right? Well, you can't have two of those. Just put the command in the void OnStart() section of the tutorial to your own void OnStart() part.
OH. I get it now. Thanks a lot!
|
|
03-10-2013, 01:15 AM |
|
PutraenusAlivius
Posting Freak
Posts: 4,713
Threads: 75
Joined: Dec 2012
Reputation:
119
|
RE: Unexpected Token
(03-10-2013, 01:15 AM)ZeMaster091 Wrote: (03-10-2013, 01:12 AM)JustAnotherPlayer Wrote: (03-10-2013, 12:52 AM)ZeMaster091 Wrote: I'm confused. I'm trying to do what you say but I'm still getting errors
In the script, there should be a part that say
right?
Put the
{ AddEntityCollideCallback("Player", "SlamDoor", "CollideRoomTwo", true, 1); }
to the void OnStart() section, so that it will look like
void OnStart() { AddEntityCollideCallback("Player", "SlamDoor", "CollideRoomTwo", true, 1); AddUseItemCallback("", "hollow_needle_1", "First_Door", "UsedKeyOnDoor", true); }
In the guide's and tutorials, there are void OnStart()'s right? Well, you can't have two of those. Just put the command in the void OnStart() section of the tutorial to your own void OnStart() part.
OH. I get it now. Thanks a lot! I also edited my post with good explanation. Check it out.
"Veni, vidi, vici."
"I came, I saw, I conquered."
|
|
03-10-2013, 01:18 AM |
|
ExpectedIdentifier
Member
Posts: 234
Threads: 10
Joined: Sep 2012
Reputation:
11
|
RE: Unexpected Token
You have an AddEntityCollideCallback inbetween brackets with no function before the bracket.
You have a random e outside two "" under OnStart(). Learn the basics of scripting before trying to script.
|
|
03-10-2013, 02:14 AM |
|
PutraenusAlivius
Posting Freak
Posts: 4,713
Threads: 75
Joined: Dec 2012
Reputation:
119
|
RE: Unexpected Token
(03-10-2013, 02:14 AM)sonataarctica Wrote: You have an AddEntityCollideCallback inbetween brackets with no function before the bracket.
You have a random e outside two "" under OnStart(). Learn the basics of scripting before trying to script.
You just posted this without seeing the posts above you.
"Veni, vidi, vici."
"I came, I saw, I conquered."
|
|
03-10-2013, 02:16 AM |
|
ExpectedIdentifier
Member
Posts: 234
Threads: 10
Joined: Sep 2012
Reputation:
11
|
RE: Unexpected Token
(03-10-2013, 02:16 AM)JustAnotherPlayer Wrote: (03-10-2013, 02:14 AM)sonataarctica Wrote: You have an AddEntityCollideCallback inbetween brackets with no function before the bracket.
You have a random e outside two "" under OnStart(). Learn the basics of scripting before trying to script.
You just posted this without seeing the posts above you.
Oh yeah. It's been a long day, I'm tired. Sorry.
|
|
03-10-2013, 02:26 AM |
|
|