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 A simple script
z3akx Offline
Junior Member

Posts: 15
Threads: 4
Joined: Dec 2011
Reputation: 0
#1
A simple script

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
04-29-2012, 03:23 PM
Find
FragdaddyXXL Offline
Member

Posts: 136
Threads: 20
Joined: Apr 2012
Reputation: 7
#2
RE: A simple script

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);








Dark Seclusion Here
04-29-2012, 03:41 PM
Find
z3akx Offline
Junior Member

Posts: 15
Threads: 4
Joined: Dec 2011
Reputation: 0
#3
RE: A simple script

(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
04-29-2012, 04:09 PM
Find
SilentStriker Offline
Posting Freak

Posts: 950
Threads: 26
Joined: Jul 2011
Reputation: 43
#4
RE: A simple script

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



04-30-2012, 04:41 PM
Find




Users browsing this thread: 1 Guest(s)