Author Topic: Can anyone point me to a script or utility that removes/merges items from players on log in?  (Read 2195 times)

Legacy_FunkySwerve

  • Hero Member
  • *****
  • Posts: 2325
  • Karma: +0/-0


               Yes, you could modify that script, or make one like GoGs. If you're going to do a full-reset on the items, something simple like GoG's might be just the trick, since you will have a low number of resrefs to check against to start (none). The initial update is easy enough - you just cycle and replace all their items one by one; the only difficulty is making sure it only happens once - some kind of persistent variable on the pc is probably best for that (one other option being one Version var per item, but that would greatly increase bic size and therefore servervault size - much better to have the default Version be 0, with no int on the item needing to be set). You could also set some kind of marker in the bic file itself - we do pc versioning very similar to item versioning tracking tag and unique id in the bic's tag field (accomplishable via either nwnx_letoscript or nwnx_funcs). Other unused fields are available, as well, like BodyBag.

The only thing our script really needs nwnx for is the hashset plugin. Here's the primer script, if you're curious. It holds all the item update info from all the items we've changed (some of them have up to version 6 from repeated editing/updating). You don't need to store this stuff in a hash, you can easily hold it in a function as GoG's version does.

(this runs from modload to load up the hashset)

#include "hg_inc"

/* All item updates performed are logged; grep for UPDATEITEMS in the
 * server log. */

void main () {
    object oMod = GetModule();

    if (HashSetValid(oMod, "UpdateItems"))
        return;

    HashSetCreate(oMod, "UpdateItems");
    HashSetCreate(oMod, "UpdateItemRes");
    HashSetCreate(oMod, "UpdateItemVer");
    HashSetCreate(oMod, "UpdateItemSingleton");

    /* update Rings of the Planar Traveler */
    HashSetSetLocalString(oMod, "UpdateItemRes", "galadriemsign001", "multi_signet");
    HashSetSetLocalInt(oMod, "UpdateItemVer", "multi_signet", 4);

    /* destroy old combat autocasters, End Shapestrong Rage, Way of the Staff, Greater Smite */
    HashSetSetLocalString(oMod, "UpdateItemRes", "combatcaster",     "DESTROY");
    HashSetSetLocalString(oMod, "UpdateItemRes", "barbshape001",     "DESTROY");
    HashSetSetLocalString(oMod, "UpdateItemRes", "qc_waystaff",      "DESTROY");
    HashSetSetLocalString(oMod, "UpdateItemRes", "fa_greatersmite",  "DESTROY");
    HashSetSetLocalString(oMod, "UpdateItemRes", "smiteabilitypala", "DESTROY");
    HashSetSetLocalString(oMod, "UpdateItemRes", "ca_rdd_buffet", "DESTROY");
    HashSetSetLocalString(oMod, "UpdateItemRes", "ca_rdd_fearaura", "DESTROY");

    /* destroy Brena's Magic Tulip */
    HashSetSetLocalString(oMod, "UpdateItemRes", "magictulip", "DESTROY");

    /* destroy unslagged BBoDs */
    HashSetSetLocalString(oMod, "UpdateItemRes", "x2_it_wpblkblade", "DESTROY");

    /* destroy tournament points, gems, and wands */
    HashSetSetLocalString(oMod, "UpdateItemRes", "newssithrgem",     "DESTROY");
    HashSetSetLocalString(oMod, "UpdateItemRes", "setteam1wand",     "DESTROY");
    HashSetSetLocalString(oMod, "UpdateItemRes", "setteam2wand",     "DESTROY");
    HashSetSetLocalString(oMod, "UpdateItemRes", "setteam3wand",     "DESTROY");
    HashSetSetLocalString(oMod, "UpdateItemRes", "setteam4wand",     "DESTROY");

    /* destroy old pet givers */
    HashSetSetLocalString(oMod, "UpdateItemRes", "bottlebehold",     "DESTROY");
    HashSetSetLocalString(oMod, "UpdateItemRes", "summonhook",       "DESTROY");
    HashSetSetLocalString(oMod, "UpdateItemRes", "summonbuddy",      "DESTROY");
    HashSetSetLocalString(oMod, "UpdateItemRes", "summonsaga",       "DESTROY");
    HashSetSetLocalString(oMod, "UpdateItemRes", "summonguardian",   "DESTROY");
    HashSetSetLocalString(oMod, "UpdateItemRes", "diamongsfetchtoy", "DESTROY");
    HashSetSetLocalString(oMod, "UpdateItemRes", "scalpel1",         "DESTROY");
    HashSetSetLocalString(oMod, "UpdateItemRes", "goobaby",          "DESTROY");

    /* destroy old trap maker traps and refund their cost, and replace old trap makers */
    HashSetSetLocalString(oMod, "UpdateItemRes", "ct0001",           "#5000");
    HashSetSetLocalString(oMod, "UpdateItemRes", "ct0002",           "#5000");
    HashSetSetLocalString(oMod, "UpdateItemRes", "ct0003",           "#5000");
    HashSetSetLocalString(oMod, "UpdateItemRes", "ct0004",           "#5000");
    HashSetSetLocalString(oMod, "UpdateItemRes", "ct0005",           "#5000");
    HashSetSetLocalString(oMod, "UpdateItemRes", "ct0006",           "#150000");
    HashSetSetLocalString(oMod, "UpdateItemRes", "ct0007",           "#150000");
    HashSetSetLocalString(oMod, "UpdateItemRes", "ct0008",           "#150000");
    HashSetSetLocalString(oMod, "UpdateItemRes", "ct0009",           "#150000");
    HashSetSetLocalString(oMod, "UpdateItemRes", "ct0010",           "#150000");
    HashSetSetLocalString(oMod, "UpdateItemRes", "ct0011",           "#150000");
    HashSetSetLocalString(oMod, "UpdateItemRes", "ct0012",           "#150000");
    HashSetSetLocalString(oMod, "UpdateItemRes", "ct0013",           "#150000");
    HashSetSetLocalString(oMod, "UpdateItemRes", "ct0014",           "#150000");
    HashSetSetLocalString(oMod, "UpdateItemRes", "ct0014",           "#150000");
    HashSetSetLocalString(oMod, "UpdateItemRes", "trapkitmkr001",    "hgt_maker_17");   /* Cold         */
    HashSetSetLocalString(oMod, "UpdateItemRes", "trapkitmkr002",    "hgt_maker_4");    /* Fire         */
    HashSetSetLocalString(oMod, "UpdateItemRes", "trapkitmkr003",    "hgt_maker_3");    /* Acid         */
    HashSetSetLocalString(oMod, "UpdateItemRes", "trapkitmkr004",    "hgt_maker_5");    /* Elec         */
    HashSetSetLocalString(oMod, "UpdateItemRes", "trapkitmkr005",    "hgt_maker_18");   /* Sonic        */
    HashSetSetLocalString(oMod, "UpdateItemRes", "trapkitmkr006",    "hgt_maker_21");   /* Negative     */
    HashSetSetLocalString(oMod, "UpdateItemRes", "trapkitmkr007",    "hgt_maker_22");   /* Positive     */
    HashSetSetLocalString(oMod, "UpdateItemRes", "trapkitmkr008",    "hgt_maker_19");   /* Divine       */
    HashSetSetLocalString(oMod, "UpdateItemRes", "trapkitmkr009",    "hgt_maker_20");   /* Magical      */

    /* replace old artifact/class/feat/race/skill abilities */
    HashSetSetLocalString(oMod, "UpdateItemRes", "assassinscabbard", "ca_asn_scabbard");
    HashSetSetLocalString(oMod, "UpdateItemRes", "barbshape",        "ca_bbn_shape");
    HashSetSetLocalString(oMod, "UpdateItemRes", "blessingofmidnig", "aa_spellpen");
    HashSetSetLocalString(oMod, "UpdateItemRes", "bs_stillsound",    "ca_brd_stillsnd");
    HashSetSetLocalString(oMod, "UpdateItemRes", "cot_auraofglory",  "ca_dc_nimvictory");
    HashSetSetLocalString(oMod, "UpdateItemRes", "defensiveshieldd", "ca_dwd_defense");
    HashSetSetLocalString(oMod, "UpdateItemRes", "dragonorbbreath",  "aa_con");
    HashSetSetLocalString(oMod, "UpdateItemRes", "gemofcalling",     "fa_sum_dragon");
    HashSetSetLocalString(oMod, "UpdateItemRes", "gemofcalling001",  "fa_sum_fiend");
    HashSetSetLocalString(oMod, "UpdateItemRes", "gemofcalling002",  "fa_sum_shadow");
    HashSetSetLocalString(oMod, "UpdateItemRes", "gemofcalling003",  "fa_sum_mummy");
    HashSetSetLocalString(oMod, "UpdateItemRes", "gemofcalling004",  "fa_sum_dracolich");
    HashSetSetLocalString(oMod, "UpdateItemRes", "greaterdisarm",    "ca_ftr_g_disarm");
    HashSetSetLocalString(oMod, "UpdateItemRes", "greaterknockdown", "ca_ftr_g_kd");
    HashSetSetLocalString(oMod, "UpdateItemRes", "greaterparry",     "ca_ftr_g_parry");
    HashSetSetLocalString(oMod, "UpdateItemRes", "guardianangel",    "ca_pal_grdangel");
    HashSetSetLocalString(oMod, "UpdateItemRes", "jewelofevernight", "ca_bg_evernight");
    HashSetSetLocalString(oMod, "UpdateItemRes", "kireflection",     "ca_wm_kireflect");
    HashSetSetLocalString(oMod, "UpdateItemRes", "lichsong",         "ca_pm_lichsong");
    HashSetSetLocalString(oMod, "UpdateItemRes", "massresurrection", "ca_clr_massrez");
    HashSetSetLocalString(oMod, "UpdateItemRes", "massvamptouch",    "ca_pm_lifeblight");
    HashSetSetLocalString(oMod, "UpdateItemRes", "palemoonlight",    "aa_speed");
    HashSetSetLocalString(oMod, "UpdateItemRes", "pipesofgeshtak",   "ca_brd_lichlyr");
    HashSetSetLocalString(oMod, "UpdateItemRes", "pm_soulgem",       "ca_pm_soulgem");
    HashSetSetLocalString(oMod, "UpdateItemRes", "pyramidhp",        "aa_wis");
    HashSetSetLocalString(oMod, "UpdateItemRes", "rddaura",          "ca_rdd_fearaura");
    HashSetSetLocalString(oMod, "UpdateItemRes", "rddbuffet",        "ca_rdd_buffet");
    HashSetSetLocalString(oMod, "UpdateItemRes", "shadowdecoy",      "ca_sd_decoy");
    HashSetSetLocalString(oMod, "UpdateItemRes", "shadowrift",       "ca_sd_rift");
    HashSetSetLocalString(oMod, "UpdateItemRes", "stoneoftheearthm", "sa_animalemp");
    HashSetSetLocalString(oMod, "UpdateItemRes", "sunefireshield",   "aa_cha");
    HashSetSetLocalString(oMod, "UpdateItemRes", "thewayofthes",     "qc_waystaff");
    HashSetSetLocalString(oMod, "UpdateItemRes", "treantshrink",     "ra_treant_shrink");
    HashSetSetLocalString(oMod, "UpdateItemRes", "tymorasluck",      "aa_saves");
    HashSetSetLocalString(oMod, "UpdateItemRes", "vecnadeathtouch",  "aa_str");
    HashSetSetLocalString(oMod, "UpdateItemRes", "vecnadominate",    "aa_int");
    HashSetSetLocalString(oMod, "UpdateItemRes", "vhaerundarkness",  "aa_dex");
    HashSetSetLocalString(oMod, "UpdateItemRes", "warriorswhetst",   "ca_ftr_whetstone");

    /* destroy old legendary XP trackers and empty skins */
    HashSetSetLocalString(oMod, "UpdateItemRes", "legendaryxptrack", "DESTROY");
    HashSetSetLocalString(oMod, "UpdateItemRes", "x2_it_emptyskin",  "DESTROY");

    /* destroy old Abyss plot items */
    HashSetSetLocalString(oMod, "UpdateItemRes", "aby_plot1",        "DESTROY");
    HashSetSetLocalString(oMod, "UpdateItemRes", "aby_plot2",        "DESTROY");
    HashSetSetLocalString(oMod, "UpdateItemRes", "aby_plot3",        "DESTROY");
    HashSetSetLocalString(oMod, "UpdateItemRes", "aby_plot4",        "DESTROY");
    HashSetSetLocalString(oMod, "UpdateItemRes", "aby_plot5",        "DESTROY");
    HashSetSetLocalString(oMod, "UpdateItemRes", "aby_relic",        "aby_vestige");

    /* replace old guild activators and AC dropper */
    HashSetSetLocalInt(oMod, "UpdateItemVer", "dropacguild", 3);
    HashSetSetLocalInt(oMod, "UpdateItemVer", "activatorguild1", 2);
    HashSetSetLocalInt(oMod, "UpdateItemVer", "activatorguild2", 2);
    HashSetSetLocalInt(oMod, "UpdateItemVer", "activatorguild3", 2);
    HashSetSetLocalInt(oMod, "UpdateItemVer", "activatorguild4", 2);
    HashSetSetLocalInt(oMod, "UpdateItemVer", "activatorguild5", 2);
    HashSetSetLocalInt(oMod, "UpdateItemVer", "activatorguild6", 2);
    HashSetSetLocalInt(oMod, "UpdateItemVer", "activatorguild7", 2);
    HashSetSetLocalInt(oMod, "UpdateItemVer", "activatorguild8", 2);
    HashSetSetLocalInt(oMod, "UpdateItemVer", "activatorguild9", 2);
    HashSetSetLocalInt(oMod, "UpdateItemVer", "activatorguil003", 2);
    HashSetSetLocalString(oMod, "UpdateItemRes", "activatorguil004", "activatorguil003");

    /* replace old race books, feat books, and level books */
    HashSetSetLocalInt(oMod, "UpdateItemVer", "libramofgolden", 2);
    HashSetSetLocalInt(oMod, "UpdateItemVer", "libramofineffabl", 2);
    HashSetSetLocalInt(oMod, "UpdateItemVer", "libramofsilverli", 2);
    HashSetSetLocalInt(oMod, "UpdateItemVer", "featbk_esf_abjur", 2);
    HashSetSetLocalInt(oMod, "UpdateItemVer", "featbk_esf_conj", 2);
    HashSetSetLocalInt(oMod, "UpdateItemVer", "featbk_esf_div", 2);
    HashSetSetLocalInt(oMod, "UpdateItemVer", "featbk_esf_ench", 2);
    HashSetSetLocalInt(oMod, "UpdateItemVer", "featbk_esf_evo", 2);
    HashSetSetLocalInt(oMod, "UpdateItemVer", "featbk_esf_illus", 2);
    HashSetSetLocalInt(oMod, "UpdateItemVer", "featbk_esf_necro", 2);
    HashSetSetLocalInt(oMod, "UpdateItemVer", "featbk_esf_trans", 2);
    HashSetSetLocalInt(oMod, "UpdateItemVer", "featbk_esp", 2);
    HashSetSetLocalInt(oMod, "UpdateItemVer", "hellbk_sresist", 2);
    HashSetSetLocalInt(oMod, "UpdateItemVer", "racebk_anarch", 2);
    HashSetSetLocalInt(oMod, "UpdateItemVer", "racebk_atomie", 2);
    HashSetSetLocalInt(oMod, "UpdateItemVer", "racebk_baseborn", 2);
    HashSetSetLocalInt(oMod, "UpdateItemVer", "racebk_battlerag", 2);
    HashSetSetLocalInt(oMod, "UpdateItemVer", "racebk_chaosgnom", 2);
    HashSetSetLocalInt(oMod, "UpdateItemVer", "racebk_dopplegan", 2);
    HashSetSetLocalInt(oMod, "UpdateItemVer", "racebk_dragonblo", 2);
    HashSetSetLocalInt(oMod, "UpdateItemVer", "racebk_erinyes", 2);
    HashSetSetLocalInt(oMod, "UpdateItemVer", "racebk_fallenan", 2);
    HashSetSetLocalInt(oMod, "UpdateItemVer", "racebk_furchin", 2);
    HashSetSetLocalInt(oMod, "UpdateItemVer", "racebk_genie", 2);
    HashSetSetLocalInt(oMod, "UpdateItemVer", "racebk_halfcele", 2);
    HashSetSetLocalInt(oMod, "UpdateItemVer", "racebk_halffiend", 2);
    HashSetSetLocalInt(oMod, "UpdateItemVer", "racebk_halfguard", 2);
    HashSetSetLocalInt(oMod, "UpdateItemVer", "racebk_halfkyton", 2);
    HashSetSetLocalInt(oMod, "UpdateItemVer", "racebk_houndarch", 2);
    HashSetSetLocalInt(oMod, "UpdateItemVer", "racebk_howler", 2);
    HashSetSetLocalInt(oMod, "UpdateItemVer", "racebk_juggernau", 2);
    HashSetSetLocalInt(oMod, "UpdateItemVer", "racebk_kolyarut", 2);
    HashSetSetLocalInt(oMod, "UpdateItemVer", "racebk_lycan", 2);
    HashSetSetLocalInt(oMod, "UpdateItemVer", "racebk_maelephan", 2);
    HashSetSetLocalInt(oMod, "UpdateItemVer", "racebk_minotaur", 2);
    HashSetSetLocalInt(oMod, "UpdateItemVer", "racebk_negatai", 2);
    HashSetSetLocalInt(oMod, "UpdateItemVer", "racebk_oneeyed", 2);
    HashSetSetLocalInt(oMod, "UpdateItemVer", "racebk_planewalk", 2);
    HashSetSetLocalInt(oMod, "UpdateItemVer", "racebk_radianceg", 2);
    HashSetSetLocalInt(oMod, "UpdateItemVer", "racebk_rilminai", 2);
    HashSetSetLocalInt(oMod, "UpdateItemVer", "racebk_salamande", 2);
    HashSetSetLocalInt(oMod, "UpdateItemVer", "racebk_shard", 2);
    HashSetSetLocalInt(oMod, "UpdateItemVer", "racebk_spelljamm", 2);
    HashSetSetLocalInt(oMod, "UpdateItemVer", "racebk_stargazer", 2);
    HashSetSetLocalInt(oMod, "UpdateItemVer", "racebk_stinger", 2);
    HashSetSetLocalInt(oMod, "UpdateItemVer", "racebk_thrikreen", 2);
    HashSetSetLocalInt(oMod, "UpdateItemVer", "racebk_treant", 2);
    HashSetSetLocalInt(oMod, "UpdateItemVer", "racebk_undying", 2);
    HashSetSetLocalInt(oMod, "UpdateItemVer", "racebk_yukio", 2);
    HashSetSetLocalInt(oMod, "UpdateItemVer", "racebk_zenythri", 2);

    HashSetSetLocalString(oMod, "UpdateItemRes", "hellbk_sfist", "hellbk_sresist");


    /* update stat artifacts to new statartifact script */
    HashSetSetLocalInt(oMod, "UpdateItemVer", "lockofsunefireha", 2);
    HashSetSetLocalInt(oMod, "UpdateItemVer", "sigilofmystra", 4);
    HashSetSetLocalInt(oMod, "UpdateItemVer", "tearofselune", 3);
    HashSetSetLocalInt(oMod, "UpdateItemVer", "theeyeofvecna", 2);
    HashSetSetLocalInt(oMod, "UpdateItemVer", "thehandofvecna", 2);
    HashSetSetLocalInt(oMod, "UpdateItemVer", "themaskofvhaerun", 2);
    HashSetSetLocalInt(oMod, "UpdateItemVer", "theorbofdrago", 2);
    HashSetSetLocalInt(oMod, "UpdateItemVer", "thepyramidener", 2);
    HashSetSetLocalInt(oMod, "UpdateItemVer", "tymorasluckychar", 4);

    /* update epic spells to new charged versions */
    HashSetSetLocalInt(oMod, "UpdateItemVer", "es_aegis",         3);
    HashSetSetLocalInt(oMod, "UpdateItemVer", "es_annihilation",  3);
    HashSetSetLocalInt(oMod, "UpdateItemVer", "es_armor_earth",   4);
    HashSetSetLocalInt(oMod, "UpdateItemVer", "es_bigbyswarm",    3);
    HashSetSetLocalInt(oMod, "UpdateItemVer", "es_call_earthchi", 3);
    HashSetSetLocalInt(oMod, "UpdateItemVer", "es_callingoftheh", 3);
    HashSetSetLocalInt(oMod, "UpdateItemVer", "es_chantofwardin", 3);
    HashSetSetLocalInt(oMod, "UpdateItemVer", "es_contingency",   3);
    HashSetSetLocalInt(oMod, "UpdateItemVer", "es_conversion",    4);
    HashSetSetLocalInt(oMod, "UpdateItemVer", "es_cryoftheheave", 3);
    HashSetSetLocalInt(oMod, "UpdateItemVer", "es_deathofmagic",  3);
    HashSetSetLocalInt(oMod, "UpdateItemVer", "es_dirgeofthedea", 3);
    HashSetSetLocalInt(oMod, "UpdateItemVer", "es_dust_to_dust",  3);
    HashSetSetLocalInt(oMod, "UpdateItemVer", "es_element_shunt", 3);
    HashSetSetLocalInt(oMod, "UpdateItemVer", "es_ensnare_trude", 3);
    HashSetSetLocalInt(oMod, "UpdateItemVer", "es_eternalreturn", 3);
    HashSetSetLocalInt(oMod, "UpdateItemVer", "es_gird_faith",    3);
    HashSetSetLocalInt(oMod, "UpdateItemVer", "es_hearmeroar",    3);
    HashSetSetLocalInt(oMod, "UpdateItemVer", "es_immutable_for", 3);
    HashSetSetLocalInt(oMod, "UpdateItemVer", "es_instr_faith",   3);
    HashSetSetLocalInt(oMod, "UpdateItemVer", "es_massspelldest", 3);
    HashSetSetLocalInt(oMod, "UpdateItemVer", "es_miracle",       4);
    HashSetSetLocalInt(oMod, "UpdateItemVer", "es_missilemirage", 3);
    HashSetSetLocalInt(oMod, "UpdateItemVer", "es_natures_frail", 3);
    HashSetSetLocalInt(oMod, "UpdateItemVer", "es_planar_beckon", 3);
    HashSetSetLocalInt(oMod, "UpdateItemVer", "es_possumsfarce",  3);
    HashSetSetLocalInt(oMod, "UpdateItemVer", "es_primal_catacl", 3);
    HashSetSetLocalInt(oMod, "UpdateItemVer", "es_primalforce",   3);
    HashSetSetLocalInt(oMod, "UpdateItemVer", "es_safe_box",      3);
    HashSetSetLocalInt(oMod, "UpdateItemVer", "es_shroud_nature", 3);
    HashSetSetLocalInt(oMod, "UpdateItemVer", "es_unbowedunbent", 3);
    HashSetSetLocalInt(oMod, "UpdateItemVer", "es_winteriscomin", 3);

    HashSetSetLocalInt(oMod, "UpdateItemVer", "qc_dw_bchant1", 2);
    HashSetSetLocalInt(oMod, "UpdateItemVer", "qc_dw_bchant2", 2);
    HashSetSetLocalInt(oMod, "UpdateItemVer", "qc_dw_bchant3", 3);
    HashSetSetLocalInt(oMod, "UpdateItemVer", "qc_dw_dchant1", 2);
    HashSetSetLocalInt(oMod, "UpdateItemVer", "qc_dw_dchant2", 2);
    HashSetSetLocalInt(oMod, "UpdateItemVer", "qc_dw_dchant3", 3);


    /* replace version 2 items */
    HashSetSetLocalInt(oMod, "UpdateItemVer", "abosetam002", 2);        /* Primordial Heart */
    HashSetSetLocalInt(oMod, "UpdateItemVer", "abosetbracer001", 2);    /* Spellguards of Netheril */
    HashSetSetLocalInt(oMod, "UpdateItemVer", "abosetbracer003", 2);    /* Bracers of Many Eyes */
    HashSetSetLocalInt(oMod, "UpdateItemVer", "abosethelm002", 2);      /* Nightglass Crown */
    HashSetSetLocalInt(oMod, "UpdateItemVer", "abosetmisc003", 2);      /* Temporal Autocaster */
    HashSetSetLocalInt(oMod, "UpdateItemVer", "abosetring002", 2);      /* Signet of Phelgethos */
    HashSetSetLocalInt(oMod, "UpdateItemVer", "abosetring003", 2);      /* Stygian Band */
    HashSetSetLocalInt(oMod, "UpdateItemVer", "abosetring004", 2);      /* Jewel of Minauros */
    HashSetSetLocalInt(oMod, "UpdateItemVer", "abosetst001", 2);        /* Staff of Forsaken Sorcery */
    HashSetSetLocalInt(oMod, "UpdateItemVer", "abosettr003", 2);        /* Runestaff of Abjuration */
    HashSetSetLocalInt(oMod, "UpdateItemVer", "abosettr004", 2);        /* Runestaff of Conjuration */
    HashSetSetLocalInt(oMod, "UpdateItemVer", "abosettr005", 2);        /* Runestaff of Divination */
    HashSetSetLocalInt(oMod, "UpdateItemVer", "abosettr006", 2);        /* Runestaff of Enchantment */
    HashSetSetLocalInt(oMod, "UpdateItemVer", "abosettr007", 2);        /* Runestaff of Evocation */
    HashSetSetLocalInt(oMod, "UpdateItemVer", "abosettr008", 2);        /* Runestaff of Illusion */
    HashSetSetLocalInt(oMod, "UpdateItemVer", "abosettr009", 2);        /* Runestaff of Necromancy */
    HashSetSetLocalInt(oMod, "UpdateItemVer", "abosettr010", 2);        /* Runestaff of Transmutation */
    HashSetSetLocalInt(oMod, "UpdateItemVer", "abysetarm001", 2);       /* Molted Scales of Obox-ob */
    HashSetSetLocalInt(oMod, "UpdateItemVer", "abysetboot010", 2);      /* Corruption of the Mind */
    HashSetSetLocalInt(oMod, "UpdateItemVer", "abysettr001", 2);        /* Sign of Orcus */
    HashSetSetLocalInt(oMod, "UpdateItemVer", "arakinscasement", 2);    /* Arakin's Casement */
    HashSetSetLocalInt(oMod, "UpdateItemVer", "asmoset005", 2);         /* The Serpent's Coil */
    HashSetSetLocalInt(oMod, "UpdateItemVer", "asmoset006", 2);         /* Styxwalkers */
    HashSetSetLocalInt(oMod, "UpdateItemVer", "asmoset012", 2);         /* Styxwalkers */
    HashSetSetLocalInt(oMod, "UpdateItemVer", "asmoset013", 2);         /* Styxwalkers */
    HashSetSetLocalInt(oMod, "UpdateItemVer", "asmoset014", 2);         /* Styxwalkers */
    HashSetSetLocalInt(oMod, "UpdateItemVer", "asmoset015", 2);         /* Styxwalkers */
    HashSetSetLocalInt(oMod, "UpdateItemVer", "asmoset016", 2);         /* Styxwalkers */
    HashSetSetLocalInt(oMod, "UpdateItemVer", "asmoset017", 2);         /* Styxwalkers */
    HashSetSetLocalInt(oMod, "UpdateItemVer", "asmoset018", 2);         /* Styxwalkers */
    HashSetSetLocalInt(oMod, "UpdateItemVer", "biorejuvenator", 2);     /* Biorejuventor */
    HashSetSetLocalInt(oMod, "UpdateItemVer", "bloodsport", 2);         /* Blood Sport */
    HashSetSetLocalInt(oMod, "UpdateItemVer", "bloodthirst", 2);        /* Bloodthirst (AC longsword) */
    HashSetSetLocalInt(oMod, "UpdateItemVer", "bootsofthetartar", 2);   /* Anklets of the Tartarian */
    HashSetSetLocalInt(oMod, "UpdateItemVer", "bpfhiraikos", 2);        /* Breastplate of Hiraikos */
    HashSetSetLocalInt(oMod, "UpdateItemVer", "ca_pm_lichsong", 2);     /* Lichsong */
    HashSetSetLocalInt(oMod, "UpdateItemVer", "ca_sd_rift", 2);         /* Shadow Rift */
    HashSetSetLocalInt(oMod, "UpdateItemVer", "callandor001", 2);       /* Callandor (AC longsword) */
    HashSetSetLocalInt(oMod, "UpdateItemVer", "crownofradiance", 2);    /* Crown of Radiance */
    HashSetSetLocalInt(oMod, "UpdateItemVer", "daggerofshieldin", 2);   /* Dagger of Shielding (AC dagger) */
    HashSetSetLocalInt(oMod, "UpdateItemVer", "defendingblade", 2);     /* Defending Blade (AC katana) */
    HashSetSetLocalInt(oMod, "UpdateItemVer", "duelistdagger", 2);      /* Duelist Dagger (AC dagger) */
    HashSetSetLocalInt(oMod, "UpdateItemVer", "dulsethelm001", 2);      /* Helm of Darkened Vision */
    HashSetSetLocalInt(oMod, "UpdateItemVer", "dustitem015", 2);        /* Halaster's Madness */
    HashSetSetLocalInt(oMod, "UpdateItemVer", "dustitem026", 2);        /* Nixie's Lash */
    HashSetSetLocalInt(oMod, "UpdateItemVer", "earthmothersrage", 2);   /* Earth Mother's Rage */
    HashSetSetLocalInt(oMod, "UpdateItemVer", "elyhidcraft002", 2);     /* Elysian Flower */
    HashSetSetLocalInt(oMod, "UpdateItemVer", "elyhiduse006", 2);       /* Greater Scabbard of Blessing */
    HashSetSetLocalInt(oMod, "UpdateItemVer", "elysetarm001", 2);       /* Starfall Cassock */
    HashSetSetLocalInt(oMod, "UpdateItemVer", "elysetarm004", 2);       /* Forestweave Jerkin */
    HashSetSetLocalInt(oMod, "UpdateItemVer", "elysetbelt001", 2);      /* Inviolate Cincture */
    HashSetSetLocalInt(oMod, "UpdateItemVer", "elysetboot003", 2);      /* Treads of the Exalted */
    HashSetSetLocalInt(oMod, "UpdateItemVer", "elysetbracer001", 2);    /* Indomitable Bracers */
    HashSetSetLocalInt(oMod, "UpdateItemVer", "elysetcl001", 2);        /* Amorian Drape */
    HashSetSetLocalInt(oMod, "UpdateItemVer", "elysethelm006", 2);      /* Empyrean Lenses */
    HashSetSetLocalInt(oMod, "UpdateItemVer", "elysetring001", 2);      /* Elysium Breach Ring */
    HashSetSetLocalInt(oMod, "UpdateItemVer", "elysetring002", 2);      /* Elysium Breach Ring */
    HashSetSetLocalInt(oMod, "UpdateItemVer", "elysetring003", 2);      /* Elysium Breach Ring */
    HashSetSetLocalInt(oMod, "UpdateItemVer", "elysetring004", 2);      /* Elysium Breach Ring */
    HashSetSetLocalInt(oMod, "UpdateItemVer", "elysetring005", 2);      /* Elysium Breach Ring */
    HashSetSetLocalInt(oMod, "UpdateItemVer", "elysetsh005", 2);        /* Undying Flame */
    HashSetSetLocalInt(oMod, "UpdateItemVer", "focus", 2);              /* Focus (AC rapier) */
    HashSetSetLocalInt(oMod, "UpdateItemVer", "focus001", 2);           /* Focus (AC rapier) */
    HashSetSetLocalInt(oMod, "UpdateItemVer", "greaterdefending", 2);   /* Greater Defending Blade (AC katana) */
    HashSetSetLocalInt(oMod, "UpdateItemVer", "harperboots", 2);        /* Boots of the Wanderer */
    HashSetSetLocalInt(oMod, "UpdateItemVer", "hellbow001", 2);
    HashSetSetLocalInt(oMod, "UpdateItemVer", "hellbow002", 2);
    HashSetSetLocalInt(oMod, "UpdateItemVer", "hellbow003", 2);
    HashSetSetLocalInt(oMod, "UpdateItemVer", "hellbow004", 2);
    HashSetSetLocalInt(oMod, "UpdateItemVer", "hellbow005", 2);
    HashSetSetLocalInt(oMod, "UpdateItemVer", "hellhidcraft011", 2);    /* Avernan Dragonblood Flowers */
    HashSetSetLocalInt(oMod, "UpdateItemVer", "hellhidcraft012", 2);    /* Avernan Dragonblood Flowers */
    HashSetSetLocalInt(oMod, "UpdateItemVer", "hellhidcraft013", 2);    /* Avernan Dragonblood Flowers */
    HashSetSetLocalInt(oMod, "UpdateItemVer", "hellhiduse001", 2);      /* Abhorrent Vacuum */
    HashSetSetLocalInt(oMod, "UpdateItemVer", "hellhiduse002", 2);      /* Infernal Weapon Item */
    HashSetSetLocalInt(oMod, "UpdateItemVer", "hellhiduse003", 2);      /* Infernal Weapon Item */
    HashSetSetLocalInt(oMod, "UpdateItemVer", "hellhiduse004", 2);      /* Infernal Weapon Item */
    HashSetSetLocalInt(oMod, "UpdateItemVer", "hellhiduse008", 2);      /* Infernal Weapon Item */
    HashSetSetLocalInt(oMod, "UpdateItemVer", "hellhidweap002", 2);     /* Mammon's Wrath */
    HashSetSetLocalInt(oMod, "UpdateItemVer", "hellsetam002", 2);       /* Amulet of Unbroken Balance */
    HashSetSetLocalInt(oMod, "UpdateItemVer", "hellsetarm006", 2);
    HashSetSetLocalInt(oMod, "UpdateItemVer", "hellsetarm007", 2);
    HashSetSetLocalInt(oMod, "UpdateItemVer", "hellsetarm010", 2);
    HashSetSetLocalInt(oMod, "UpdateItemVer", "hellsetarm016", 2);      /* Silks of the Arachill */
    HashSetSetLocalInt(oMod, "UpdateItemVer", "hellsetarm017", 2);      /* Dance of Blades */
    HashSetSetLocalInt(oMod, "UpdateItemVer", "hellsetbelt002", 2);     /* Obi of the Geisha */
    HashSetSetLocalInt(oMod, "UpdateItemVer", "hellsetboot001", 2);     /* Nightmare Hooves */
    HashSetSetLocalInt(oMod, "UpdateItemVer", "hellsetcl002", 2);       /* Folds of Fury */
    HashSetSetLocalInt(oMod, "UpdateItemVer", "hellsetmisc002", 2);     /* Deck of Walls */
    HashSetSetLocalInt(oMod, "UpdateItemVer", "hellsetweap010", 2);     /* Screaming Gale */
    HashSetSetLocalInt(oMod, "UpdateItemVer", "hellsh001", 2);          /* Trappings of the Weave */
    HashSetSetLocalInt(oMod, "UpdateItemVer", "hellsh002", 2);          /* Teardrop */
    HashSetSetLocalInt(oMod, "UpdateItemVer", "hellsh003", 2);          /* Arcane Lustre */
    HashSetSetLocalInt(oMod, "UpdateItemVer", "hellsh004", 2);          /* Effervescent Aura */
    HashSetSetLocalInt(oMod, "UpdateItemVer", "hellweap039", 2);        /* Vitiarch's Talon */
    HashSetSetLocalInt(oMod, "UpdateItemVer", "hellweap040", 2);        /* Stone Eater */
    HashSetSetLocalInt(oMod, "UpdateItemVer", "hellweap041", 2);        /* Camizu's Strike */
    HashSetSetLocalInt(oMod, "UpdateItemVer", "hellweap042", 2);        /* Deathcry */
    HashSetSetLocalInt(oMod, "UpdateItemVer", "hellweap043", 2);        /* Offering of Asmodeus */
    HashSetSetLocalInt(oMod, "UpdateItemVer", "hellweap044", 2);        /* Narzugon's Lance */
    HashSetSetLocalInt(oMod, "UpdateItemVer", "hellweap045", 2);        /* Circle of Unending Pain */
    HashSetSetLocalInt(oMod, "UpdateItemVer", "hivsetuse001", 2);       /* Hive Venom */
    HashSetSetLocalInt(oMod, "UpdateItemVer", "hivsetuse002", 2);       /* Hive Venom */
    HashSetSetLocalInt(oMod, "UpdateItemVer", "hivsetuse003", 2);       /* Hive Venom */
    HashSetSetLocalInt(oMod, "UpdateItemVer", "illithiditem004", 2);    /* Penumbrium Plate */
    HashSetSetLocalInt(oMod, "UpdateItemVer", "illithiditem009", 2);    /* Prescient's Guard */
    HashSetSetLocalInt(oMod, "UpdateItemVer", "illithiditem010", 2);    /* Mask of Mystra */
    HashSetSetLocalInt(oMod, "UpdateItemVer", "illithiditem011", 2);    /* Psi Actuator */
    HashSetSetLocalInt(oMod, "UpdateItemVer", "illithiditem013", 2);    /* Stoic Faith */
    HashSetSetLocalInt(oMod, "UpdateItemVer", "illithiditem016", 2);    /* Rano's Vendetta */
    HashSetSetLocalInt(oMod, "UpdateItemVer", "illithiditem017", 2);    /* Exo-array */
    HashSetSetLocalInt(oMod, "UpdateItemVer", "illithiditem018", 2);    /* Rune of Return */
    HashSetSetLocalInt(oMod, "UpdateItemVer", "illithiditem019", 2);    /* Amulet of Adaptation */
    HashSetSetLocalInt(oMod, "UpdateItemVer", "illithiditem020", 2);    /* Belt of Bestial Resilience */
    HashSetSetLocalInt(oMod, "UpdateItemVer", "illithiditem025", 2);    /* Ring of Windworking */
    HashSetSetLocalInt(oMod, "UpdateItemVer", "illithiditem028", 2);    /* Psiforger's Boots */
    HashSetSetLocalInt(oMod, "UpdateItemVer", "item100", 2);            /* Melf's Magnificent Mantle */
    HashSetSetLocalInt(oMod, "UpdateItemVer", "item101", 2);            /* Balagarn's Barrier */
    HashSetSetLocalInt(oMod, "UpdateItemVer", "item103", 2);            /* Sharantyr's Silks */
    HashSetSetLocalInt(oMod, "UpdateItemVer", "item106", 2);            /* The Leadfoot */
    HashSetSetLocalInt(oMod, "UpdateItemVer", "keynariprotectiv", 2);   /* Keynari Protective Fungus */
    HashSetSetLocalInt(oMod, "UpdateItemVer", "kmfphide", 2);           /* Ka'Mrioga's Hide */
    HashSetSetLocalInt(oMod, "UpdateItemVer", "locsethelm003", 2);      /* Blessed Silence */
    HashSetSetLocalInt(oMod, "UpdateItemVer", "locsetsh003", 2);        /* Guardian Beneath the Sea */
    HashSetSetLocalInt(oMod, "UpdateItemVer", "locsetuse002", 2);        /* Locathah Essence of the Whirlpool */
    HashSetSetLocalInt(oMod, "UpdateItemVer", "locsetuse007", 2);       /* Epodes of Form Mastery */
    HashSetSetLocalInt(oMod, "UpdateItemVer", "locsetuse008", 2);
    HashSetSetLocalInt(oMod, "UpdateItemVer", "locsetuse009", 2);
    HashSetSetLocalInt(oMod, "UpdateItemVer", "locsetuse010", 2);
    HashSetSetLocalInt(oMod, "UpdateItemVer", "locsetuse011", 2);
    HashSetSetLocalInt(oMod, "UpdateItemVer", "masksmischief", 2);      /* Mask's Mischief */
    HashSetSetLocalInt(oMod, "UpdateItemVer", "moadweap001", 2);        /* MoaD weapons */
    HashSetSetLocalInt(oMod, "UpdateItemVer", "moadweap002", 2);        /* MoaD weapons */
    HashSetSetLocalInt(oMod, "UpdateItemVer", "moadweap003", 2);        /* MoaD weapons */
    HashSetSetLocalInt(oMod, "UpdateItemVer", "moadweap004", 2);        /* MoaD weapons */
    HashSetSetLocalInt(oMod, "UpdateItemVer", "moadweap005", 2);        /* MoaD weapons */
    HashSetSetLocalInt(oMod, "UpdateItemVer", "moadweap007", 2);        /* MoaD weapons */
    HashSetSetLocalInt(oMod, "UpdateItemVer", "moadweap008", 2);        /* MoaD weapons */
    HashSetSetLocalInt(oMod, "UpdateItemVer", "moadweap009", 2);        /* MoaD weapons */
    HashSetSetLocalInt(oMod, "UpdateItemVer", "moadweap010", 2);        /* MoaD weapons */
    HashSetSetLocalInt(oMod, "UpdateItemVer", "moadweap011", 2);        /* MoaD weapons */
    HashSetSetLocalInt(oMod, "UpdateItemVer", "moadweap012", 2);        /* MoaD weapons */
    HashSetSetLocalInt(oMod, "UpdateItemVer", "moadweap013", 2);        /* MoaD weapons */
    HashSetSetLocalInt(oMod, "UpdateItemVer", "moadweap014", 2);        /* MoaD weapons */
    HashSetSetLocalInt(oMod, "UpdateItemVer", "moadweap015", 2);        /* MoaD weapons */
    HashSetSetLocalInt(oMod, "UpdateItemVer", "moadweap016", 2);        /* MoaD weapons */
    HashSetSetLocalInt(oMod, "UpdateItemVer", "moadweap017", 2);        /* MoaD weapons */
    HashSetSetLocalInt(oMod, "UpdateItemVer", "moadweap018", 2);        /* MoaD weapons */
    HashSetSetLocalInt(oMod, "UpdateItemVer", "moadweap019", 2);        /* MoaD weapons */
    HashSetSetLocalInt(oMod, "UpdateItemVer", "moadweap020", 2);        /* MoaD weapons */
    HashSetSetLocalInt(oMod, "UpdateItemVer", "moadweap021", 2);        /* MoaD weapons */
    HashSetSetLocalInt(oMod, "UpdateItemVer", "moadweap022", 2);        /* MoaD weapons */
    HashSetSetLocalInt(oMod, "UpdateItemVer", "moadweap023", 2);        /* MoaD weapons */
    HashSetSetLocalInt(oMod, "UpdateItemVer", "moadweap024", 2);        /* MoaD weapons */
    HashSetSetLocalInt(oMod, "UpdateItemVer", "moadweap025", 2);        /* MoaD weapons */
    HashSetSetLocalInt(oMod, "UpdateItemVer", "moadweap026", 2);        /* MoaD weapons */
    HashSetSetLocalInt(oMod, "UpdateItemVer", "moadweap027", 2);        /* MoaD weapons */
    HashSetSetLocalInt(oMod, "UpdateItemVer", "moadweap028", 2);        /* MoaD weapons */
    HashSetSetLocalInt(oMod, "UpdateItemVer", "moadweap029", 2);        /* MoaD weapons */
*snip*

Truncated, too long for forum. And yes, this runs almost instantaneously, no perceptible lag, thanks in part to being hashset-based.

Funky
               
               

               


                     Modifié par FunkySwerve, 16 juin 2011 - 08:42 .
                     
                  


            

Legacy_GhostOfGod

  • Hero Member
  • *****
  • Posts: 1490
  • Karma: +0/-0


               After rereading this and giving this a bit more thought:

Lazarus Magni wrote...

BTW your assumption is correct for the most part, certain items have been changed over time, but their resref's have not.


I suppose all you'd have to do is destroy all the items the player has and replace it with the item of the same res ref. If the item doesn't get recreated then that res ref is no longer there. Seems simple enough if my thinking is correct. Something like I posted above but simplified:

void ResRefMatchReplace(object oItem, object oTarget)
{
    string sResRef = GetResRef(oItem);
    DestroyObject(oItem);
    object oReplacement = CreateItemOnObject("sResRef", oTarget);
    if (!GetIsObjectValid(oReplacement))
    {
        //do stuff if there is no item with matching res ref.
    }
}

#include "x2_inc_switches"
void main()
{
    int iEvent = GetUserDefinedItemEventNumber();
    if (iEvent != X2_ITEM_EVENT_ACTIVATE) return;
    object oActivator = GetItemActivator();
    if (!GetIsDM(oActivator)) return;

    object oTarget = GetItemActivatedTarget();
    object oItem = GetFirstItemInInventory(oTarget);
    int iSlot;

    //Get items in inventory and replace if needed
    while (GetIsObjectValid(oItem))
    {
        //if item is a container, loop through items inside
        if (GetHasInventory(oItem))
        {
            object oConItem = GetFirstItemInInventory(oItem);
            while (GetIsObjectValid(oConItem))
            {
                ResRefMatchReplace(oConItem, oTarget);
                oConItem = GetNextItemInInventory(oItem);
            }
        }
        else
        {
            ResRefMatchReplace(oItem, oTarget);
        }
        oItem = GetNextItemInInventory(oTarget);
    }

    //Get equipped items and replace if necessary
    for (iSlot=0; iSlot<NUM_INVENTORY_SLOTS; iSlot++)
    {
        oItem = GetItemInSlot(iSlot, oTarget);
        if (GetIsObjectValid(oItem))
        {
            ResRefMatchReplace(oItem, oTarget);
        }
    }
}


P.S. This could easily be converted into an OnEnter type script as well. And only be done once by adding variable to the player after first run, as per Funky's suggestion.
               
               

               


                     Modifié par GhostOfGod, 16 juin 2011 - 09:30 .
                     
                  


            

Legacy_Lazarus Magni

  • Hero Member
  • *****
  • Posts: 1837
  • Karma: +0/-0


               Well guys thank you all for your help and suggestions. It is apparent to me I am going to have to try to recruit a scripter (idealy a whole team eventually) since my abilities in that department are minimul at best. It sounds like there are some pretty viable options here for someone who is a decent scripter to work with. I might pick you all's brains some more if you don't mind once I get closer to actually needing to impliment some of these things (once it's it near ready to launch, which hopefully won't be too long from now.)
Cheers, m8s!
               
               

               
            

Legacy_Greyfort

  • Sr. Member
  • ****
  • Posts: 442
  • Karma: +0/-0


               // pc_update_v1
// created by: GhostOfGod
// altered by: Greyfort
//
/*
   This code can be used by a DM item or placed in a triger in the very first
   area a pc will enter mod.  This will insure that a PC wont run around a
   world with a +20 vorpal time stoping sword...
*/
void ResRefMatchReplace(object oItem, object oTarget)
{
   string sResRef = GetResRef(oItem);
   SetLocalInt(oItem,"Destroy",TRUE);
   // orginal script destroy object
   //DestroyObject(oItem);
   object oReplacement = CreateItemOnObject("sResRef", oTarget);
   if (!GetIsObjectValid(oReplacement))
   {
       //do stuff if there is no item with matching res ref.
       // if item doesn't have resref dont destroy, flag PC for DM intervention
       SetLocalInt(oItem,"Destroy",FALSE);
       SetLocalInt(oItem,"DM_intrvn",TRUE);
   }
   // now check item flaged for destruction and destroy
   if( GetLocalInt(oItem,"Destroy")==TRUE ){DestroyObject(oItem);}
}

#include "x2_inc_switches"
void main()
{
// NOTE: this is code for a tool by GhostOfGod
/*
   int iEvent = GetUserDefinedItemEventNumber();
   if (iEvent != X2_ITEM_EVENT_ACTIVATE) return;
   object oActivator = GetItemActivator();
   if (!GetIsDM(oActivator)) return;

   object oTarget = GetItemActivatedTarget();
   object oItem = GetFirstItemInInventory(oTarget);
*/
// NOTE: this is code for trigger, trigers work better at clearing equiped gear.
// so I have found Greyfort
// here you will have to decide what DB you are using nwn_db or nwnx_db
// example useing nwn_db
string sDM_Name = "Help_Script_MOD";//""+GetModuleName()+"_"+"SaVE_LOC";

object oTarget = GetEnteringObject();
object oItem = GetFirstItemInInventory(oTarget);

object oBadArea = GetObjectByTag("");
vector vBadVec = Vector(0.0,0.0,0.0);
location lbadloc = Location(oBadArea,vBadVec,0.0);

location lSave_Loc = GetCampaignLocation( sDM_Name,"Save_Loc",oTarget );
object oDflt_Start = GetObjectByTag("WP_oDflt_Start");
object oDM_Thrpy = GetNearestObjectByTag( "WP_oDM_Thrpy",oTarget );

int iSlot;
//------------------------------------------------------------------------------
// added check for update variable if false update if true jump to loc
// if update false update
if( GetCampaignInt(sDM_Name,"Gear_updtd")==0 )
   {

   //Get items in inventory and replace if needed
   while (GetIsObjectValid(oItem))
   {
       //if item is a container, loop through items inside
       if (GetHasInventory(oItem))
       {
           object oConItem = GetFirstItemInInventory(oItem);
           while (GetIsObjectValid(oConItem))
           {
               ResRefMatchReplace(oConItem, oTarget);
               oConItem = GetNextItemInInventory(oItem);
           }
       }
       else
       {
           ResRefMatchReplace(oItem, oTarget);
       }
       oItem = GetNextItemInInventory(oTarget);
   }

   //Get equipped items and replace if necessary
   for (iSlot=0; iSlot<NUM_INVENTORY_SLOTS; iSlot++)
   {
       oItem = GetItemInSlot(iSlot, oTarget);
       if (GetIsObjectValid(oItem))
       {
           ResRefMatchReplace(oItem, oTarget);
       }
   }

// now if player flagged for DM intervention jump play to DM Therepy...
if ( GetLocalInt(oItem,"DM_intrvn")==TRUE)
   {
   // flag player not updated here:
   SetCampaignInt(sDM_Name,"Gear_updtd",0);
   // jump to DM_area
   AssignCommand(oTarget,ClearAllActions(TRUE));
   AssignCommand(oTarget,ActionJumpToObject( oDM_Thrpy ));
   }

// now if player not flagged for DM intervention jump player to default start,
// or saved loc
if ( GetLocalInt(oItem,"DM_intrvn")==FALSE)
   {

//jump to save loc if valid else jump to default start
if (lSave_Loc != lbadloc)
   {
   // flag player updated here:
   SetCampaignInt(sDM_Name,"Gear_updtd",1);
   // jump to save_lov
   AssignCommand(oTarget,ClearAllActions(TRUE));
   AssignCommand(oTarget,JumpToLocation( lSave_Loc ));
   }
   else
   {
   // flag player updated here:
   SetCampaignInt(sDM_Name,"Gear_updtd",1);
   // jump to default start
   AssignCommand(oTarget,ClearAllActions(TRUE));
   AssignCommand(oTarget,ActionJumpToObject( oDflt_Start ));
   }
   }
}//ENDO OF if( SetCampaignInt(sDM_Name,"Gear_updtd")==FALSE )

//------------------------------------------------------------------------------
// if update TRUE DONT update
if( GetCampaignInt(sDM_Name,"Gear_updtd")==1 )
{

//jump to save loc if valid else jump to default start
if (lSave_Loc != lbadloc)
   {
   // flag player updated here:
   SetCampaignInt(sDM_Name,"Gear_updtd",TRUE);
   // jump to save_lov
   AssignCommand(oTarget,ClearAllActions(TRUE));
   AssignCommand(oTarget,JumpToLocation( lSave_Loc ));
   }
   else
   {
   // flag player updated here:
   SetCampaignInt(sDM_Name,"Gear_updtd",TRUE);
   // jump to default start
   AssignCommand(oTarget,ClearAllActions(TRUE));
   AssignCommand(oTarget,ActionJumpToObject( oDflt_Start ));
   }

}//END if( SetCampaignInt(sDM_Name,"Gear_updtd")==TRUE )

//[END OF SCRIPT//]
}

here is a altered script of ghosts it will check pcs gear and flagg if need dm intervention and update all others and then set var on pc updated or dm therpy.  this would solve a one time issue and any grump from players losing items.
               
               

               
            

Legacy_Lazarus Magni

  • Hero Member
  • *****
  • Posts: 1837
  • Karma: +0/-0


               That's fantastic Grey, thank you! Just so I am clear on how to include this in a module open up the mod in the toolset:
go to tools, script editor to create a new script. Delete the initial (default) lines (1 void main, or whatever), Cut and paste, then save giving it a name. So now I have it in my mod. Then to get to run when players log in go to edit, module properties, events, and edit the on client enter event, and at the top of that put in a line like #include "script name"? Would that work?
               
               

               


                     Modifié par Lazarus Magni, 17 juin 2011 - 08:57 .
                     
                  


            

Legacy_GhostOfGod

  • Hero Member
  • *****
  • Posts: 1490
  • Karma: +0/-0


               Just a heads up with Grey's version. If the player ends up with items that are no longer in the module, it will port them to the DM intervention waypoint if one exists. If you don't have a lot of DMs on or if there will be long periods of time without any DMs, you might want to make sure that the player won't just be stuck in some area until a DM logs on. You will also need a separate script to delete the items that are flagged for deletion since his version does not destroy the items that are obsolete.

You could make the area automated. Have a sign that explains why they are there with an object or a trigger or something that will delete the flagged items and then send the player on his/her way.

Just some thoughts.
               
               

               
            

Legacy_Lazarus Magni

  • Hero Member
  • *****
  • Posts: 1837
  • Karma: +0/-0


               Hmm ok, that's not going to work for me then, but still mighty handy I am sure for some. What seems like the simplest solution would be a systhesis of alot of these ideas. A script that fires once the first time a player logs in a particular PC, and then flags them so that it doesn't run on subsequent logins with that same PC, which updates all of their items to the current blueprints, and destorys any items that don't have blueprints.
               
               

               
            

Legacy_Failed.Bard

  • Hero Member
  • *****
  • Posts: 1409
  • Karma: +0/-0


                 GhostOfGod's last script he posted would do essentially what you wanted, just his was based on an item activation, as opposed to an on enter.
  If you plan on doing a full item recreation of every player once, you'll need to make an area specifically for it to be done in, since they're likely to end up with items on the floor if their inventory was packed to begin with.

  I had written up one as well just to see mainly how I would do it compared to the other posters.  Mine requires a specifically tagged container in the area the player gets ported to in order to hold their "new" items, and due to the external storage method used in it cannot be used to remake "plot" items.

  The chest tag and validation ints stored on the item could be set to whatever you wanted.  All you would need to add to make mine run is a script that checks the player on entered to see if they've been "validated" yet.  The chest itself should be given a script that ports the player out of the area once all the items are removed from it.


// (6/16/2011) Failed Bard

void CreateNew (object oPC, object oItem);
void main()
{
 object oPC = GetEnteringObject();
 object oChest = GetNearestObjectByTag ("VALIDATION_CHEST");
 object oBagItem, oItem, oNewItem;
 int nSlot;
 int nCounter = 0;
 while (nCounter <= 13)
    {
     //nSlot = GetLootingSlot (nCounter);
     // oItem = GetItemInSlot  (nSlot, oPC);
     oItem = GetItemInSlot  (nCounter, oPC);
     if (!GetLocalInt (oItem, "VALID_6/16/2011"))
        {
         CreateNew (oChest, oItem);
        }
     nCounter ++;
    }
 oItem = GetFirstItemInInventory(oPC);
 while (GetIsObjectValid(oItem))
    {
     if (GetHasInventory (oItem))
        {
         oBagItem = GetFirstItemInInventory (oItem);
         if (!GetLocalInt (oBagItem, "VALID_6/16/2011"))
            {
             CreateNew (oChest, oBagItem);
            }
         oBagItem = GetNextItemInInventory (oItem);
        }
     if (!GetLocalInt (oItem, "VALID_6/16/2011"))
        {
         CreateNew (oChest, oItem);
        }
     oItem = GetNextItemInInventory(oPC);
    }
}
void CreateNew (object oPC, object oItem)
{
 if (GetPlotFlag (oItem))
    {
     SetLocalInt (oItem, "VALID_6/16/2011", TRUE);
    }
 else
    {
     object oNewItem = CreateItemOnObject (GetResRef (oItem), oPC, GetItemStackSize(oItem));
     SetLocalInt (oNewItem, "VALID_6/16/2011", TRUE);
     DestroyObject (oItem, 0.1);
    }
}
               
               

               
            

Legacy_GhostOfGod

  • Hero Member
  • *****
  • Posts: 1490
  • Karma: +0/-0


               Ok. This should do everything that you want so far. It will require that each player have a "non drop database item" (though it could be altered to use the NWNdatabase or what not as well). Just plug you database item tag in the top of this script where it say "Tag of database item here". You will want to run this using the ExecuteScript function from your modules OnClientEnter script or the OnEnter of a trigger,etc..:

const string DATABASE_ITEM = "Tag of database item here";

void ResRefMatchReplace(object oItem, object oPC)
{
    string sResRef = GetResRef(oItem);
    if (GetTag(oItem) != DATABASE_ITEM)
    {
        object oReplacement = CreateItemOnObject("sResRef", oPC);
        if (!GetIsObjectValid(oReplacement))
        {
            //Do stuff if there is no item with matching res ref.
            //~Give the player some gold or XP for the inconvenience.
            //~Give the player some other item for the inconvenience.
            //~Send the player a message each time one of these items is destroyed.
            //~Do a combination of any of these.
            //~Etc..
            DestroyObject(oItem);
        }
        else
        {
            DestroyObject(oItem);
        }
    }
}

#include "x2_inc_switches"
void main()
{
    object oPC = GetEnteringObject();
    if (!GetIsPC(oPC)) return;
    object oDatabaseItem = GetItemPossessedBy(oPC, DATABASE_ITEM);
    if (GetLocalInt(oDatabaseItem, "FULL_ITEM_CHECK")) return;
    object oItem = GetFirstItemInInventory(oPC);
    int iSlot;

    //Get items in inventory and replace if needed
    while (GetIsObjectValid(oItem))
    {
        //if item is a container, loop through items inside
        if (GetHasInventory(oItem))
        {
            object oConItem = GetFirstItemInInventory(oItem);
            while (GetIsObjectValid(oConItem))
            {
                ResRefMatchReplace(oConItem, oPC);
                oConItem = GetNextItemInInventory(oItem);
            }
        }
        else
        {
            ResRefMatchReplace(oItem, oPC);
        }
        oItem = GetNextItemInInventory(oPC);
    }

    //Get equipped items and replace if necessary
    for (iSlot=0; iSlot<NUM_INVENTORY_SLOTS; iSlot++)
    {
        oItem = GetItemInSlot(iSlot, oPC);
        if (GetIsObjectValid(oItem))
        {
            ResRefMatchReplace(oItem, oPC);
        }
    }
    SetLocalInt(oDatabaseItem, "FULL_ITEM_CHECK", TRUE);
    ExportSingleCharacter(oPC);
}


Hopefully this works out for ya. Good luck.
               
               

               


                     Modifié par GhostOfGod, 18 juin 2011 - 07:57 .
                     
                  


            

Legacy_Lazarus Magni

  • Hero Member
  • *****
  • Posts: 1837
  • Karma: +0/-0


               First of all, thank you all so much for all the input and work. Sadly I am not sure if I will be able to get this project off the ground, but even if I don't hopefully these scripts will be of use to someone so that all this work was not for nothing.

Secondly Ghost could you elaborate on what a "non drop database item" is? Do you mean just a new item (and it's associated tag) created in the mod (via the toolset)?
               
               

               
            

Legacy_Lazarus Magni

  • Hero Member
  • *****
  • Posts: 1837
  • Karma: +0/-0


               Double post edited out...
               
               

               


                     Modifié par Lazarus Magni, 17 juin 2011 - 10:03 .
                     
                  


            

Legacy_GhostOfGod

  • Hero Member
  • *****
  • Posts: 1490
  • Karma: +0/-0


               

Lazarus Magni wrote...

Secondly Ghost could you elaborate on what a "non drop database item" is? Do you mean just a new item (and it's associated tag) created in the mod (via the toolset)?


There are different types of ways to use a database in NWN. You can use the one Bioware provided with function like SetCampaignInt, etc. You can use something like SQL with NWNx. Or what I and a lot of other people prefer to do is just store variables on an item the player will always have. A "database item". Something like a rule book. Or one of the dmfi widgets like the dicebag or what not. Just something that ALL player will have and flagged/checked as Undropable in the toolset so that the players can not get rid of it.

You can store all kinds of information that pertains to that particular player. Kills, deaths, quest info, saved locations, etc. Anything that you need to be persistent. And the "one time item check" would be one of those things that would be perfect for this. The script runs and then sets a variable on your "database item". Then any time the player enters the mod the first thing that is checked is that variable on the database item. If the variable is there, then the script doesn't get fired.

Hope the info is helpful.

EDIT: I did just alter the last script I posted on the previous page. It hit me at work that if you did use a "database item" method, that item would be destroyed in the process. I fixed it so it would leave that one item alone. I also added a much needed ExportSingleCharacter line to make sure that all the new items are saved as well as the variable on the database item.

And again if you prefer other methods of "database" use then this script could be altered to fit whatever type you would use.
               
               

               


                     Modifié par GhostOfGod, 18 juin 2011 - 07:59 .
                     
                  


            

Legacy_Lazarus Magni

  • Hero Member
  • *****
  • Posts: 1837
  • Karma: +0/-0


               That is quite helpful, and explains alot. This particular PW uses nwnx and a MySQL database. I don't believe there are any "database items" (none of my characters have any item that can not be droped), but given the options it opens up for things like this, that sounds like a fantastic idea (provided it can be done in conjunction with nwnx and MySQL.)
               
               

               
            

Legacy_FunkySwerve

  • Hero Member
  • *****
  • Posts: 2325
  • Karma: +0/-0


               If you're already using MySQL, there's absolutely no reason to use a DB item, and a number of reasons not to.

Funky
               
               

               
            

Legacy_Lightfoot8

  • Hero Member
  • *****
  • Posts: 4797
  • Karma: +0/-0


               

FunkySwerve wrote...

If you're already using MySQL, there's absolutely no reason to use a DB item, and a number of reasons not to.

Funky


I can only take this statment to be an opinon. 

To me the greatest benifit for useing a DB item is keeping the data with the characters Bic file. 

Don't get me wrong, I am not saying that there are no drawbacks to using DB items.  But there are still some benifits.    

Lets say I have a player in a PW that want to delete a few character from his vault.  Once I have deleted his characters the data that was stored on his DB item is gone.  I do not need to create a system to also remove data for that character from an external DB.  Most people in this position would just leave the unneeded data in the DB. 
To me the DB item is just an extention of the Character's Data structure.  If there is ever anything where I could say. "It sure would be nice to just have this as part of the character structure."  I just add it to the DB item and save it out as part of the characters structure.