Frictional Games Forum (read-only)
Anyone Need Help? (Thread #2) - 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)
+--- Thread: Anyone Need Help? (Thread #2) (/thread-9306.html)

Pages: 1 2 3 4 5


RE: Anyone Need Help? (Thread #2) - zecuro - 07-24-2011

(07-22-2011, 05:25 PM)Kyle Wrote: This thread has been made by me to help anyone who needs to ask a question mostly about scripting. Smile

Also it could help people by those who are looking for some can easily find an active thread that shall be cluttered with people's questions and answers to keep people from painfully have to go through the 100-some pages of threads. Big Grin

Ask away! Wink

yes it would be awesome if you coulg teach me a trick or 2 for basic scripting


RE: Anyone Need Help? (Thread #2) - Kyle - 07-25-2011

(07-24-2011, 11:14 PM)zecuro Wrote: yes it would be awesome if you coulg teach me a trick or 2 for basic scripting

I can really explain something if it is a specific thing you wish to know or understand. Smile


RE: Anyone Need Help? (Thread #2) - zecuro - 07-25-2011

(07-25-2011, 12:58 AM)Kyle Wrote:
(07-24-2011, 11:14 PM)zecuro Wrote: yes it would be awesome if you coulg teach me a trick or 2 for basic scripting

I can really explain something if it is a specific thing you wish to know or understand. Smile

actually about note and key to open door and basic stuff like that i'm really new to this i have a lot of potentional in drawing so i came up with prettty good visual concept but without script......you cant really create a storyline so plz help

sorry for my bad english



RE: Anyone Need Help? (Thread #2) - Kyle - 07-25-2011

(07-25-2011, 07:10 PM)zecuro Wrote: actually about note and key to open door and basic stuff like that i'm really new to this i have a lot of potentional in drawing so i came up with prettty good visual concept but without script......you cant really create a storyline so plz help

sorry for my bad english

For a custom story to run you need a .hps file with the same name as each map you have for your custom story. Meaning, for example, your map is called "MapName.map", then there will be a file in the same folder called "MapName.hps" that the modder has to make by themselves which then holds all the scripting information about that map.

This is needed for the most simple .hps script file to have the custom story successfully run the map:

Code:
void OnStart()
{

}

To unlock a door with a key, you can do this:

Code:
void OnStart()
{
    AddUseItemCallback("", "Key01", "Door01", "DoorUnlock", true);
}
void DoorUnlock(string &in asItem, string &in asEntity)
{
    SetSwingDoorLocked(asEntity, false, true);
    PlaySoundAtEntity("", "unlock_door.snt", asEntity, 0, false);
    RemoveItem(asItem);
}

The code above unlocks swing doors (doors that the player can open with his hand). "Key01" is the name of the key that unlocks the door. "Door01" is the name of the door the key unlocks. "DoorUnlock" is the name of the function where once it's called unlocks the door, which is the entity. It plays the sound at the door. And it removes the key that unlocks the door.


RE: Anyone Need Help? (Thread #2) - zecuro - 07-25-2011

(07-25-2011, 08:50 PM)Kyle Wrote:
(07-25-2011, 07:10 PM)zecuro Wrote: actually about note and key to open door and basic stuff like that i'm really new to this i have a lot of potentional in drawing so i came up with prettty good visual concept but without script......you cant really create a storyline so plz help

sorry for my bad english

For a custom story to run you need a .hps file with the same name as each map you have for your custom story. Meaning, for example, your map is called "MapName.map", then there will be a file in the same folder called "MapName.hps" that the modder has to make by themselves which then holds all the scripting information about that map.

This is needed for the most simple .hps script file to have the custom story successfully run the map:

Code:
void OnStart()
{

}

To unlock a door with a key, you can do this:

Code:
void OnStart()
{
    AddUseItemCallback("", "Key01", "Door01", "DoorUnlock", true);
}
void DoorUnlock(string &in asItem, string &in asEntity)
{
    SetSwingDoorLocked(asEntity, false, true);
    PlaySoundAtEntity("", "unlock_door.snt", asEntity, 0, false);
    RemoveItem(asItem);
}

The code above unlocks swing doors (doors that the player can open with his hand). "Key01" is the name of the key that unlocks the door. "Door01" is the name of the door the key unlocks. "DoorUnlock" is the name of the function where once it's called unlocks the door, which is the entity. It plays the sound at the door. And it removes the key that unlocks the door.

thanks you so much last little question when i start the game i got a message like this
fatal error:could not load script file
custom stories/priest/maps/ch00/third test.hps'!
main (1, 1):unexpected token'('
link to the scrpt:http://www.mediafire.com/?f8wn3jxbze7ygz3


RE: Anyone Need Help? (Thread #2) - Kyle - 07-25-2011

(07-25-2011, 09:29 PM)zecuro Wrote: thanks you so much last little question when i start the game i got a message like this
fatal error:could not load script file
custom stories/priest/maps/ch00/third test.hps'!
main (1, 1):unexpected token'('
link to the scrpt:http://www.mediafire.com/?f8wn3jxbze7ygz3

Please just copy your script and paste it right here in the reply box. Smile

It's much more easier to look at that doesn't include any sort of download.


RE: Anyone Need Help? (Thread #2) - zecuro - 07-25-2011

(07-25-2011, 09:44 PM)Kyle Wrote:
(07-25-2011, 09:29 PM)zecuro Wrote: thanks you so much last little question when i start the game i got a message like this
fatal error:could not load script file
custom stories/priest/maps/ch00/third test.hps'!
main (1, 1):unexpected token'('
link to the scrpt:http://www.mediafire.com/?f8wn3jxbze7ygz3

Please just copy your script and paste it right here in the reply box. Smile

It's much more easier to look at that doesn't include any sort of download.
void OnStart()
{
FadeOut(0);
FadeIn(20);
FadeImageTrailTo(2, 2);
FadeSepiaColorTo(100, 4);
SetPlayerActive(false);
FadePlayerRollTo(50, 220, 220);
FadeRadialBlurTo(0.15, 2);
SetPlayerCrouching(true);
AddTimer("trig1", 7.0f, "beginStory");
}

void beginStory(string &in asTimer)
{
ChangePlayerStateToNormal();
SetPlayerActive(true);
FadePlayerRollTo(0, 33, 33);
FadeRadialBlurTo(0.0, 1);
FadeSepiaColorTo(0, 4);
SetPlayerCrouching(false);
FadeImageTrailTo(0,1);
}


RE: Anyone Need Help? (Thread #2) - Kyle - 07-25-2011

Try this:

Code:
void OnStart()
{
    FadeOut(0);
    FadeIn(20);
    FadeImageTrailTo(2, 2);
    FadeSepiaColorTo(100, 4);
    SetPlayerActive(false);
    FadePlayerRollTo(50, 220, 220);
    FadeRadialBlurTo(0.15, 2);
    SetPlayerCrouching(true);
    AddTimer("", 7, "beginStory");
}
void beginStory(string &in asTimer)
{
    ChangePlayerStateToNormal();
    SetPlayerActive(true);
    FadePlayerRollTo(0, 33, 33);
    FadeRadialBlurTo(0, 1);
    FadeSepiaColorTo(0, 4);
    SetPlayerCrouching(false);
    FadeImageTrailTo(0, 1);
}



RE: Anyone Need Help? (Thread #2) - zecuro - 07-25-2011

(07-25-2011, 10:49 PM)Kyle Wrote: Try this:

Code:
void OnStart()
{
    FadeOut(0);
    FadeIn(20);
    FadeImageTrailTo(2, 2);
    FadeSepiaColorTo(100, 4);
    SetPlayerActive(false);
    FadePlayerRollTo(50, 220, 220);
    FadeRadialBlurTo(0.15, 2);
    SetPlayerCrouching(true);
    AddTimer("", 7, "beginStory");
}
void beginStory(string &in asTimer)
{
    ChangePlayerStateToNormal();
    SetPlayerActive(true);
    FadePlayerRollTo(0, 33, 33);
    FadeRadialBlurTo(0, 1);
    FadeSepiaColorTo(0, 4);
    SetPlayerCrouching(false);
    FadeImageTrailTo(0, 1);
}
still dosen't work...



RE: Anyone Need Help? (Thread #2) - Kyle - 07-25-2011

Code:
void OnStart()
{
    FadeOut(0);
    FadeIn(20);
    FadeImageTrailTo(2, 2);
    FadeSepiaColorTo(100, 4);
    SetPlayerActive(false);
    FadePlayerRollTo(50, 220, 220);
    FadeRadialBlurTo(0.15, 2);
    SetPlayerCrouching(true);
    AddTimer("", 7, "beginStory");
}
void beginStory(string &in asTimer)
{
    ChangePlayerStateToNormal();
    SetPlayerActive(true);
    FadePlayerRollTo(0, 33, 33);
    FadeRadialBlurTo(0, 1);
    FadeSepiaColorTo(0, 4);
    SetPlayerCrouching(false);
    FadeImageTrailTo(0, 1);
}
void OnEnter()
{
}
void OnLeave()
{
}

Maybe now?