As the title says. I have created a mobile AoE that can cause damage, is an Sphere of Annihilation. The problem that i have is that because the object isn’t in the party, it doesn’t grant you xp when it kill a creature.
What i need to know is how get the XP that said creature gives when it dies.
I think the XP you get from kills is determined by the level of the party member that did the killing blow and the DC of the creature. I don’t know the whole mechanics behind it, but that’s the gist of it I think.
To find out what xp the creatures would give if you killed them set up a test area and put the creatures in it and give them different challenge ratings and names that correspond( eg challenge rating 5 name chal5 ), give them all 1hp and send in a character that’s the level of the one that will meet them and kill them all. Then read the little box and you’ll see how much xp each creature gives when you kill it.
If the problem is that the sphere kills everything so the party gets no xp then you could leave something on the dead bodies that you can take to another npc to trade with ( like orc teeth ) and give the xp that way depending on how many you have.
Or just add up all the xp from the creatures that will die now that you now it from testing and give it when you leave an area or complete a quest.
Here’s a more detailed script that gets the xp from creatures. I guess you could integrate it into your own scripts:
/*
XP from killing creatures is determined using the xptable.2da.
The party level equals the total levels of all party members (including associates) divided
by the number of party members (including associates) rounded down.
The challenge rating of the creature killed is determined from its properties (rounded down).
The XP is further affected by the module's XP Scale: e.g. 10 = 100%, 5 = 50%, 2 = 20%.
An XP Scale of 0 means NO XP will be awarded for killing creatures. It does not effect
XP awarded through script.
*/
#include "ginc_overland"
#include "x0_i0_partywide"
void main()
{
object oCreature = GetEnteringObject();
float fCR = GetChallengeRating(oCreature);
int nCR = FloatToInt(fCR);
string s2DAColumn = "C" + IntToString(nCR);
int nPartyCR = GetPartyChallengeRating();
int n2DARow = nPartyCR - 1;
string sXP = Get2DAString("xptable", s2DAColumn, n2DARow);
int nXPScale = GetModuleXPScale();
float fXPmultiplier = IntToFloat(nXPScale) / 10;
float fXP = StringToFloat(sXP) * fXPmultiplier;
int nXP = FloatToInt(fXP);
object oPC = GetFirstPC(FALSE);
GiveXPToAll(oPC, nXP);
// debug
/* SendMessageToPC(oPC, "Raw Creature CR = " + FloatToString(fCR));
SendMessageToPC(oPC, "Creature CR rounded down = " + IntToString(nCR));
SendMessageToPC(oPC, "2da column = " + s2DAColumn);
SendMessageToPC(oPC, "Party CR rounded down = " + IntToString(nPartyCR));
SendMessageToPC(oPC, "2da row = " + IntToString(n2DARow));
SendMessageToPC(oPC, "2da XP = " + sXP);
SendMessageToPC(oPC, "XP scale = " + IntToString(nXPScale));
SendMessageToPC(oPC, "XP scale multiplier = " + FloatToString(fXPmultiplier));
SendMessageToPC(oPC, "Raw XP = " + FloatToString(fXP));
SendMessageToPC(oPC, "XP = " + IntToString(nXP));
SendMessageToPC(oPC, "======");
*/
}
Thank you very much, this is working as intended. I turned it into a reusable procedure:
GetLocalObject(oSlainCreature,“MASTER”) is local that i use for my custom summoned creatures.
//Calculates how much XP oSlainCreature grants on death and gives it to oReceiver party.
void CollectXP(object oSlainCreature, object oReceiver)
{
if(GetAssociateType(oSlainCreature)==ASSOCIATE_TYPE_NONE
&& GetLocalObject(oSlainCreature,"MASTER")==OBJECT_INVALID)//Creatures that are summoned or henchman don't grant xp
{
float fCR = GetChallengeRating(oSlainCreature);
int nCR = FloatToInt(fCR);
string s2DAColumn = "C" + IntToString(nCR);
int nPartyCR = GetPartyChallengeRating();
int n2DARow = nPartyCR - 1;
string sXP = Get2DAString("xptable", s2DAColumn, n2DARow);
int nXPScale = GetModuleXPScale();
float fXPmultiplier = IntToFloat(nXPScale) / 10;
float fXP = StringToFloat(sXP) * fXPmultiplier;
int nXP = FloatToInt(fXP);
object oLeader = GetFactionLeader(oReceiver);
object oParty = GetFirstFactionMember(oLeader,FALSE);
while(GetIsObjectValid(oParty))//Scan the party member list
{
object oMaster = GetMaster(oParty);
if(GetAssociateType(oParty) == ASSOCIATE_TYPE_HENCHMAN
|| GetIsOwnedByPlayer(oParty))//XP to henchman and PC only
{
GiveXPToCreature(oParty,nXP);
}
oParty = GetNextFactionMember(oLeader,FALSE);
}
}
}
Alternatively, if you are scripting the damage from the item, you can set the OBJECT_SELF for the assignment of damage to the PC with the AssignCommand function: