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


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Some newbie scripting help needed.
HandsomeGaren Offline
Junior Member

Posts: 2
Threads: 1
Joined: Jul 2012
Reputation: 0
#1
Question  Some newbie scripting help needed.

Hi,

I've recently been getting into making custom stories for Amnesia, since i'm still learning I'm just making maps for experimental purposes and so that I can learn all of the elements needed to make a full-fledged custom story.

However, this is the first time I've had to use scripting and I've been - although I can hold my own thanks to the amount of tutorials out there - stuck on this one issue that I've had for quite some time now.



// Run when entering map
void OnStart()
{
AddUseItemCallback("", "endlevelkey_1", "enddoor_1", "UsedKeyOnDoor", true);
}
void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("enddoor_1", false, true);
PlaySoundAtEntity("", "unlock_door", "enddoor_1", 0, false);
RemoveItem("endlevelkey_1");
}

AddEntityCollideCallback("Player", "teleportscript", "teleport", true, 1);

void teleport(string& asParent, string &in asChild, int alStates)
{
SetEntityActive("teleportingnakedguy", true);
AddPropForce("teleportingnakedguy", 0, 0, -10000, "world");
PlaySoundAtEntity("", "24_iron_maiden.snt", "teleportingnakedguy", 0, false);
}


As you can see, I have scripting for a door+key, and a teleporting naked guy trap, these two both work on their own, however when I put them together I get this error;

FATAL ERROR: Could not load script file 'custom_stories/Corridor/maps/00_Corridor_1.hps'!
main (13,25): ERR : Expected identifier.


I've toyed with it somewhat and this is the best I've come up with.

Can anybody help me fix my mistake and possibly teach me how to have two or more scripts in the same file operate correctly?
Thanks.
(This post was last modified: 07-11-2012, 08:26 PM by HandsomeGaren.)
07-11-2012, 04:25 PM
Find
SilentStriker Offline
Posting Freak

Posts: 950
Threads: 26
Joined: Jul 2011
Reputation: 43
#2
RE: Some newbie scripting help needed.

AddEntityCollideCallback("Player", "teleportscript", "teleport", true, 1);'

it should be placed inside void OnStart() like the AddUseItemCallback

07-11-2012, 04:55 PM
Find
HandsomeGaren Offline
Junior Member

Posts: 2
Threads: 1
Joined: Jul 2012
Reputation: 0
#3
RE: Some newbie scripting help needed.

Many thanks, you helped out lots. ^^
07-11-2012, 08:25 PM
Find
SilentStriker Offline
Posting Freak

Posts: 950
Threads: 26
Joined: Jul 2011
Reputation: 43
#4
RE: Some newbie scripting help needed.

Your welcome ^^

Welcome to the forum btw Smile

07-11-2012, 09:47 PM
Find
Vyzor Offline
Member

Posts: 92
Threads: 5
Joined: Aug 2011
Reputation: 6
#5
RE: Some newbie scripting help needed.

Its Garen people, Spin to win

[Image: vyzorbackgroundm.png]
07-11-2012, 10:49 PM
Find




Users browsing this thread: 1 Guest(s)