View previous topic :: View next topic |
Author |
Message |
arvikk
Joined: 29 Sep 2012 Posts: 1
|
Posted: Sat Sep 29, 2012 12:27 Post subject: |
|
|
you have to change feats separatly.
Code: | void ChangeDomain(object oTarget, int nOldDomain, int nNewDomain)
{
int nFindFeat = StringToInt(Get2DAString("domains", "GrantedFeat", nOldDomain));
int nNewFeat = StringToInt(Get2DAString("domains", "GrantedFeat", nNewDomain));
if(nFindFeat != 0 && nNewFeat != 0) {
int nIndex = 1;
if(GetClericDomain(oTarget, nIndex) != nOldDomain) {
nIndex = 2;
if(GetClericDomain(oTarget, nIndex) != nOldDomain) {
nIndex = 0;
}
}
if(nIndex != 0) {
SetClericDomain(oTarget, nIndex, nNewDomain);
int nFeatIdx = 0,
nFeats = GetTotalKnownFeats(oTarget);
while(nFeatIdx < nFeats) {
if(GetKnownFeat(oTarget, nFeatIdx) == nFindFeat) {
SetKnownFeat(oTarget, nFeatIdx, nNewFeat);
break;
}
++nFeatIdx;
}
int nHD = GetHitDice(oTarget);
int nLevel = 1;
while(nLevel <= nHD) {
if(GetClassByLevel(oTarget, nLevel) == CLASS_TYPE_CLERIC) {
break;
}
++nLevel;
}
nFeatIdx = 0;
nFeats = GetTotalKnownFeatsByLevel(oTarget, nLevel);
while(nFeatIdx < nFeats) {
if(GetKnownFeatByLevel(oTarget, nLevel, nFeatIdx) == nFindFeat) {
SetKnownFeatByLevel(oTarget, nLevel, nFeatIdx, nNewFeat);
break;
}
++nFeatIdx;
}
}
}
}
|
|
|
Back to top |
|
|
Monti
Joined: 06 May 2011 Posts: 5
|
Posted: Sun Sep 30, 2012 22:02 Post subject: |
|
|
Thanks arvikk for the quick answer! I'll test you code |
|
Back to top |
|
|
DM_Vecna
Joined: 10 Feb 2010 Posts: 37
|
Posted: Mon Jul 07, 2014 6:13 Post subject: |
|
|
I am trying to use DumpLocalVariables but after debugging it appears that GetLocalVariableByPosition is returning all variable types as 0 for me. Has anyone got this working or is this a known issue? My end goal is to output all the variables on a creature.
Thanks! |
|
Back to top |
|
|
Ravine
Joined: 26 Jul 2006 Posts: 105
|
Posted: Tue Jul 08, 2014 10:57 Post subject: |
|
|
DumpLocalVariables works for me, except it crashes the server when i use it on an area object (at least it was a problem a year ago). |
|
Back to top |
|
|
DM_Vecna
Joined: 10 Feb 2010 Posts: 37
|
Posted: Thu Jul 10, 2014 21:33 Post subject: |
|
|
Thanks Ravine for te help I was able to find the issue which was in the script that I downloaded for this. |
|
Back to top |
|
|
farhorizon
Joined: 07 Dec 2012 Posts: 12
|
Posted: Sun Sep 28, 2014 8:09 Post subject: |
|
|
Is there any hook for 'on player leaving' for the linux version of this plugin? I don't see it documented, but maybe I just missed it, or it is in some other plugin? |
|
Back to top |
|
|
elven
Joined: 28 Jul 2006 Posts: 259 Location: Germany
|
Posted: Sun Sep 28, 2014 10:15 Post subject: |
|
|
farhorizon wrote: | Is there any hook for 'on player leaving' for the linux version of this plugin? I don't see it documented, but maybe I just missed it, or it is in some other plugin? |
Don't think so. Just Client Disconnect, at which point the CNWSPlayer object is already disassociated (I think).
Anything in particular you'd want to do with it? |
|
Back to top |
|
|
farhorizon
Joined: 07 Dec 2012 Posts: 12
|
Posted: Sun Sep 28, 2014 17:21 Post subject: |
|
|
I could do a few things with it, but I think they can all be worked around with more scripting.
- track online time by looking at a player logintime (recorded in on client enter) vs their leave time and logging/writing to a db.
- get the area associated with the player leaving & if they were the last player in that area, set a delay command to clean it up if no one enters it in N seconds.
- cleanup custom resources associated with the player
I suppose I can do the first in the standard leave script, I would just need to record some extra information as locals (player account name, ip, etc that is not accesible in the leave script).
For the second, I suppose I could set a local string on the player each time they enter an area, which is the tag of the area & then just load the area via tag when they logout. This doesn't really seem that bad, compared to stray DelayCommands running to see if there is anyone left in an area.
The last could likely be handled by area cleanup scripts, given a decent implementation of the above. Or it could be done via locals in on client leave, if it was cross area stuff.
So, I guess I can work around it without that much trouble after all. |
|
Back to top |
|
|
elven
Joined: 28 Jul 2006 Posts: 259 Location: Germany
|
Posted: Mon Sep 29, 2014 10:23 Post subject: |
|
|
Not sure about this (has been a looong time since I fiddled with that), but wouldn't the Area Exit event work for this too? The player object should still be valid then. |
|
Back to top |
|
|
farhorizon
Joined: 07 Dec 2012 Posts: 12
|
|
Back to top |
|
|
elven
Joined: 28 Jul 2006 Posts: 259 Location: Germany
|
Posted: Mon Sep 29, 2014 17:13 Post subject: |
|
|
Alright, as long as it works. I'm sure one could hook a similar event on linux too, but it seems kind of low-priority. :) |
|
Back to top |
|
|
kucik
Joined: 11 Feb 2009 Posts: 19 Location: Czech Republic
|
Posted: Thu Feb 05, 2015 15:12 Post subject: |
|
|
Hey. I've tried to dump all variables on modul simply by:
Code: | void __dumpModuleVariables() {
object oItem = GetModule();
WriteTimestampedLogEntry("************ Dump Module variables ************");
int cnt = GetLocalVariableCount(oItem);
int i;
struct LocalVariable lv;
WriteTimestampedLogEntry("************ Total "+IntToString(cnt)+" variables************");
for(i=0;i<cnt;i++) {
lv = GetLocalVariableByPosition(oItem,i);
WriteTimestampedLogEntry("* "+lv.name+" ("+IntToString(lv.type)+")");
}
WriteTimestampedLogEntry("************ Dump Module variables end *********");
} |
But i get 250872632 from GetLocalVariableCount() which i dont believe is correct and then server crashes in atempt to read them one by one.
Im using last nwnx changeset (03874980cd045f766bcda06e29219c75d0a96d15) from github. _________________ Les jambes en l'air, comme une femme lubrique,
Brûlante et suant les poisons,
Ouvrait d'une façon nonchalante et cynique
Son ventre plein d'exhalaisons. |
|
Back to top |
|
|
Ravine
Joined: 26 Jul 2006 Posts: 105
|
Posted: Thu Feb 05, 2015 16:59 Post subject: |
|
|
Yeah, afaik i had the same problem, maybe it's happens with area objects also. |
|
Back to top |
|
|
Zunath
Joined: 06 Jul 2006 Posts: 183
|
|
Back to top |
|
|
orth
Joined: 10 Apr 2005 Posts: 12
|
Posted: Mon Mar 30, 2015 4:09 Post subject: |
|
|
The code as it was did not support anything other than spells, feats, skills and some other random slot types like emotes, modes (Power Attack, Expertise etc). I'm not sure why it was limited to spells only though.
Items, custom macros and DM creator commands would never have worked.
I just so happened to rework this entirely to handle all quick bar types. I'm not a very advanced C programmer though so if anyone wants to take a look at my changes and let me know if there are better/easier ways to do things they're available here: https://github.com/plenarius/nwnx2-linux/commit/5c6738ad6c9cb7a768db52810505a412be1c70b6
The functions return a string of 4 fields separated by pipes (|) when you Func_GetQuickBarSlot and expects 7 fields separated by the not sign (¬) when you Func_SetQuickBarSlot. The pipe is necessary because there are spaces used in custom macro and dm creator label/commands. If a user includes a pipe in one of these two strings for some reason, they get an error.
Items in quickslots were a challenge to Get and Set in some persistent sense. You have to use StringToObject and store a var on the object for later retrieval.
Anyway, I made a generic lib available (not very well commented! sorry) if it might save you some time. You'll need a function that returns your player's unique identifier if you're building for a persistent world and edit the GetPlayerID function.
You can set the command either by voice chat or conversation, on our site we use "=c qb save default" for example then can be later restored with "=c qb restore default" The on player chat sets the LocalString "last_qb_command" and then executes the script from there.
NSS: https://github.com/plenarius/nwnx2-linux/blob/full_quickbars/plugins/funcs/nwnx_qb.nss
SQL: https://github.com/plenarius/nwnx2-linux/blob/full_quickbars/plugins/funcs/nwnx_qb.sql
This all might be moot if you're having trouble building though! That might be something you wish to work out first, heh.
Cheers |
|
Back to top |
|
|
|