Author Topic: on/off script for chairs/thrones  (Read 8223 times)

Offline Daniel1975

  • Full Member
  • ***
  • Posts: 170
    • View Profile
    • http://
    • Email
on/off script for chairs/thrones
« 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:
G[/span][span style=\'color:orange\']w[/span][span style=\'color:yellow\']y[/span][span style=\'color:green\']d[/span][span style=\'color:blue\']i[/span][span style=\'color:purple\']on[/span] - Slann [span style=\'color:red\']Lord[/span] of the [span style=\'color:green\']Antediluvians

Offline Tea-cup

  • Hero Member
  • *****
  • Posts: 916
    • View Profile
on/off script for chairs/thrones
« Reply #1 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

Offline Illutian

  • Who knows what evil lurks in the hearts of Man...
  • Hero Member
  • *****
  • Posts: 891
  • The Legend Begins...
    • View Profile
    • Illutian
    • Email
on/off script for chairs/thrones
« Reply #2 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)
Our greatest glory is not in never falling but in rising everytime we fall.

Offline Daniel1975

  • Full Member
  • ***
  • Posts: 170
    • View Profile
    • http://
    • Email
on/off script for chairs/thrones
« Reply #3 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  :)
G[/span][span style=\'color:orange\']w[/span][span style=\'color:yellow\']y[/span][span style=\'color:green\']d[/span][span style=\'color:blue\']i[/span][span style=\'color:purple\']on[/span] - Slann [span style=\'color:red\']Lord[/span] of the [span style=\'color:green\']Antediluvians

Offline Illutian

  • Who knows what evil lurks in the hearts of Man...
  • Hero Member
  • *****
  • Posts: 891
  • The Legend Begins...
    • View Profile
    • Illutian
    • Email
on/off script for chairs/thrones
« Reply #4 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
Our greatest glory is not in never falling but in rising everytime we fall.

Offline Daniel1975

  • Full Member
  • ***
  • Posts: 170
    • View Profile
    • http://
    • Email
on/off script for chairs/thrones
« Reply #5 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
G[/span][span style=\'color:orange\']w[/span][span style=\'color:yellow\']y[/span][span style=\'color:green\']d[/span][span style=\'color:blue\']i[/span][span style=\'color:purple\']on[/span] - Slann [span style=\'color:red\']Lord[/span] of the [span style=\'color:green\']Antediluvians

Offline CleTus

  • Full Member
  • ***
  • Posts: 234
    • View Profile
    • http://
on/off script for chairs/thrones
« Reply #6 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.
GIT-R-DONE!

Light travels faster than sound. That is why some people appear bright until you hear them speak.

Offline Soul Sojourner

  • Resident Awesome
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2748
  • Nothing is true; everything is permitted.
    • View Profile
    • Email
on/off script for chairs/thrones
« Reply #7 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

Offline Illutian

  • Who knows what evil lurks in the hearts of Man...
  • Hero Member
  • *****
  • Posts: 891
  • The Legend Begins...
    • View Profile
    • Illutian
    • Email
on/off script for chairs/thrones
« Reply #8 on: January 16, 2005, 11:01:26 PM »
actually, no, i wasn't...NO ONE SITS ON MA THRONE!  :wacko:
Our greatest glory is not in never falling but in rising everytime we fall.