Aller au contenu

Photo

Adding xp for unlocking doors and traps etc.


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

#1
maglalosus

maglalosus
  • Members
  • 51 messages
I've noticed in some mods that these two scripts are used:

bb_give_xp_onunlock

bb_give_xp_ondisarm

However, i don't have them in my list (when the little arrow is clicked to bring up a list of scripts to choose from in the properties)

1. Why are they not there?

2. Is it ok to just type them in instead?

THANKS for any help - M

#2
kamal_

kamal_
  • Members
  • 5 250 messages
They were probably written by the mod author. I have disarm/unlock scripts in Path of Evil if you've downloaded it. Kaldor's sample campaign probably does too.

#3
Kaldor Silverwand

Kaldor Silverwand
  • Members
  • 1 592 messages
bb is Kaldor :) , so those scripts are from my Silverwand Sample Campaign. They are also used in my King's Festival campaign. You can download one of those and copy the files (both .ncs and .nss versions) from the campaign folders into your campaign folder (or module folder if you work in directory mode).

I think they eventually added a couple of standard gp (I think) scripts that work similarly, although not exactly the same algorithm as mine. You could probably find those by using the Open Conversation/Script menu option and typing in lock. (I don't have access to the toolset at the moment).

Regards

Modifié par Kaldor Silverwand, 04 mai 2011 - 10:10 .


#4
Dann-J

Dann-J
  • Members
  • 3 161 messages
The standard scripts used in one of the later campaigns (MotB I think) set the XP value to three times the difficulty of the lock or trap. When selecting a script from the dropdown menu in the OnUnlock or OnDisarm section of the container or trap trigger, try typing words like 'lock' or 'disarm' to reduce the list of available scripts. You should recognise the right one (I think they usually have 'XP' in their names as well).

Modifié par DannJ, 04 mai 2011 - 10:51 .


#5
maglalosus

maglalosus
  • Members
  • 51 messages
OK thanks guys. Posted Image

Modifié par maglalosus, 04 mai 2011 - 11:01 .


#6
Kaldor Silverwand

Kaldor Silverwand
  • Members
  • 1 592 messages
The scripts (which were indeed added with MotB) are go_xp_lock (which gives 3 * the UnlockDC in xp) and go_xp_trap (which gives 5 * the DisarmDC in xp). The xp given is to all members of the party, not just the character doing the work. Oddly the comments in both scripts mistakenly refer to them as "ga_" rather than "go_". They are not ga type (conversation action) scripts.

In contrast my scripts (the versions included with King's Festival) allow an option of using a module variable to specify that xp should be given only to the character doing the action rather than the whole party. By default the xp is given to the whole party. Also my scripts give far less xp: for unlocking the xp earned is equal to the Unlock DC; for disarming the xp earned is 3 * the DisarmDC.

Regards

#7
Shaughn78

Shaughn78
  • Members
  • 637 messages
I have another variation of the trap disarm xp, if you want it I can post. It assigns a CR to each of the base type traps and increases and decreases it based on trap detect and disarm DC. DC is set closely to the 3.5 Dungeon Master Guide. XP is rewarded using the experience 2da, it it is rewarded similar to creatures. A lower level party will gain more experience than a higher level party disarming the same trap.

#8
Morbane

Morbane
  • Members
  • 1 883 messages

Shaughn78 wrote...

I have another variation of the trap disarm xp, if you want it I can post. It assigns a CR to each of the base type traps and increases and decreases it based on trap detect and disarm DC. DC is set closely to the 3.5 Dungeon Master Guide. XP is rewarded using the experience 2da, it it is rewarded similar to creatures. A lower level party will gain more experience than a higher level party disarming the same trap.


Shaughn - I would like to see that script! :)

#9
Shaughn78

Shaughn78
  • Members
  • 637 messages
Here it is.
The nTrap is the trap_base_type_*** from the traps.2da
A local variable "set_cr" can be placed on individual traps. It will override the base trap CR, it is also required for script based traps.
As I said it uses the Dungeon Master Guide, Tables 3-13 and 3-14. Essentially the CR increaes +1 for every 7 points of average damage. "2d8 = 9 points average damage rounded down +1 CR". For Spell traps spell level = CR.


/*
Written by Shaughn
For the Risen Hero Campaign

calculates trap CR and provides xp to party



*/


#include "ginc_2da"

int GetTrapXP(object oDisarm,int nTotalCR);
void GiveXP(int nXP);

void main()
{
object oDisarm = GetLastDisarmed();
int nLevel = GetTotalLevels(oDisarm,TRUE);
int nDC = GetTrapDisarmDC(OBJECT_SELF);
int nTrap = GetTrapBaseType(OBJECT_SELF);
int nDetect = GetTrapDetectDC(OBJECT_SELF);
int nSetCR = GetLocalInt(OBJECT_SELF,"set_cr");
int nCR;
int nInc1;
int nInc2;
int nTotalCR;

//based on trap base type sets CR, based on Dungeon Master's Guide 3.5
if(nTrap == 0)
{
nCR = 1;
}

else if(nTrap == 6 || nTrap == 5 || nTrap == 12 || nTrap == 4)
{
nCR = 2;
}

else if(nTrap == 8 || nTrap == 1 || nTrap == 24 || nTrap == 33
|| nTrap == 7 || nTrap == 32 || nTrap == 13)
{
nCR = 3;
}
else if(nTrap == 16 || nTrap == 2 || nTrap == 56)
{
nCR = 4;
}
else if(nTrap == 36 || nTrap == 37 || nTrap == 25 || nTrap == 17
|| nTrap == 34 || nTrap == 28 || nTrap == 29 || nTrap == 9)
{
nCR = 5;
}
else if(nTrap == 14 || nTrap == 57 || nTrap == 30)
{
nCR = 6;
}
else if(nTrap == 31 || nTrap == 38 || nTrap == 10 || nTrap == 40 || nTrap == 26)
{
nCR = 7;
}
else if(nTrap == 21 || nTrap == 35 || nTrap == 41 || nTrap == 11 || nTrap == 27)
{
nCR = 8;
}
else if(nTrap == 15 || nTrap == 20 || nTrap == 39 || nTrap == 18)
{
nCR = 9;
}
else if(nTrap == 42 || nTrap == 50)
{
nCR = 10;
}
else if(nTrap == 487 || nTrap == 3)
{
nCR = 11;
}
else if(nTrap == 22 || nTrap == 43)
{
nCR = 12;
}
else if(nTrap == 47 || nTrap == 49)
{
nCR = 13;
}
else if(nTrap == 19 || nTrap == 51)
{
nCR = 14;
}
else if(nTrap == 23)
{
nCR = 16;
}
else if(nTrap == 54)
{
nCR = 17;
}
else if(nTrap == 45 || nTrap == 55)
{
nCR = 19;
}
else if(nTrap == 52)
{
nCR = 21;
}
else if(nTrap == 53 || nTrap == 44)
{
nCR = 25;
}
else
{
nCR = 2;
}

//variable set on trap overrides CR, used on projectile traps
if(nSetCR != 0)
{
nCR = nSetCR;
}


//Modifies CR based on DC to disarm
if(nDC > 30)nInc1 = 2;
else if(nDC > 25)nInc1 = 1;

if(nDC < 15) nInc1 = -1;


//modifies CR based on DC to detect
if(nDetect > 30)nInc2 = 2;
else if(nDetect > 25)nInc1 = 1;

if(nDetect < 15) nInc1 = -1;


//total CR
nTotalCR = nCR + nInc1 + nInc2;

//Can't have trap with less than 1 CR
if(nTotalCR < 1)nTotalCR = 1;

//sets and gives xp
int nXP = GetTrapXP(oDisarm,nTotalCR);
GiveXP(nXP);
}

//Gets xp based on character level and trap CR using xptable 2da
int GetTrapXP(object oDisarm,int nTotalCR)
{


string sColumn = "C"+IntToString(nTotalCR)+"";
int nRow = GetTotalLevels(oDisarm,TRUE);

int nXP = Get2DAInt("xptable",sColumn,nRow);

//Debug
SendMessageToPC(oDisarm,"Character Level: "+IntToString(nRow)+". Trap CR: "+sColumn+". Experience Given "+IntToString(nXP)+".");

return nXP;
}

//gives xp to all party members
void GiveXP(int nXP)
{
object oPC = GetFirstPC();
object oMember = GetFirstFactionMember(oPC,FALSE);

while (GetIsObjectValid(oMember))
{
if(oPC != oMember)
{
GiveXPToCreature(oMember, nXP);
}
oMember = GetNextFactionMember(oPC,FALSE);
}
while (GetIsObjectValid(oPC))
{
if(oPC != oMember)
{
GiveXPToCreature(oPC, nXP);
}
oPC = GetNextPC();
}

}

Modifié par Shaughn78, 05 mai 2011 - 11:21 .


#10
rjshae

rjshae
  • Members
  • 4 491 messages
Given that many (if not most) unlocks and trap disarm attempts take 20, do you really want to be handing out XP for that?

#11
Shaughn78

Shaughn78
  • Members
  • 637 messages
Unlock uses a 20 unless in battle, disarm always rolls and has the chance of setting off the trap.

As for trap xp, I like the idea of having other sources of xp other than mostly relying on combat. While reloaded will ensure that a player gets all the xp and will exploit this type of xp rewards I still think it is a good thing.
Traps do offer a challange to a party, using consumables and spells to buff for disarming or healing after a failed attempt should offer some type of reward for traps.

I have a slightly different script for locks but it agains scales the xp based on the players unlock skill vs the lock dc. So a more expeirenced player will get less xp for the same door vs a lower level character. My unlock script only gives xp to the unlocking character and not the party and gives a bonus should a door be unlocked during combat since they actually have to roll instead of just getting 20.

Modifié par Shaughn78, 06 mai 2011 - 12:53 .


#12
GhostOfGod

GhostOfGod
  • Members
  • 863 messages
If this is a PW then one other thing to consider is having multiple players having the oportunity to open the same locks and disarming the same traps. Our locks and traps reset so we allow XP for each lock or trap once per reset by putting the players name as a variable on the object and then checking for it in the script. We don't do anything else real fancy. Just gives xp to the person who unlocked or disarmed.

Unlock:

const int DC_XP_MULTIPLIER = 10;

void main()
{
    object oPC = GetLastUnlocked();
    string sPC = "L" + GetName(oPC);
    
    if (!GetLocalInt(OBJECT_SELF, sPC))
    {        
        int iDC = GetLockUnlockDC(OBJECT_SELF);
        int iXP = iDC * DC_XP_MULTIPLIER;
        
        GiveXPToCreature(oPC, iXP);
        SetLocalInt(OBJECT_SELF, sPC, 1);    
    }
}


Disarm:

const int DC_XP_MULTIPLIER = 10;

void main()
{
    object oPC = GetLastDisarmed();
    string sPC = "T" + GetName(oPC);
    
    if (!GetLocalInt(OBJECT_SELF, sPC))
    {        
        int iDC = GetTrapDisarmDC(OBJECT_SELF);
        int iXP = iDC * DC_XP_MULTIPLIER;

        GiveXPToCreature(oPC, iXP);
        SetLocalInt(OBJECT_SELF, sPC, 1);                
    }
}

Modifié par GhostOfGod, 06 mai 2011 - 07:07 .


#13
Morbane

Morbane
  • Members
  • 1 883 messages

GhostOfGod wrote...

Unlock:

const int DC_XP_MULTIPLIER = 10;

void main()
{
    object oPC = GetLastUnlocked();
    string sPC = "L" + GetName(oPC);
    
    if (!GetLocalInt(OBJECT_SELF, sPC))
    {        
        int iDC = GetLockUnlockDC(OBJECT_SELF);
        int iXP = iDC * DC_XP_MULTIPLIER;
        
        GiveXPToCreature(oPC, iXP);
        SetLocalInt(OBJECT_SELF, sPC, 1);    
    }
}


Disarm:

const int DC_XP_MULTIPLIER = 10;

void main()
{
    object oPC = GetLastDisarmed();
    string sPC = "T" + GetName(oPC);
    
    if (!GetLocalInt(OBJECT_SELF, sPC))
    {        
        int iDC = GetTrapDisarmDC(OBJECT_SELF);
        int iXP = iDC * DC_XP_MULTIPLIER;

        GiveXPToCreature(oPC, iXP);
        SetLocalInt(OBJECT_SELF, sPC, 1);                
    }
}


That looks nice and tidy GOG   B)