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
Script Help Naming Items.
Genshien Offline
Junior Member

Posts: 4
Threads: 1
Joined: Feb 2012
Reputation: 0
#1
Naming Items.

alright,im a noobie at scripting for amnesia but i found no error with this code.


<LANGUAGE>
<CATEGORY Name="CustomStoryMain">
<Entry Name="Description">This is a test [br]</Entry>
</CATEGORY>
<CATEGORY Name="Inventory">
<Entry Name="ItemName_Key1">Weird Key</Entry>
<Entry Name="ItemDesc_Key1">Must be for a nearby Door.</Entry>

</CATEGORY>

<CATEGORY Name="Journal">
<Entry Name="Note_Note01_Name">Good Evening</Entry>
<Entry Name="Note_Note01_Text">I need to find my lantern....maybe i
left it in the study? The key lays at rest.</Entry>

</CATEGORY>
</LANGUAGE>

The script for naming and giving a description to my key is not working correctly.
The map loads fine and the note loads fine aswell.

when i pick up the key it says "Picked up"
I have the CustomSubItemTypeName set to Key1

however its not working....need some help with this one guys
02-20-2012, 12:09 AM
Find
Genshien Offline
Junior Member

Posts: 4
Threads: 1
Joined: Feb 2012
Reputation: 0
#2
RE: Naming Items.

Ok nevermind guys,i found the issue....now im trying to fix this key unlocking the door script.


/===========================================
// Starter's Script File!
//===========================================

//===========================================
// This runs when the map first starts
void OnStart()
{
AddUseItemCallback("", "key_tower_1", "mansion_3" "UsedKeyOnDoor", true);
}

void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("mansion_3", false, true);
PlaySoundAtEntity("", "unlock_door.snt", "mansion_3", 0.0f, false);
RemoveItem("key_tower_1");
AddDebugMessage("KeyOnDoor", false);
}

//===========================================
// This runs when the player enters the map

void OnEnter(){

}
//===========================================
// This runs when the player leaves the map
void OnLeave()
{
}


The key isn't opening the door....i've looked at several how-to's but im still confused on how this is supposed to go
02-20-2012, 02:17 AM
Find
JenniferOrange Offline
Senior Member

Posts: 424
Threads: 43
Joined: Jun 2011
Reputation: 33
#3
RE: Naming Items.

AddUseItemCallback("", "key_tower_1", "mansion_3", "UsedKeyOnDoor", true);

You're missing a comma, is all.



Ba-da bing, ba-da boom.
02-20-2012, 04:28 AM
Find
Genshien Offline
Junior Member

Posts: 4
Threads: 1
Joined: Feb 2012
Reputation: 0
#4
RE: Naming Items.


void OnStart()
{
AddUseItemCallback("", "Key", "mansion_3", "UsedKeyOnDoor", true);
}

void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("mansion_3", false, true);
PlaySoundAtEntity("", "unlock_door.snt", "mansion_3", 0.0f, false);
RemoveItem("Key");
}



Updated the script,still doesn't work correctly.
Key is the name of the key entity,im not using the CustomSubItemTypeName


mansion_3 is the name of the door.
02-20-2012, 05:49 AM
Find
Your Computer Offline
SCAN ME!

Posts: 3,456
Threads: 32
Joined: Jul 2011
Reputation: 235
#5
RE: Naming Items.

Since i don't see anything wrong with the second posted script (first one, aside from the missing comma, had an improperly initiated comment), and since you claim the entities names are correct, i have to ask: Is the name of the script the same as the name of the map that it relates to? Also, does the hpl.log provide any insight?

Tutorials: From Noob to Pro
02-20-2012, 02:03 PM
Website Find
Genshien Offline
Junior Member

Posts: 4
Threads: 1
Joined: Feb 2012
Reputation: 0
#6
RE: Naming Items.

dear god i feel so stupid right now

i named the map Test and the hps file Test.hps thinking the extension didn't count.

turns out i renamed the script file Test same as map and all my scripts work now.

im a dunce haha
02-21-2012, 01:18 AM
Find




Users browsing this thread: 1 Guest(s)