Frictional Games Forum (read-only)
[SCRIPT] A simple script - 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] A simple script (/thread-15172.html)



A simple script - z3akx - 04-29-2012

Hi. Well i've wondered if its possible to make a script which would work as
When the player picks up the lantern notthing unusual happens, but when the player tries to use the lantern it will "brake" and say the lantern is broke and needs some repair and that the lantern is still in the inventory

I tried but i can't figure it out my self so I thought maybe someone here in the forums could help Big Grin


RE: A simple script - FragdaddyXXL - 04-29-2012

Quote:void SetLanternLitCallback(string& asCallback);
Sets the function to call when the player uses his lantern.
Callback syntax: MyFunc(bool abLit)

If you would like for them to run out of fuel:
Quote: void SetPlayerLampOil(float afOil);
Use this to set the oil to 0.0f.

Also, use this to create a breaking sound:
Quote:void PlaySoundAtEntity(string& asSoundName, string& asSoundFile, string& asEntity, float afFadeTime, bool abSaveSound);
Creates a sound on an entity.
asSoundName - internal name
asSoundFile - the sound to use + extension .snt
asEntity - the entity to create the sound at, can be “Player”
afFadeTime - time in seconds the sound needs to fade
abSaveSound - determines whether a sound should “remember” its
state. If true, the sound is never attached to the entity! Also note
that saving should on be used on looping sounds!

You could use this to prevent the user from using their lamp, even if they have spare oil in their inventory:
void SetLanternDisabled(bool abX);










RE: A simple script - z3akx - 04-29-2012

(04-29-2012, 03:41 PM)FragdaddyXXL Wrote:
Quote:void SetLanternLitCallback(string& asCallback);
Sets the function to call when the player uses his lantern.
Callback syntax: MyFunc(bool abLit)

If you would like for them to run out of fuel:
Quote: void SetPlayerLampOil(float afOil);
Use this to set the oil to 0.0f.

Also, use this to create a breaking sound:
Quote:void PlaySoundAtEntity(string& asSoundName, string& asSoundFile, string& asEntity, float afFadeTime, bool abSaveSound);
Creates a sound on an entity.
asSoundName - internal name
asSoundFile - the sound to use + extension .snt
asEntity - the entity to create the sound at, can be “Player”
afFadeTime - time in seconds the sound needs to fade
abSaveSound - determines whether a sound should “remember” its
state. If true, the sound is never attached to the entity! Also note
that saving should on be used on looping sounds!

You could use this to prevent the user from using their lamp, even if they have spare oil in their inventory:
void SetLanternDisabled(bool abX);
Thanks! You are a great man indeed Big Grin


RE: A simple script - SilentStriker - 04-30-2012

I would suggest using instead of removing the oil.
SetLanternDisabled(bool abX);
Enables/Disables the player's ability to use his lantern.