Frictional Games Forum (read-only)
[SCRIPT] Simple Memento with item - Printable Version

+- Frictional Games Forum (read-only) (https://www.frictionalgames.com/forum)
+-- Forum: Amnesia: The Dark Descent (https://www.frictionalgames.com/forum/forum-6.html)
+--- Forum: Custom Stories, TCs & Mods - Development (https://www.frictionalgames.com/forum/forum-38.html)
+---- Forum: Development Support (https://www.frictionalgames.com/forum/forum-39.html)
+---- Thread: [SCRIPT] Simple Memento with item (/thread-16711.html)

Pages: 1 2


Simple Memento with item - RedFiction12 - 07-03-2012

Hey! I am really new at coding amnesia scripts and please try to understand me.

I would like if player steps into certain area (ex. memento1), then he receives memento which tells him to find lantern. Quest completes when player finds this lamp and picks it up into his inventory.

I know this is simple to you guys, but i cant do it myself...thanks anyways if someones takes time to help me. Cheers.


RE: Simple Memento with item - Strembitsky - 07-03-2012

Use AddEntityCollideCallback, and then use the function AddQuest.


RE: Simple Memento with item - RedFiction12 - 07-03-2012

(07-03-2012, 04:58 PM)Strembitsky Wrote: Use AddEntityCollideCallback, and then use the function AddQuest.

My lantern name is "lantern_1"


Okay, so is it:


.hps

Code:
OnStart

{
        AddEntityCollideCallback("Player", "FindLantern_Quest_Area", "GetFindLanternQuest", true, 1);
        AddEntityCollideCallback("Player", "lantern_1", "FinishFindLanternQuest", true, 1);
}

void GetFindLanternQuest(string& asName, string& asNameAndTextEntry)

    {
        AddQuest("findlanternquest", "FindLanternQuest");
    }
    
void FinishFindLanternQuest(string& asName, string& asNameAndTextEntry)

    {
        CompleteQuest("findlanternquest", "FindLanternQuest");
    }
.lang

Code:
<CATEGORY Name="Journal">
        <Entry Name="Quest_FindLanternQuest_Text">Find yourself some kind of source of light</Entry>
   </CATEGORY>

, but some how its not working.


RE: Simple Memento with item - ZyLogicX - 07-03-2012

Code:
void OnStart()
{
     AddEntityCollideCallback("Player", "FindLantern_Quest_Area", "GetFindLanternQuest", true,1);
     AddEntityCollideCallback("Player", "lantern_1", "FinishFindLanternQuest", true, 1);
}

void GetFindLanternQuest(string& asName, string& asNameAndTextEntry)
    {
        AddQuest("findlanternquest", "FindLanternQuest");
    }

void FinishFindLanternQuest(string& asName, string& asNameAndTextEntry)
    {
        CompleteQuest("findlanternquest", "FindLanternQuest");
    }

That should work


RE: Simple Memento with item - RedFiction12 - 07-03-2012

(07-03-2012, 06:43 PM)ZyLogicX Wrote:
Code:
void OnStart()
{
     AddEntityCollideCallback("Player", "FindLantern_Quest_Area", "GetFindLanternQuest", true,1);
     AddEntityCollideCallback("Player", "lantern_1", "FinishFindLanternQuest", true, 1);
}

void GetFindLanternQuest(string& asName, string& asNameAndTextEntry)
    {
        AddQuest("findlanternquest", "FindLanternQuest");
    }

void FinishFindLanternQuest(string& asName, string& asNameAndTextEntry)
    {
        CompleteQuest("findlanternquest", "FindLanternQuest");
    }

That should work
I dont know what is wrong, but it dont work either.

Maybe i just copy & paste whole files.

.hps : http://pastebin.com/yf1HsKgc
.lang : http://pastebin.com/WYtXW0JF
.pictures : http://imgur.com/6Drc4,gvyXH

and !notice: i changed lantern_1 to Lantern


RE: Simple Memento with item - Mackiiboy - 07-03-2012

Use this:

Code:
void OnStart()
{
SetEntityCallbackFunc("Lantern", "FinishFindLanternQuest");
}

void FinishFindLanternQuest(string &in entity, string &in type)
{
if(type == "OnPickup")
{
CompleteQuest("findlanternquest", "FindLanternQuest");
}
}



RE: Simple Memento with item - RedFiction12 - 07-03-2012

Nope, it isnt working.


RE: Simple Memento with item - Your Computer - 07-03-2012

Are the HPS and MAP files named the same, then? If nothing here works, then i would expect that they aren't.


RE: Simple Memento with item - RedFiction12 - 07-03-2012

Yes they are. My other codes work like they should (ex. Message, MonsterFunction). It seems that i cant copy and paste correctly, bad instructions or there is no way to do it, but i think its reason number 1 so. thats why i copied everything and paste it under here, so you people can check it.


.hps :

Code:
void OnStart()
    {

        AddEntityCollideCallback("Player", "FindLantern_Quest_Area", "GetFindLanternQuest", true,1);
        SetEntityCallbackFunc("Lantern", "FinishFindLanternQuest");
        
    }

void GetFindLanternQuest(string& asName, string& asNameAndTextEntry)
    {
        AddQuest("findlanternquest", "FindLanternQuest");
    }

void FinishFindLanternQuest(string &in entity, string &in type)
    {
    if(type == "OnPickup")
        {
            CompleteQuest("findlanternquest", "FindLanternQuest");
        }
    }


.lang

Code:
<LANGUAGE>

   <CATEGORY Name="CustomStoryMain">
      <Entry Name="Description">
         Test
      </Entry>
   </CATEGORY>
  
   <CATEGORY Name="Journal">
        <Entry Name="Quest_FindLanternQuest_Text">Find yourself some kind of source light</Entry>    
   </CATEGORY>
    
   <CATEGORY Name="Messages">
        <Entry Name="Message1">"Damn its dark here...need to find some kind of light source."</Entry>    
   </CATEGORY>
  
</LANGUAGE>



RE: Simple Memento with item - Your Computer - 07-03-2012

Change:
Code:
void GetFindLanternQuest(string& asName, string& asNameAndTextEntry)

to
Code:
void GetFindLanternQuest(string&in asName, string&in asNameAndTextEntry, int state)