LucidMagic.net

Neverwinter Nights => NwN Building => Script Request => Topic started by: Daniel1975 on January 10, 2005, 05:26:54 AM

Title: on/off script for chairs/thrones
Post by: Daniel1975 on January 10, 2005, 05:26:54 AM
This is a script I made that applies an effect to a throne when the person with the correct cd-key will sit on it:

void main()
{
 object oPC = GetLastUsedBy();
 object oThrone = OBJECT_SELF;
 effect eVis = EffectVisualEffect(VFX_DUR_GLOW_YELLOW);

 if(GetIsObjectValid(oThrone)&&
   !GetIsObjectValid(GetSittingCreature(oThrone)) &&
    GetPCPublicCDKey(oPC)== "xxx")
     {
      AssignCommand(oPC, ActionSit(oThrone));
      ApplyEffectToObject(DURATION_TYPE_PERMANENT, eVis, OBJECT_SELF);
      SetLocalInt(OBJECT_SELF, "DM_No_Magic", 1);
     }
 else
  {
   string NoSit = "You are not allowed to sit on this throne!";
   FloatingTextStringOnCreature(NoSit, oPC);
  }
}


Now I think it would be more funny when the visual effect is removed again when the person moves out of the throne.
I fear I have to use a loop?? And how?  :blink:
Title: on/off script for chairs/thrones
Post by: Tea-cup on January 10, 2005, 11:49:16 AM
Quote
This is a script I made that applies an effect to a throne when the person with the correct cd-key will sit on it:

void main()
{
 object oPC = GetLastUsedBy();
 object oThrone = OBJECT_SELF;
 effect eVis = EffectVisualEffect(VFX_DUR_GLOW_YELLOW);

 if(GetIsObjectValid(oThrone)&&
   !GetIsObjectValid(GetSittingCreature(oThrone)) &&
    GetPCPublicCDKey(oPC)== "xxx")
     {
      AssignCommand(oPC, ActionSit(oThrone));
      ApplyEffectToObject(DURATION_TYPE_PERMANENT, eVis, OBJECT_SELF);
      SetLocalInt(OBJECT_SELF, "DM_No_Magic", 1);
     }
 else
  {
   string NoSit = "You are not allowed to sit on this throne!";
   FloatingTextStringOnCreature(NoSit, oPC);
  }
}


Now I think it would be more funny when the visual effect is removed again when the person moves out of the throne.
I fear I have to use a loop?? And how?  :blink:
[snapback]15211[/snapback]
You use a onbeat on your thrones anyway, add a check on it that gets the sitting creature. Check for the cdkey and apply the visual for 6 (or a bit more) seconds to it. The visual will wear off and readded as long the creature sits on it. This is prolly the easy way.

-Mel
Title: on/off script for chairs/thrones
Post by: Illutian on January 12, 2005, 03:03:25 AM
not to sound totally stupid, but which CD would u use? (i have 3 keys from each of the CDs)
Title: on/off script for chairs/thrones
Post by: Daniel1975 on January 12, 2005, 04:50:46 AM
Quote
not to sound totally stupid, but which CD would u use? (i have 3 keys from each of the CDs)
[snapback]15448[/snapback]

Hmmmm I have SOU & HOTU so I have 3 cd-keys too. But since I am not able to start the game only by using the SOU-CD or the basic NWN-CD I think checking only one CD-Key is okay for me.
And the problem is not which CD-Key to use but how to script this on and off effekt but I think I try this while loop mel posted above your post Khadgar  :D
Thanks anyway  :)
Title: on/off script for chairs/thrones
Post by: Illutian on January 13, 2005, 03:55:35 AM
ya know...you could just make portable thrones then you won't have to worry about ppl sittin in them
Title: on/off script for chairs/thrones
Post by: Daniel1975 on January 13, 2005, 04:11:07 AM
Quote
ya know...you could just make portable thrones then you won't have to worry about ppl sittin in them
[snapback]15595[/snapback]

LOL Khadgar, I am not worrieing about ppl sitting in thrones which doesn't belong to them. That's not the problem at all.
Besides, I think I'll try Mel's idea.

However thanks for your post  :D
Title: on/off script for chairs/thrones
Post by: CleTus on January 13, 2005, 10:42:18 AM
Quote
not to sound totally stupid, but which CD would u use? (i have 3 keys from each of the CDs)
[snapback]15448[/snapback]

It's your Public CD Key.. It's not a game CD key.. More like Gamespy  one I think.. I'm not sure where you find it, but it is easy enough to loo kat server logs or make a small script for the pc to say his own key or whatnot.
Title: on/off script for chairs/thrones
Post by: Soul Sojourner on January 16, 2005, 06:17:23 PM
Quote
LOL Khadgar, I am not worrieing about ppl sitting in thrones which doesn't belong to them. That's not the problem at all.
Besides, I think I'll try Mel's idea.

However thanks for your post  :D
[snapback]15599[/snapback]

I think he was being sarcastic...lol
Title: on/off script for chairs/thrones
Post by: Illutian on January 16, 2005, 11:01:26 PM
actually, no, i wasn't...NO ONE SITS ON MA THRONE!  :wacko: