View previous topic :: View next topic |
Author |
Message |
Snoteye
Joined: 05 Jun 2010 Posts: 4
|
Posted: Sat Jun 05, 2010 17:25 Post subject: |
|
|
I was hoping to use GetFirst/NextLocalVariable() to test for variable existence, the catch being that some of those variables will invariably return OBJECT_INVALID. Does anyone know if, for objects, GetIsVariableValid() tests if the variable reference is valid or if it works like GetIsObjectValid()? |
|
Back to top |
|
|
Baaleos
Joined: 02 Sep 2007 Posts: 830
|
Posted: Mon Jun 07, 2010 6:49 Post subject: Object invalid |
|
|
As far as I know, object_invalid is just a label for the constant value of 0c or perhaps -1.
What I would suggest is that you make your loop, function determine the variable type returned first.
Float, int, string, object etc
then for each of them put in the code for each one, I would leave objects till last, because I'm unsure if object invalid may be interchangeable with the int counterpart 0.
Once you have an object, which is NOT object_invalid or 0, you can do GetIsObjectValid, to return true or false. Or you can do
if object equals OBJECT_INVALID then cease. But that being said it might be counter productive since if it gets this far, it's already been validated as an object. The problem arises with players as locally stored objects. A player object is valid, but becomes invalid when logged out, and the return value of invalid may b mistaken as int value. Meaning your error handling may mistakenly call a player object an int value or something like that.
Eg
is player valid
no - report this
reporting that returned value was object_invalid which also may have value of 0 or -1 not sure which. So is this an int or an object at this point in the code? |
|
Back to top |
|
|
Snoteye
Joined: 05 Jun 2010 Posts: 4
|
Posted: Mon Jun 07, 2010 9:11 Post subject: |
|
|
I was afraid something like that might happen. I'll find a different solution. Thanks, though. |
|
Back to top |
|
|
Paul R
Joined: 17 Apr 2009 Posts: 42
|
Posted: Fri Feb 11, 2011 0:21 Post subject: Func_SetArmorAC |
|
|
Hi,
There is a missing source file and Makefile.in definition for this function that is causing the current revision (374) nwnx_funcs.so to fail to load at startup.
This seems to have crept in at revision 369, sorry I didn't spot it before.
Code: | ERROR: dlopen: ./nwnx_funcs.so: ./nwnx_funcs.so: undefined symbol: Func_SetArmorAC |
Let me know if you need any more info.
Paul _________________ oops |
|
Back to top |
|
|
virusman
Joined: 30 Jan 2005 Posts: 1020 Location: Russia
|
Posted: Fri Feb 11, 2011 8:47 Post subject: |
|
|
Thanks for the info. I've reverted the bugged revision. _________________ In Soviet Russia, NWN plays you! |
|
Back to top |
|
|
Ilerien
Joined: 31 Jan 2010 Posts: 3 Location: Russia
|
|
Back to top |
|
|
Paul R
Joined: 17 Apr 2009 Posts: 42
|
Posted: Mon Feb 14, 2011 20:50 Post subject: |
|
|
No problem I'll give it a go, was looking forward to that function as well... _________________ oops |
|
Back to top |
|
|
Zunath
Joined: 06 Jul 2006 Posts: 183
|
Posted: Thu Jul 21, 2011 2:52 Post subject: |
|
|
I'm in the process of porting some of my windows code over to linux and was wondering if there were plans to implement a "SetClassByPosition" function like the windows version has?
Or maybe it's in another plugin?
Thanks! |
|
Back to top |
|
|
kucik
Joined: 11 Feb 2009 Posts: 19 Location: Czech Republic
|
Posted: Mon Aug 15, 2011 17:00 Post subject: |
|
|
SetClassByPosition could be really great. I hope it will be possible to create NPC from level progress description. _________________ 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: Sat Mar 17, 2012 16:32 Post subject: |
|
|
Hi!
I'm fiddling with the Set/AddSpecialAbility functions, to make mobs a bit unique. As is see, the parameters are: spellid, spell-ready num, and a spell level. I've tested a little, and:
- i cannot set the ready num, it's always 1 on the mob.
- if i set the spell-level above 15 (which is a toolset cap), the ability cannot be used. This is an engine cap?
thx
EDIT: i realised that the ready parameter is a boolean
Last edited by Ravine on Wed Mar 21, 2012 10:50; edited 1 time in total |
|
Back to top |
|
|
DM_Vecna
Joined: 10 Feb 2010 Posts: 37
|
Posted: Sun Mar 18, 2012 21:55 Post subject: |
|
|
Not to take away from the question of the poster before me but I also have a question about get/SetFactionId. Would it be possible to use this in AdjustReputation without having to use two creatures? |
|
Back to top |
|
|
Ave
Joined: 08 Apr 2012 Posts: 8
|
Posted: Mon May 07, 2012 9:56 Post subject: |
|
|
I'm having a bit of confusion with the SetPCSkillPoints function. Is this a bug, or am I misunderstanding what it is supposed to be doing? I have NWscript code like this, to simulate spending a skill point for characters that store skill points on levelup.
Code: | #include "nwnx_funcs"
void SpendPointOnSkill(object oPC, int nSkill)
{
int nPoints=GetPCSkillPoints(oPC);
SendMessageToPC(oPC,"You have "+IntToString(nPoints)+" skill points remaining.");
SetPCSkillPoints(oPC,nPoints-1);
ModifySkillRankByLevel(oPC,GetHitDice(oPC),nSkill,1);
} |
This function increments the skill, and the message gives progressively decreasing numbers (ex: 5,4,3,2,1) when this function is run repeatedly, which is correct. BUT when the player gains another level, their levelup interface reports as if the skill points had never been decremented (so it shows the original 5 they started with before I changed their skill points, plus 5 more skill points the PC got from gaining the new level). Furthermore, if they -do- try to spend all those skill points, they get the following message: "[Server] Character applied invalid number of skillpoints." If they spend fewer skill points, they can level up, but then they get to use all the 'extra' skill points at a later level with no more server error message. |
|
Back to top |
|
|
acomputerdood
Joined: 30 Nov 2008 Posts: 27
|
Posted: Wed Sep 26, 2012 15:18 Post subject: |
|
|
i had a question about ActionUseItem(). from the .nss file:
Code: | void ActionUseItem (object oItem, object oTarget, location lTarget, int nProp) {
object oArea = GetAreaFromLocation(lTarget);
vector vVec = GetPositionFromLocation(lTarget);
if (!GetIsObjectValid(oArea))
return;
SetLocalString(OBJECT_SELF, "NWNX!FUNCS!ACTIONUSEITEM",
ObjectToString(oItem) + "¬" + ObjectToString(oTarget) + "¬" +
ObjectToString(oArea) + "¬" + FloatToString(vVec.x) + "¬" +
FloatToString(vVec.y) + "¬" + FloatToString(vVec.z) + "¬" +
IntToString(nProp));
}
void ActionUseItemAtLocation (object oItem, location lTarget, int nProp=0) {
ActionUseItem(oItem, OBJECT_INVALID, lTarget, nProp);
}
void ActionUseItemOnObject (object oItem, object oTarget, int nProp=0) {
ActionUseItem(oItem, OBJECT_INVALID, GetLocation(oTarget), nProp);
} |
the ActionUseItemOnObject() just seems wrong. it doesn't actually use the item on the object, it obviously just uses the item at the location of the object. i have to think that this was intentional because i don't think virusman would make a mistake like this. is it a limitation of the function/engine to not allow for it?
when i get a chance, i want to check what would happen if the function were instead:
Code: | void ActionUseItemOnObject (object oItem, object oTarget, int nProp=0) {
ActionUseItem(oItem, oTarget, GetLocation(oTarget), nProp);
} |
i'm also curious about what it's doing behind the scenes. like if it will still default to the location and ignore the object altogether. i guess i have the source code for the plugin to answer that question for me. |
|
Back to top |
|
|
acomputerdood
Joined: 30 Nov 2008 Posts: 27
|
Posted: Thu Sep 27, 2012 3:07 Post subject: |
|
|
i just wanted to note that doing:
Code: | void ActionUseItemOnObject (object oItem, object oTarget, int nProp=0) {
ActionUseItem(oItem, oTarget, GetLocation(oTarget), nProp);
} |
works perfectly. i would imagine the could should be updated. |
|
Back to top |
|
|
Monti
Joined: 06 May 2011 Posts: 5
|
Posted: Sat Sep 29, 2012 11:15 Post subject: |
|
|
SetClericDomain() function work? I can not make it work, there is no change in the PC or in their feats, anyone can help me? |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|