LucidMagic.net

Neverwinter Nights => NwN Building => Script Request => Topic started by: fireknight40 on February 03, 2005, 06:07:03 PM

Title: Okay I'm having some problems...
Post by: fireknight40 on February 03, 2005, 06:07:03 PM
Uhm yeah the filter that i'm using doesn't like me if someone could check it for me and help me that would be great thank you. :)
Code: [Select]
void main()
{
    object oPC = GetEnteringObject();
    string sEnteringPC = GetPCPlayerName(oPC);
{
    object oItem;
    int nCount;

    oItem = GetFirstItemInInventory(oPC);
    while ( GetIsObjectValid(oItem) == TRUE)
{

/*Items in inventory with the following properties will be destroyed
(to allow a property listed toggle the corresponding flag [i.e. TRUE to FALSE])*/
if ((GetItemHasItemProperty(oItem, ITEM_PROPERTY_CAST_SPELL) == TRUE)
|| GetPlotFlag(oItem) == TRUE
|| GetItemHasItemProperty(oItem, ITEM_PROPERTY_ON_HIT_PROPERTIES) == TRUE
|| GetItemHasItemProperty(oItem, ITEM_PROPERTY_IMMUNITY_DAMAGE_TYPE) == TRUE
|| GetItemHasItemProperty(oItem, ITEM_PROPERTY_REGENERATION) == TRUE
|| GetItemHasItemProperty(oItem, ITEM_PROPERTY_IMMUNITY_MISCELLANEOUS) == TRUE
|| GetItemHasItemProperty(oItem, ITEM_PROPERTY_IMMUNITY_SPECIFIC_SPELL) == TRUE
|| GetItemHasItemProperty(oItem, ITEM_PROPERTY_IMMUNITY_SPELL_SCHOOL) == TRUE
|| GetItemHasItemProperty(oItem, ITEM_PROPERTY_IMMUNITY_SPELLS_BY_LEVEL) == TRUE
|| GetItemHasItemProperty(oItem, ITEM_PROPERTY_DAMAGE_VULNERABILITY) == TRUE
|| GetItemHasItemProperty(oItem, ITEM_PROPERTY_AC_BONUS_VS_ALIGNMENT_GROUP) == TRUE
|| GetItemHasItemProperty(oItem, ITEM_PROPERTY_AC_BONUS_VS_DAMAGE_TYPE) == TRUE
|| GetItemHasItemProperty(oItem, ITEM_PROPERTY_DAMAGE_VULNERABILITY) == TRUE
|| GetItemHasItemProperty(oItem, ITEM_PROPERTY_TRAP) == TRUE
|| GetItemHasItemProperty(oItem, ITEM_PROPERTY_THIEVES_TOOLS) == TRUE
|| GetItemHasItemProperty(oItem, ITEM_PROPERTY_ON_MONSTER_HIT) == TRUE
|| GetItemHasItemProperty(oItem, ITEM_PROPERTY_DECREASED_ABILITY_SCORE) == TRUE
|| GetItemHasItemProperty(oItem, ITEM_PROPERTY_DECREASED_AC) == TRUE
|| GetItemHasItemProperty(oItem, ITEM_PROPERTY_DECREASED_ATTACK_MODIFIER) == TRUE
|| GetItemHasItemProperty(oItem, ITEM_PROPERTY_DECREASED_DAMAGE) == TRUE
|| GetItemHasItemProperty(oItem, ITEM_PROPERTY_DECREASED_ENHANCEMENT_MODIFIER) == TRUE
|| GetItemHasItemProperty(oItem, ITEM_PROPERTY_DECREASED_SAVING_THROWS) == TRUE
|| GetItemHasItemProperty(oItem, ITEM_PROPERTY_DECREASED_SAVING_THROWS_SPECIFIC) == TRUE
|| GetItemHasItemProperty(oItem, ITEM_PROPERTY_DECREASED_SKILL_MODIFIER) == TRUE
|| GetItemHasItemProperty(oItem, ITEM_PROPERTY_MONSTER_DAMAGE) == TRUE
|| GetItemHasItemProperty(oItem, ITEM_PROPERTY_REGENERATION_VAMPIRIC) == TRUE
|| GetItemHasItemProperty(oItem, ITEM_PROPERTY_DAMAGE_REDUCTION) == TRUE
|| GetItemHasItemProperty(oItem, ITEM_PROPERTY_ONHITCASTSPELL)== TRUE )
|| GetItemCost(oItem, 500000)
    DestroyObject(oItem);
}
    oItem = GetNextItemInInventory(oPC);
}
    for ( nCount = 0; nCount < NUM_INVENTORY_SLOTS; nCount++ )
{
    oItem = GetItemInSlot(nCount,oPC);

/*Equipped items with the following properties will be destroyed
(to allow a property listed toggle the corresponding flag [i.e. TRUE to FALSE])*/
if ((GetItemHasItemProperty(oItem, ITEM_PROPERTY_CAST_SPELL) == TRUE)
|| GetPlotFlag(oItem) == TRUE
|| GetItemHasItemProperty(oItem, ITEM_PROPERTY_ON_HIT_PROPERTIES) == TRUE
|| GetItemHasItemProperty(oItem, ITEM_PROPERTY_IMMUNITY_DAMAGE_TYPE) == TRUE
|| GetItemHasItemProperty(oItem, ITEM_PROPERTY_REGENERATION) == TRUE
|| GetItemHasItemProperty(oItem, ITEM_PROPERTY_IMMUNITY_MISCELLANEOUS) == TRUE
|| GetItemHasItemProperty(oItem, ITEM_PROPERTY_IMMUNITY_SPECIFIC_SPELL) == TRUE
|| GetItemHasItemProperty(oItem, ITEM_PROPERTY_IMMUNITY_SPELL_SCHOOL) == TRUE
|| GetItemHasItemProperty(oItem, ITEM_PROPERTY_IMMUNITY_SPELLS_BY_LEVEL) == TRUE
|| GetItemHasItemProperty(oItem, ITEM_PROPERTY_DAMAGE_VULNERABILITY) == TRUE
|| GetItemHasItemProperty(oItem, ITEM_PROPERTY_AC_BONUS_VS_ALIGNMENT_GROUP) == TRUE
|| GetItemHasItemProperty(oItem, ITEM_PROPERTY_AC_BONUS_VS_DAMAGE_TYPE) == TRUE
|| GetItemHasItemProperty(oItem, ITEM_PROPERTY_DAMAGE_VULNERABILITY) == TRUE
|| GetItemHasItemProperty(oItem, ITEM_PROPERTY_TRAP) == TRUE
|| GetItemHasItemProperty(oItem, ITEM_PROPERTY_THIEVES_TOOLS) == TRUE
|| GetItemHasItemProperty(oItem, ITEM_PROPERTY_REGENERATION_VAMPIRIC) == TRUE
|| GetItemHasItemProperty(oItem, ITEM_PROPERTY_ON_MONSTER_HIT) == TRUE
|| GetItemHasItemProperty(oItem, ITEM_PROPERTY_MONSTER_DAMAGE) == TRUE
|| GetItemHasItemProperty(oItem, ITEM_PROPERTY_DAMAGE_REDUCTION) == TRUE
|| GetItemHasItemProperty(oItem, ITEM_PROPERTY_ONHITCASTSPELL)== TRUE
|| GetItemHasItemProperty(oItem, ITEM_PROPERTY_DECREASED_ABILITY_SCORE) == TRUE
|| GetItemHasItemProperty(oItem, ITEM_PROPERTY_DECREASED_AC) == TRUE
|| GetItemHasItemProperty(oItem, ITEM_PROPERTY_DECREASED_ATTACK_MODIFIER) == TRUE
|| GetItemHasItemProperty(oItem, ITEM_PROPERTY_DECREASED_DAMAGE) == TRUE
|| GetItemHasItemProperty(oItem, ITEM_PROPERTY_DECREASED_ENHANCEMENT_MODIFIER) == TRUE
|| GetItemHasItemProperty(oItem, ITEM_PROPERTY_DECREASED_SAVING_THROWS) == TRUE
|| GetItemHasItemProperty(oItem, ITEM_PROPERTY_DECREASED_SAVING_THROWS_SPECIFIC) == TRUE
|| GetItemHasItemProperty(oItem, ITEM_PROPERTY_DECREASED_SKILL_MODIFIER) == TRUE )
{
    DestroyObject(oItem);
}
    if(GetPlotFlag(oPC) == TRUE)
{
    SetPlotFlag(oPC,FALSE);
}
}
}
}
Okay that's on my OnClientEnter by the way.
Also having a few problems with my thrones... here's the code i'm using now...
Code: [Select]
void main()
{
 object oPC = GetLastUsedBy();
 object oThrone = OBJECT_SELF;
// place the effect you want to apply to the throne in brackets
effect eVis = EffectVisualEffect(VFX_DUR_GLOW_GREEN);
// this will prevent the effect from being dispelled
         eVis = SupernaturalEffect(eVis);

 if(GetIsObjectValid(oThrone)&&
   !GetIsObjectValid(GetSittingCreature(oThrone)) &&
    GetPCPlayerName(oPC)== "fireknight40")
     {
      AssignCommand(oPC, ActionSit(oThrone));
      ApplyEffectToObject(DURATION_TYPE_PERMANENT, eVis, OBJECT_SELF);
     }
 else
  {
   string NoSit = "You are not allowed to sit on this throne! It belongs to
Brior!";
   FloatingTextStringOnCreature(NoSit, oPC);
  }
}

That's on the on used by the way. I want it so only that person can sit in it unfortunately i can't seem to get the public CD key fetcher to work so i'm trying t use the account name. Thanks again. :)
Title: Okay I'm having some problems...
Post by: CleTus on February 03, 2005, 08:47:21 PM
What happens on each of the scripts? Does the throne let you or anyone else sit? Does the filter not function at all?
Title: Okay I'm having some problems...
Post by: fireknight40 on February 03, 2005, 08:59:42 PM
filter destroys things it shouldn't and the thrones won't let anyone sit
Title: Okay I'm having some problems...
Post by: CleTus on February 03, 2005, 09:13:40 PM
Right for the Throne script does it compile? I copied it into compiler and it sayed Undertimened string constant. if it says that for you just move the whole NoSit string so it's 1 line. Maybe for the throne try this. GetPCPublicCdKey.

Code: [Select]
void main()
{
object oPC = GetLastUsedBy();
object oThrone = OBJECT_SELF;
// place the effect you want to apply to the throne in brackets
effect eVis = EffectVisualEffect(VFX_DUR_GLOW_GREEN);
// this will prevent the effect from being dispelled
        eVis = SupernaturalEffect(eVis);

if(GetPCPublicCDKey(oPC)== "Your Key Here")
  
    {
     AssignCommand(oPC, ActionSit(oThrone));
     ApplyEffectToObject(DURATION_TYPE_PERMANENT, eVis, OBJECT_SELF);
    }
else
 {
  string NoSit = "You are not allowed to sit on this throne! It belongs to Brior!";
  FloatingTextStringOnCreature(NoSit, oPC);
 }
}

I took out the IF Valid parts. I don't think they're really needed as you are the only one allowed to click the throne so you're always valid. Right?

Anyways for the filter.. I have no idea.. Let me look again.
Title: Okay I'm having some problems...
Post by: CleTus on February 03, 2005, 10:00:44 PM
Quote
filter destroys things it shouldn't and the thrones won't let anyone sit
[snapback]17793[/snapback]

The filter will not compile because GetCost is not a valid function. It's GetGoldPieceValue. I'm pretty sure you edited that in to Toki's Filter, right? I'm not sure how to edit filters. I've never made one before. Maybe Mel could help?
Title: Okay I'm having some problems...
Post by: Soul Sojourner on February 03, 2005, 10:11:15 PM
Hmm.. for the throne, try this perhaps...

Code: [Select]
void main()
{
object oPC = GetLastUsedBy();
object oThrone = OBJECT_SELF;
effect eVis = EffectVisualEffect(VFX_DUR_GLOW_GREEN);
eVis = SupernaturalEffect(eVis);

if(GetIsObjectValid(oThrone)&&
!GetIsObjectValid(GetSittingCreature(oThrone)) &&
GetPCPublicCDKey(oPC)== "Your CD key")
{
AssignCommand(oPC, ActionSit(oThrone));
ApplyEffectToObject(DURATION_TYPE_PERMANENT, eVis, OBJECT_SELF);
}
else
{
string NoSit = "You are not allowed to sit on this throne! It belongs to Brior!";
FloatingTextStringOnCreature(NoSit, oPC);
}
}
Title: Okay I'm having some problems...
Post by: fireknight40 on February 03, 2005, 10:45:03 PM
Public CD key doesn't like me... can that be done via account name?
Title: Okay I'm having some problems...
Post by: CleTus on February 03, 2005, 10:55:02 PM
Hell, your's looks the same as the other one. Did you just take out the /// comments and put the lines to the edge? Anyways yeah brior, you can use acc name. just replace the get cd key to GetPlayerName like you had.
I'm going to test this now and see if it works.

EDIT Yeah it works now. Though the green effect does not go away. You want it like that?
Title: Okay I'm having some problems...
Post by: Soul Sojourner on February 03, 2005, 10:59:37 PM
No, it's not the same, basically the only difference is this:

if(GetIsObjectValid(oThrone)&&
!GetIsObjectValid(GetSittingCreature(oThrone)) &&
GetPCPublicCDKey(oPC)== "Your CD key")

I tested the script I posted, an' it works just fine, so you should'nt have a problem.
Title: Okay I'm having some problems...
Post by: Daniel1975 on February 04, 2005, 07:10:13 PM
LOL that's funny!

He's posting scripts here which he got from me ;) (like many others)  :D
I already explained him how to use them  :P