Facebook Twitter YouTube Frictional Games | Forum | Newsletter | Dev Blog | Dev Wiki | Support


Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Script Help A simple script
Author Message
z3akx Offline
Junior Member

Posts: 15
Joined: Dec 2011
Reputation: 0
Post: #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 all posts by this user Quote this message in a reply
FragdaddyXXL Offline
Member

Posts: 136
Joined: Apr 2012
Reputation: 7
Post: #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 all posts by this user Quote this message in a reply
z3akx Offline
Junior Member

Posts: 15
Joined: Dec 2011
Reputation: 0
Post: #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 all posts by this user Quote this message in a reply
SilentStriker Offline
Posting Freak

Posts: 950
Joined: Jul 2011
Reputation: 42
Post: #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 all posts by this user Quote this message in a reply
Post Reply 




User(s) browsing this thread: