Aller au contenu

Photo

Silly quick question.


  • Veuillez vous connecter pour répondre
12 réponses à ce sujet

#1
Master Jax

Master Jax
  • Members
  • 352 messages
Sorry for posting it here, but I believe this is the place most people visit :P and I have a better chance of someone answering! Besides... errr... it's sort of kind of maybe possibly mayhaps related to custom content!

I have tampered with the original campaign so much! Like... it was the first module I started editing, the one I learned lots of stuff from. However, as I was about doing even more changes, I realized during a test run that Open Lock and Disarm Trap don't give any XP gains. Since many custom modules do so, and many others don't, I assume such is implemented by the builder, and not necessarily activated automatically. However, I don't quite remember if those skills provided experience gains in the original campaign and expansions, or I clumsily deleted such script or something while going at them so many years ago.

So, I'm hoping some of you guys may refresh my memory on this subject.  Also, going at it again brought back some nice memories... Long live NWN!! :wizard:

#2
Tarot Redhand

Tarot Redhand
  • Members
  • 2 675 messages
It's done via scripting. For specifics (can't remember off the top of my head) ask in the scripting forum where they really know what they're talking about (unlike me(^_^)).

TR

#3
Master Jax

Master Jax
  • Members
  • 352 messages
Well yes, I know it is done via scripting, but what I don't remember is if such is present in the Original campaign and expansions! ^__^

#4
Rolo Kipp

Rolo Kipp
  • Members
  • 2 791 messages
<opening...>

Those skills did not give xp in the OC or expansions.
As a rogueish wizard, I have always felt the lack.
IMO, every class skill should give xp when successfully used. :-P

<...his trap>

#5
Squatting Monk

Squatting Monk
  • Members
  • 444 messages
If you wanna add it yourself, here's a simple way to do it. Put the following on the OnUnLock event:

void main()
{
    object oUnlocked = OBJECT_SELF;
    object oPC       = GetLastUnlocked();
    string sName     = GetName(oPC);

    // If this isn't a PC or he's already unlocked this object, abort.
    if (!GetIsPC(oPC) || GetLocalInt(oUnlocked, "Unlocked: " + sName))
        return;

    // Our XP is just going to be the DC. Could modify this with some math to
    // fine-tune it, though.
    int nXP = GetLockUnlockDC(oUnlocked);
    GiveXPToCreature(oPC, nXP);

    // Mark the PC as having unlocked this object so he can't get infinite XP.
    SetLocalInt(oUnlocked, "Unlocked: " + sName, TRUE);
}

And this on the OnDisarm event:

void main()
{
    object oDisarmed = OBJECT_SELF;
    object oCreator  = GetTrapCreator(oDisarmed);
    object oPC       = GetLastDisarmed();
    string sName     = GetName(oPC);

    // If this isn't a PC, he set the trap, or he's disarmed this object's trap
    // before, abort.
    if (!GetIsPC(oPC) || oCreator == oPC || GetLocalInt(oDisarmed, "Disarmed: " + sName))
        return;

    // Our XP is just going to be the DC. Could modify this with some math to
    // fine-tune it, though.
    int nXP = GetTrapDisarmDC(oDisarmed);
    GiveXPToCreature(oPC, nXP);

    // Mark the PC as having disarmed this object so he can't get infinite XP.
    SetLocalInt(oDisarmed, "Disarmed: " + sName, TRUE);
}

Modifié par Squatting Monk, 13 juin 2013 - 02:06 .


#6
Killmonger

Killmonger
  • Members
  • 237 messages
Nice...!!

Thank you for sharing ...

#7
Master Jax

Master Jax
  • Members
  • 352 messages
WOW! 0__0 Thanks for clarifying Rolo, and even more thanks to you Monk! You sharing this is awesome!! I will try it out immediately!!

#8
Rolo Kipp

Rolo Kipp
  • Members
  • 2 791 messages
<getting...>

For the math portion, my thought is to compare DC against base skill. Subtract skill from DC, if >0 the XP = difference squared.
At the low end, this means no XP for a trap/lock that you can pick in your sleep.
At the high end, this makes the skill rewarding for challenging targets in similar manner to the scaled XP fighters get with variable opponents.

<...tricky>

#9
kalbaern

kalbaern
  • Members
  • 824 messages

Rolo Kipp wrote...

<getting...>

For the math portion, my thought is to compare DC against base skill. Subtract skill from DC, if >0 the XP = difference squared.
At the low end, this means no XP for a trap/lock that you can pick in your sleep.
At the high end, this makes the skill rewarding for challenging targets in similar manner to the scaled XP fighters get with variable opponents.

<...tricky>


I do similar to what Rolo suggests, though its based on your overall levels vs the DC of the lock or trap and there's a minimum reward of 2xp ... even for the ones you can "do in your sleep".

XP for Locks:

void RewardPartyXP(int XP, object oTarget,int bAllParty=TRUE)
{
    if (bAllParty == TRUE)
    {
        object oPartyMember = GetFirstFactionMember(oTarget, TRUE);
        while (GetIsObjectValid(oPartyMember) == TRUE)
        {
            if( GetArea( oPartyMember) == GetArea( oTarget)) GiveXPToCreature( oPartyMember, XP);
            oPartyMember = GetNextFactionMember(oTarget, TRUE);
        }
    }
    else
    {
     GiveXPToCreature(oTarget, XP);
    }
}
object oPC=GetLastUnlocked();
int iXPaward = 0;
int iXPawarddc = 0;
void main()
{if(GetLocalInt(OBJECT_SELF,"unlock") == 1)
{return;}
iXPawarddc = (GetLockUnlockDC(OBJECT_SELF));
iXPaward = (iXPawarddc -((GetHitDice(oPC)+5)));
SetLocalInt(OBJECT_SELF,"unlock",1);
SendMessageToPC( (oPC ),"Unlocked");
if (iXPaward >= 2)
RewardPartyXP(iXPaward, oPC, TRUE);
else
RewardPartyXP(2, oPC, TRUE);
DelayCommand(600.0, SetLocalInt(OBJECT_SELF,"unlock",0));
}


XP for Traps:

void RewardPartyXP(int XP, object oTarget,int bAllParty=TRUE)
{
    if (bAllParty == TRUE)
    {
        object oPartyMember = GetFirstFactionMember(oTarget, TRUE);
        while (GetIsObjectValid(oPartyMember) == TRUE)
        {
            if( GetArea( oPartyMember) == GetArea( oTarget)) GiveXPToCreature( oPartyMember, XP);
            oPartyMember = GetNextFactionMember(oTarget, TRUE);
        }
    }
    else
    {
     GiveXPToCreature(oTarget, XP);
    }
}
object oPC=GetLastDisarmed();
int iXPaward = 0;
int iXPawarddc = 0;
void main()
{if(GetLocalInt(OBJECT_SELF,"disarm") == 1)
{return;}
iXPawarddc = (GetTrapDisarmDC(OBJECT_SELF));
iXPaward = (iXPawarddc -((GetHitDice(oPC)+5)));
SetLocalInt(OBJECT_SELF,"disarm",1);
SendMessageToPC( (oPC ),"Trap disarmed");
if (iXPaward >= 2)
RewardPartyXP(iXPaward, oPC, TRUE);
else
RewardPartyXP(2, oPC, TRUE);
DelayCommand(600.0, SetLocalInt(OBJECT_SELF,"disarm",0));
}


Both versions use a delayed command to allow a second, third, etc... attempt. This I think works better as if limited to once per PC, PCs can still relock or even retrap things and let others in their Party double dip.

Modifié par kalbaern, 13 juin 2013 - 04:33 .


#10
DA_Bhaall

DA_Bhaall
  • Members
  • 1 messages

Hi guys, i just wondering if is possible to attach these script to ALL doors/traps without doing it individually? Thx for answers.



#11
kalbaern

kalbaern
  • Members
  • 824 messages

Hi guys, i just wondering if is possible to attach these script to ALL doors/traps without doing it individually? Thx for answers.

Unfortunately not. You'll have to edit each door, chest, etc... individually. If you're editting the OC or other premade modules, this would be quite the pain. If you're making your own custom module, then just premake doors, chests, etc... on your pallettes



#12
Shadooow

Shadooow
  • Members
  • 4 470 messages

Hi guys, i just wondering if is possible to attach these script to ALL doors/traps without doing it individually? Thx for answers.

it is by using a letoscript macro, read more here



#13
Proleric

Proleric
  • Members
  • 2 350 messages
Yes, letoscript is your friend - well worth the learning curve, otherwise good ideas like this just get filed under "too difficult" in my experience.