Author Topic: In game Achievement ideas w/ 3 questions.  (Read 289 times)

Legacy_Buddywarrior

  • Hero Member
  • *****
  • Posts: 512
  • Karma: +0/-0
In game Achievement ideas w/ 3 questions.
« on: March 01, 2011, 07:52:15 pm »


               I’m building a forever level 1
module where the player earns perks and gain their abilities via Achievements.
For example, if a player chops down 100 trees, they will get an additional piece
of wood for being good at chopping down trees.

I’m storing this info on the
players ‘Widget’.



So now I have a few questions.



1: Is there a way for the
creatures OnDeath to tell me what weapon or spell killed that creature?



2: Is there a way to add new/updated
info in the Description of the players Widget? (w/o NWNX)

3: What technique should I use to
grant players permanent feats on Enter? (Just cast a
supernatural spell on them?)
               
               

               
            

Legacy_Baragg

  • Sr. Member
  • ****
  • Posts: 496
  • Karma: +0/-0
In game Achievement ideas w/ 3 questions.
« Reply #1 on: March 01, 2011, 08:31:44 pm »


               As to #2 you can use GetDescription, and SetDescription to change the info described.
               
               

               
            

Legacy_Buddywarrior

  • Hero Member
  • *****
  • Posts: 512
  • Karma: +0/-0
In game Achievement ideas w/ 3 questions.
« Reply #2 on: March 01, 2011, 09:52:49 pm »


               

Baragg wrote...
As to #2 you can use GetDescription, and SetDescription to change the info described.

I searched the nwnlexicon for the SetDescription function but couldn't find anything. Where else can I see how it works?
               
               

               
            

Legacy_GhostOfGod

  • Hero Member
  • *****
  • Posts: 1490
  • Karma: +0/-0
In game Achievement ideas w/ 3 questions.
« Reply #3 on: March 01, 2011, 10:24:43 pm »


               Oh. I think this might have been added in 1.69 patch? But anyway here are the functions for Get/SetDescription. You can just scroll through your script editor to find them as well.

// Set the description of oObject.
// - oObject: the object for which you are changing the description
//            Can be a creature, placeable, item, door, or trigger.
// - sNewDescription: the new description that the object will use.
// - bIdentified: If oObject is an item, setting this to TRUE will set the identified description,
//                setting this to FALSE will set the unidentified description. This flag has no
//                effect on objects other than items.
// Note: Setting an object's description to "" will make the object
//       revert to using the description it originally had before any
//       SetDescription() calls were made on the object.
void SetDescription(object oObject, string sNewDescription="", int bIdentifiedDescription=TRUE)


// Get the description of oObject.
// - oObject: the object from which you are obtaining the description.
//            Can be a creature, item, placeable, door, trigger or module object.
// - bOriginalDescription:  if set to true any new description specified via a SetDescription scripting command
//                   is ignored and the original object's description is returned instead.
// - bIdentified: If oObject is an item, setting this to TRUE will return the identified description,
//                setting this to FALSE will return the unidentified description. This flag has no
//                effect on objects other than items.
string GetDescription(object oObject, int bOriginalDescription=FALSE, int bIdentifiedDescription=TRUE)



So a script using the SetDescription function might look something like so:

void main()
{
    object oPC = blah blah blah;
    string sNewDescription = "This weapon is now covered in blood.";
    object oWeapon = GetItemInSlot(INVENTORY_SLOT_RIGHTHAND, oPC);

    SetDescription(oWeapon, sNewDescription, TRUE);
}


Hope it helps. Good luck.
               
               

               


                     Modifié par GhostOfGod, 01 mars 2011 - 11:42 .
                     
                  


            

Legacy_GhostOfGod

  • Hero Member
  • *****
  • Posts: 1490
  • Karma: +0/-0
In game Achievement ideas w/ 3 questions.
« Reply #4 on: March 01, 2011, 11:38:01 pm »


               As far as "feats" go that is entirely up to what you feel like doing. You could go all out "hak" and make a bunch of custom ones with icons etc.
You could do what you already suggested and do a supernatural type spell.
Personally I prefer to add bonus feats to the pc properties skin. This is just one example I just whipped up as to how you might add some feats to the skin in an OnEnter script:


#include "x2_inc_itemprop"
void main()
{
    object oPC   = GetEnteringObject();
    object oPCDB = GetItemPossessedBy(oPC, "DATABASE_ITEM");
    object oSkin = GetItemInSlot(INVENTORY_SLOT_CARMOUR, oPC);
    int iFeat;
    itemproperty ipAdd;

    if (GetLocalInt(oPCDB, "FEAT_DISARM") == TRUE)
    {
        iFeat = IP_CONST_FEAT_DISARM;
        ipAdd = ItemPropertyBonusFeat(iFeat);
        IPSafeAddItemProperty(oSkin, ipAdd, 0.0, X2_IP_ADDPROP_POLICY_KEEP_EXISTING);
    }

    if (GetLocalInt(oPCDB, "CHOPPED_TREES") >= 100)
    {
        iFeat = IP_CONST_FEAT_KNOCKDOWN;
        ipAdd = ItemPropertyBonusFeat(iFeat);
        IPSafeAddItemProperty(oSkin, ipAdd, 0.0, X2_IP_ADDPROP_POLICY_KEEP_EXISTING);
    }

    //etc..
    {
        //blah blah blah
    }
}


If you take a look at those bonus feat constants you will also notice that there are 10 player tool and 10 dm tool feats as well. If you need to make some custom feats you can use these as well and then you can use them from the radial menue. This link talks a bit about those: nwn.wikia.com/wiki/Player_tool

Good luck.
               
               

               


                     Modifié par GhostOfGod, 01 mars 2011 - 11:46 .