Server Totals
Deglos - (9)
Mikona - (1)
Le'Or - (1)
Ferrell - (0)
Elysia - (0)
M'Chek - (0)
Underdark - (0)
Wilderness - (0)
Visimontium - (0)
Total players: 11
Gallery

Links Menu

Pull Chain for Shower

Moderators: Nighthawk4, Dungeon Masters

Pull Chain for Shower

PostAuthor: 4x4_Ender » Fri Sep 05, 2003 2:27 am

I put a shower room in my house that I designed. Now, ive figured out how to have a pull chain play the SoundObject placed in the shower using the SoundObjectPlay() command. So, when someone pulls the chain infront of it, the sound plays fine. But, I want to make it so you can turn the same SoundObject off with the same pull chain if the sound is running. Im guessing this would involve some kind of If/Then statement to determine if the sound is on or off and to apply the appropriate command. But, im not sure how to code this. Can anyone help a newbie scripter here?? :)
"Many make a trade of delusions and false miracles, deceiving the stupid multitude." -Leonardo Da Vinci
User avatar
4x4_Ender
Sage
 
Posts: 1782
Joined: Wed Jun 04, 2003 11:26 pm
Location: Woodbury, MN (GMT -6)

PostAuthor: Jordicus » Fri Sep 05, 2003 2:30 am

not sure which is more efficient / or easier, but you could either do a check to see if the sound is playing already, or you could store a true/false local variuable on the chain itself to indicate the sound status and just quesry that...
User avatar
Jordicus
Team Member; Retired with Honors
 
Posts: 8048
Joined: Tue Jan 21, 2003 3:46 pm
Location: Whitehall, PA (GMT -4)

PostAuthor: 4x4_Ender » Fri Sep 05, 2003 2:40 am

Jordicus wrote:not sure which is more efficient / or easier, but you could either do a check to see if the sound is playing already, or you could store a true/false local variuable on the chain itself to indicate the sound status and just quesry that...


Right. So how do you do that?? :?
"Many make a trade of delusions and false miracles, deceiving the stupid multitude." -Leonardo Da Vinci
User avatar
4x4_Ender
Sage
 
Posts: 1782
Joined: Wed Jun 04, 2003 11:26 pm
Location: Woodbury, MN (GMT -6)

PostAuthor: Myk D'vor » Fri Sep 05, 2003 3:07 am

Code: Select all
object chain = OBJECT_SELF;
int toggle = GetLocalInt(chain,"Shower on");
if(toggle == 0)
{ // the shower's not on, this is also the default state of the local if it was never set
    play the sound
    SetLocalInt(chain,"Shower on",TRUE);
} else {
    // shower's already on
    turn off the sound
    SetLocalInt(chain,"Shower on",FALSE);
}
Myk

Myk D'vor
Lord of Blithering Idiots
 
Posts: 111
Joined: Mon Feb 24, 2003 9:05 am

PostAuthor: 4x4_Ender » Fri Sep 05, 2003 3:39 am

Ha!! Myk, your a genius!! Now I know how to do If/Then statements using the crappy NWN scripting language. Thanks ALOT!! :)

Here is the finished script in case anyone is interested.

Code: Select all
// Placed on the OnUsed event of a Pull Chain;
// plays a sound object of dripping water created with the sound wizard

void main()
{
    object oSound = GetObjectByTag("WaterDrippingLoop1");
    object chain = OBJECT_SELF;
int toggle = GetLocalInt(chain,"Shower on");
if(toggle == 0)
{ // the shower's not on, this is also the default state of the local if it was never set
    SoundObjectPlay(oSound);
    object oPC = GetLastUsedBy();
    SendMessageToPC(oPC, "Clean water rushes over you");
    SetLocalInt(chain,"Shower on",TRUE);
}
else {
    // shower's already on
    SoundObjectStop(oSound);
    SetLocalInt(chain,"Shower on",FALSE);
}

}
"Many make a trade of delusions and false miracles, deceiving the stupid multitude." -Leonardo Da Vinci
User avatar
4x4_Ender
Sage
 
Posts: 1782
Joined: Wed Jun 04, 2003 11:26 pm
Location: Woodbury, MN (GMT -6)

PostAuthor: Fuzz » Fri Sep 05, 2003 4:13 am

Oooo... a shower...

:wink:
<Sili> I've seen septic tanks with less shit in them than Fuzz.

<Ronnin> damm not even a kiss??
<Chasmania> Kiss Fuzz? I'd rather fellate a goat.

<Chasmania> there are many roads to Rome..they just picked a shit filled alley full of scabby hookers and bums.


The shape of things to come...
User avatar
Fuzz
Elder Sage
 
Posts: 4649
Joined: Fri Jul 04, 2003 4:36 am
Location: Kayvareh

PostAuthor: Myk D'vor » Fri Sep 05, 2003 4:22 am

Wow, if that gets a 'genius', I definitely don't want to show you the special storage chests, you'd die of neural shock.

Myk

Myk D'vor
Lord of Blithering Idiots
 
Posts: 111
Joined: Mon Feb 24, 2003 9:05 am

PostAuthor: Baratin Gilden » Fri Sep 05, 2003 1:53 pm

How would you script it that a water animation decends on the shower area on the chain pull on and off?

There's a number of magical light effects that go up the way, by I've not seen one that comes down?
User avatar
Baratin Gilden
Lord of Blithering Idiots
 
Posts: 134
Joined: Wed Dec 25, 2002 6:22 pm
Location: Stirling; Scotland.

PostAuthor: Neve » Fri Sep 05, 2003 2:18 pm

"Drip" goes down =p
- As you gaze unknowingly into the seemingly infinite depths of the optics of this altogether passionate embodiment of insatiability, you experience a gradual realisation that the heavily-embellished vocabulary scattered lavishly throughout the sentence you are currently reading is indisputably nothing greater than a generous ration of masculine bovine faeces.
User avatar
Neve
Prince of Bloated Discourse
 
Posts: 192
Joined: Mon Apr 14, 2003 4:09 pm
Location: The Netherlands


Return to NWN Scripting

Who is online

Registered users: Bing [Bot], Google [Bot], Gorgon