RurouniMori
Junior Member
Posts: 11
Threads: 3
Joined: Apr 2013
Reputation:
0
|
HELP! Image, Key, and Door - Not working!
Okay, so what I'm doing is building a level piece by piece. First, I built one room, saved all that as one custom story. I copied all that into a new custom story. Then I built another, added in more details and effects, saved all that as one custom story. Copied it all again, and started refining it, and intend to add onto that. And again, save that as one custom story. This way, if I add onto the story piece by piece, I don't lose it all if something happens, or I can retrace all my steps to see where I went wrong.
But this last time, I changed the message for when the player looks at the door. And when I tested it, the message works, but everything else doesn't. The monster doesn't appear when the key is picked up, as I scripted it to, and the key doesn't work on the door anymore. So what I then did, was go through and rename everything in the script AFTER I renamed the key and the door in the level editor. But it still doesn't work. I have no idea what I did wrong.
The second custom story was called PracticeTwo. This new one is called My Lord's Curse.
This is the code for PracticeTwo:
Quote:////////////////////////////
// Run when entering map
void OnStart()
{
AddUseItemCallback("", "warningkey", "warningdoor", "UsedKeyOnDoor", true);
SetEntityCallbackFunc("warningkey", "OnPickup");
AddEntityCollideCallback("spawngrunt1","stop","CollideStop",true,1);
}
void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("warningdoor", false, true);
PlaySoundAtEntity("", "unlock_door.snt", "warningdoor", 0, false);
RemoveItem("warningkey");
}
void warningdoor(string &in entity)
{
if(GetSwingDoorLocked("warningdoor") ==true){
SetMessage("Messages", "warningdoorMessage", 3.0f);
}
}
void OnPickup(string &in asEntity, string &in type)
{
SetEntityActive("spawngrunt1", true);
AddEnemyPatrolNode("spawngrunt1", "PathNodeArea_1", 0.0f, "");
AddEnemyPatrolNode("spawngrunt1", "PathNodeArea_2", 0.0f, "");
AddEnemyPatrolNode("spawngrunt1", "PathNodeArea_3", 0.0f, "");
AddEnemyPatrolNode("spawngrunt1", "PathNodeArea_4", 0.0f, "");
AddEnemyPatrolNode("spawngrunt1", "PathNodeArea_5", 0.0f, "");
AddEnemyPatrolNode("spawngrunt1", "PathNodeArea_6", 30.0f, "");
AddEnemyPatrolNode("spawngrunt1", "PathNodeArea_7", 0.0f, "");
AddEnemyPatrolNode("spawngrunt1", "PathNodeArea_8", 0.0f, "");
AddEnemyPatrolNode("spawngrunt1", "PathNodeArea_9", 0.0f, "");
AddEnemyPatrolNode("spawngrunt1", "PathNodeArea_11", 0.0f, "");
AddEnemyPatrolNode("spawngrunt1", "PathNodeArea_12", 0.0f, "");
AddEnemyPatrolNode("spawngrunt1", "PathNodeArea_13", 0.0f, "");
AddEnemyPatrolNode("spawngrunt1", "PathNodeArea_14", 0.0f, "");
AddEnemyPatrolNode("spawngrunt1", "PathNodeArea_15", 0.0f, "");
AddEnemyPatrolNode("spawngrunt1", "PathNodeArea_16", 0.0f, "");
AddEnemyPatrolNode("spawngrunt1", "PathNodeArea_17", 0.0f, "");
AddEnemyPatrolNode("spawngrunt1", "PathNodeArea_18", 0.0f, "");
AddEnemyPatrolNode("spawngrunt1", "PathNodeArea_19", 0.0f, "");
AddEnemyPatrolNode("spawngrunt1", "PathNodeArea_20", 0.0f, "");
AddEnemyPatrolNode("spawngrunt1", "PathNodeArea_21", 0.0f, "");
AddEnemyPatrolNode("spawngrunt1", "PathNodeArea_22", 0.0f, "");
}
void CollideStop(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("spawngrunt1", false);
}
////////////////////////////
// Run when leaving map
void OnEnd()
{
}
This is the Lang File for PracticeTwo:
Quote:<LANGUAGE>
<RESOURCES>
</RESOURCES>
<CATEGORY Name="CustomStoryMain">
<Entry Name="Description">Practice Set Two, Two Rooms.[br]Hopefully it works!</Entry>
</CATEGORY>
<CATEGORY Name="Inventory">
<Entry Name="ItemDesc_warningkey">"Unlocks door to Storage."</Entry>
<Entry Name="ItemName_warningkey">Storage Room Key</Entry>
</CATEGORY>
<CATEGORY Name="Journal">
<Entry Name="Note_awarning_Name">May It Be Known</Entry>
<Entry Name="Note_awarning_Text">For he doth grab the key,[br]May it be known that he must flee.</Entry>
</CATEGORY>
<CATEGORY Name="Messages">
<Entry Name="warningdoorMessage">The door is locked.[br]Storage Room Key is required.</Entry>
</CATEGORY>
</LANGUAGE>
This is the script for My Lord's Curse:
Quote:////////////////////////////
// Run when entering map
void OnStart()
{
StartEffectEmotionFlash("Narration", "startmessage", "15_the_big_scream.snt");
}
void startmessage(string& asTextCat, string& asTextEntry, string& asSound)
{
StartEffectFlash(2.0f, 1.0, 2.0f);
}
void EffectFlash(float afFadeIn, float afWhite, float afFadeOut)
{
AddUseItemCallback("", "servantkey", "servantdoor", "UsedKeyOnDoor", true);
SetEntityCallbackFunc("servantkey", "OnPickup");
AddEntityCollideCallback("spawngrunt1","stop","CollideStop",true,1);
}
void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("servantdoor", false, true);
PlaySoundAtEntity("", "unlock_door.snt", "servantdoor", 0, false);
RemoveItem("servantkey");
}
void servantdoor(string &in entity)
{
if(GetSwingDoorLocked("servantdoor") ==true){
SetMessage("Messages", "servantdoorMessage", 5.0f);
}
}
void OnPickup(string &in asEntity, string &in type)
{
SetEntityActive("spawngrunt1", true);
AddEnemyPatrolNode("spawngrunt1", "PathNodeArea_1", 0.0f, "");
AddEnemyPatrolNode("spawngrunt1", "PathNodeArea_2", 0.0f, "");
AddEnemyPatrolNode("spawngrunt1", "PathNodeArea_3", 0.0f, "");
AddEnemyPatrolNode("spawngrunt1", "PathNodeArea_4", 0.0f, "");
AddEnemyPatrolNode("spawngrunt1", "PathNodeArea_5", 0.0f, "");
AddEnemyPatrolNode("spawngrunt1", "PathNodeArea_6", 30.0f, "");
AddEnemyPatrolNode("spawngrunt1", "PathNodeArea_7", 0.0f, "");
AddEnemyPatrolNode("spawngrunt1", "PathNodeArea_8", 0.0f, "");
AddEnemyPatrolNode("spawngrunt1", "PathNodeArea_9", 0.0f, "");
AddEnemyPatrolNode("spawngrunt1", "PathNodeArea_11", 0.0f, "");
AddEnemyPatrolNode("spawngrunt1", "PathNodeArea_12", 0.0f, "");
AddEnemyPatrolNode("spawngrunt1", "PathNodeArea_13", 0.0f, "");
AddEnemyPatrolNode("spawngrunt1", "PathNodeArea_14", 0.0f, "");
AddEnemyPatrolNode("spawngrunt1", "PathNodeArea_15", 0.0f, "");
AddEnemyPatrolNode("spawngrunt1", "PathNodeArea_16", 0.0f, "");
AddEnemyPatrolNode("spawngrunt1", "PathNodeArea_17", 0.0f, "");
AddEnemyPatrolNode("spawngrunt1", "PathNodeArea_18", 0.0f, "");
AddEnemyPatrolNode("spawngrunt1", "PathNodeArea_19", 0.0f, "");
AddEnemyPatrolNode("spawngrunt1", "PathNodeArea_20", 0.0f, "");
AddEnemyPatrolNode("spawngrunt1", "PathNodeArea_21", 0.0f, "");
AddEnemyPatrolNode("spawngrunt1", "PathNodeArea_22", 0.0f, "");
}
void CollideStop(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("spawngrunt1", false);
}
////////////////////////////
// Run when leaving map
void OnEnd()
{
}
And this is the Lang File for My Lord's Curse:
<LANGUAGE>
<RESOURCES>
</RESOURCES>
<CATEGORY Name="CustomStoryMain">
<Entry Name="Description">The grand Lord Dalmoc was one loved by his people, treasured for his compassion
and revered for his wisdom. The family of the Dalmoc bloodline was what founded the city of Lak, for it
came to be that their wine was the best there ever was.[br]As a servant, you have never found yourself unhappy
in his services. Well fed, treated with some respect, you never minded the dank castle and its eerie halls.
This is your home. But recently, your Lord has entered a secluded state of mind. He has hid himself in his study,
the only sight of him is when he bustles between his lab and his treasured wine cellar.[br]But alas! He has
reappeared. Though he looks ill, you and your fellow staff find yourselves pleased to see him...until everything
goes wrong.
[br]It all goes black. And you awaken in the castle you no longer recognize.
[br]What happened?</Entry>
</CATEGORY>
<CATEGORY Name="Inventory">
<Entry Name="ItemDesc_servantkey">"Unlocks door to Servant's Quarters."</Entry>
<Entry Name="ItemName_servantkey">Servant Key</Entry>
</CATEGORY>
<CATEGORY Name="Journal">
<Entry Name="Note_awarning_Name">May It Be Known</Entry>
<Entry Name="Note_awarning_Text">For he doth grab the key,[br]May it be known that he must flee.</Entry>
</CATEGORY>
<CATEGORY Name="Messages">
<Entry Name="servantdoorMessage">The door is locked.[br]Servant Key is required.[br]Where did I leave it?</Entry>
</CATEGORY>
<CATEGORY Name="Narration">
<Entry Name="startmessage">What...happened? Where is everyone?
[br]Something is terribly wrong.
[br]I have to get out of here.</Entry>
</CATEGORY>
</LANGUAGE>
Sorry to make a wall of text here. I assume I made derpface mistake somewhere in there or a common error. Either way, if someone could let me know what I did wrong and help, that would be splendid. As well as maybe some tips for the future.
ALSO! I'm having a silly little issue. I can't seem to get the image to show up for my custom story.
Here's the code:
Quote:<Main
ImgFile = "curse.png"
Name = "My Lord's Curse_1"
Author = "RurouniMori"
MapsFolder = "maps/"
StartMap = "mylordscurse_1.map"
StartPos = "PlayerStartArea_1"
/>
The image file is a 'png' and it's located in the same folder as the custom story folder, named "My Lord's Curse". I did try putting the image file as:
ImgFile = "My Lord's Curse/curse.png"
But it didn't work. I'm not sure what else the issue may be, and it's such a silly little problem, lol, but my brain is derping hard and drawing a blank.
Thanks to anyone who helps!
(This post was last modified: 04-04-2013, 10:50 PM by RurouniMori.)
|
|
04-04-2013, 09:52 PM |
|
NaxEla
Senior Member
Posts: 415
Threads: 5
Joined: Dec 2012
Reputation:
28
|
RE: HELP! Image, Key, and Door - Not working!
The reason why picking up the key doesn't spawn the monster, is because you put the SetEntityCallbackFunc in the EffectFlash function, which never gets called (so the callback function is never set). In your script for PracticeTwo, you put the SetEntityCallbackFunc in OnStart, which is a function that gets called when the player enters the map for the first time (the callback function is set).
I'm not really sure why your image doesn't show up, but try changing the image to a .jpg file, and see if it works then.
(This post was last modified: 04-04-2013, 11:15 PM by NaxEla.)
|
|
04-04-2013, 11:14 PM |
|
RurouniMori
Junior Member
Posts: 11
Threads: 3
Joined: Apr 2013
Reputation:
0
|
RE: HELP! Image, Key, and Door - Not working!
Ah thanks a bunch! And yes, changing the image to a jpeg did in fact help.
|
|
04-05-2013, 03:45 AM |
|
colin56
Junior Member
Posts: 3
Threads: 0
Joined: Apr 2013
Reputation:
0
|
RE: HELP! Image, Key, and Door - Not working!
The working of image, key and door can be stopped due to several reasons during this application. But this problem can be solved by refreshing and restarting the application.
Shopfronts
(This post was last modified: 04-20-2013, 05:13 AM by colin56.)
|
|
04-17-2013, 08:43 AM |
|
|