logo logo

 Back to main page

The NWNX Community Forum

 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 
nwnx_funcs for windows
Goto page Previous  1, 2, 3 ... 6, 7, 8 ... 27, 28, 29  Next
 
Post new topic   Reply to topic    nwnx.org Forum Index -> Windows development
View previous topic :: View next topic  
Author Message
Skywing



Joined: 03 Jan 2008
Posts: 321

PostPosted: Tue May 25, 2010 3:45    Post subject: Reply with quote

axs wrote:
Game protocol may not support that change so maybe only solution is to force player reconnection
ActivatePortal(oPC, YourServerIP, YourServerPassord, "", TRUE);


For NWN2, GameObjUpdate.Update.Appearance / mask 0x4 will update the gender on the client. Uncertain as to whether that is new for NWN2 or was a holdover for NWN1 though.

The way I handle this for NWN2 is something along the lines of:

Code:
      if (Mask & 0x4)
      {
         unsigned char    Gender;
         CreatureObject * Creature;

         //
         // Gender update.
         //

         if (!Parser->ReadBYTE( Gender ))
            break;

         if ((Object != NULL) && ((Creature = Object->AsCreature( )) != NULL))
            Creature->SetGender( Gender );

         Mask &= ~0x4;
      }


The update mask for this data item may have changed since NWN1.

Additionally, GameObjUpdate.Update.Update / mask 0x10000 also contains the player's gender (among other attributes sent). I would try altering it via the appearance update first though.
Back to top
View user's profile Send private message
Baaleos



Joined: 02 Sep 2007
Posts: 830

PostPosted: Wed May 26, 2010 18:48    Post subject: special abilities handling Reply with quote

Im not sure, but didnt bioware specifically make it impossible for player characters to have 'special' abilities (such as monster abilities)

Perhaps the poster who referred to special abilities meant something different, in which case this can be ignored.


Anyhow...

The new addition, AddVFXForPC method thingi...

Does this add a visual effect, that is only visible to certain players from their perspective?


Eg - Would it be possible to apply a red glow to player 1, which is only visible from player 2's perspective?

If so, it gives alot of ideas regarding perception based powers. Detect Evil etc,

Or even feral abilities such as werewolf powers or vampire hunting at night.
Back to top
View user's profile Send private message
MaxRock



Joined: 24 Jan 2008
Posts: 196

PostPosted: Wed May 26, 2010 22:16    Post subject: Re: special abilities handling Reply with quote

Baaleos wrote:
Im not sure, but didnt bioware specifically make it impossible for player characters to have 'special' abilities (such as monster abilities)


I haven't looked into that but as a DM you can possess an NPC and use their Monster Abilities and still be treated as a player, so it should theoretically be possible.
Accessing them might be a whole different story since a regular player doesn't have the monster ability radial...

Baaleos wrote:
The new addition, AddVFXForPC method thingi...

Does this add a visual effect, that is only visible to certain players from their perspective?


Eg - Would it be possible to apply a red glow to player 1, which is only visible from player 2's perspective?

If so, it gives alot of ideas regarding perception based powers. Detect Evil etc,

Or even feral abilities such as werewolf powers or vampire hunting at night.


Yes and no. The effect is only visible for the PC you specify but its duration cannot be temporary or permanent.
Back to top
View user's profile Send private message Send e-mail MSN Messenger
Baaleos



Joined: 02 Sep 2007
Posts: 830

PostPosted: Wed May 26, 2010 22:38    Post subject: just a thought Reply with quote

I know bioware made it so that special abilities were no longer stored via bic files. Eg -Impossible to manipulate special abilities via letoscript.

This would suggest that storage of the special abilities is done outside of the bic files.

While the 'granting' of special abilities may be possible via nwnx, it may not be persistant between server instances, meaning it may require database or some sort of persistence engine, to re-add abilities on login for clients.

the
NWNXFuncs_ApplyVisualEffectForPC(object oPC, int nVFX, vector vPos)

Method,
Is it at all possible to make this work for duration effects or is it utterly impossible? If so, will it work on objects as targets? Eg - Apply the Effect (RED GLOW) to all EVIL creatures on the map, but only visible to oPC who has the Detect Evil Perk.

At the minute, it works via vector, which prevents locking on to an object as a target - eg - Locks onto x,y,z opposed to characters, which prevents duration or glow effects working. Sad
Back to top
View user's profile Send private message
ArielT



Joined: 26 Jan 2010
Posts: 30

PostPosted: Thu May 27, 2010 1:42    Post subject: Reply with quote

Would it be possible to make NWNXFuncs_AddKnownSpell() not modify the bic? Or maybe a sort of "safety" feature we can toggle that trolls through and deletes any prior instances of the spell when it's added? (Did someone already ask that?)
Back to top
View user's profile Send private message MSN Messenger
Baaleos



Joined: 02 Sep 2007
Posts: 830

PostPosted: Thu May 27, 2010 1:49    Post subject: dont think so Reply with quote

I dont have a full understanding of the way the nwnx functions operate, but from what I DO know, is that it gives the player the spell or feat requested, by triggering the already existing ingame method in the nwnserver executable, which communicates with the client etc.

In other words, the GiveSpell method that is in the nwnx_funcs tricks the nwnserver into giving the player the spell requested, as if they had leveled up or something, or as if they had memorized the spell in a legitamit fashion.


Unfortunately, this legitamit fashion, is probably commited to the bic file.

So in that regards to your question, its not really possible to my knowledge, to do a 'safe' add spell, since the method itself, behaves like a memorize. That and the fact that spells memorized are specifically saved in the bic, so it is something that would be saved anyway when exportbic is called.
Back to top
View user's profile Send private message
Baaleos



Joined: 02 Sep 2007
Posts: 830

PostPosted: Sat May 29, 2010 1:20    Post subject: Question: ModSkill/ModAbilityScore Reply with quote

Will these methods work on npc's?

Eg - To Raise their stats dynamically?
Back to top
View user's profile Send private message
ArielT



Joined: 26 Jan 2010
Posts: 30

PostPosted: Sat May 29, 2010 4:05    Post subject: Reply with quote

I may have an include from a version back, but you have a prototype for GetKnownSpells(), but the implementation is for NWNXFuncs_GetKnownSpells(). You should modify your prototype, I think.
Back to top
View user's profile Send private message MSN Messenger
MaxRock



Joined: 24 Jan 2008
Posts: 196

PostPosted: Sat May 29, 2010 5:51    Post subject: Reply with quote

Visual Effects
The current implementation simply calls a server function - which I stumpbled upon by accident - that takes Effect Number, Client (oPC) and a position as parameters.
Duration type visual effects are "slightly" more complex...

Spells and bic files
Just like Baaleos said, AddKnownSpell simply pushes a new spell id into the regular list of spells for a character. So when the character gets saved, it gets saved.
Are you having problems with duplicate spells?

Methods working on NPCs
Every function that has "object oCreature" as its first parameter should work on NPCs as well as players. (unless I messed up, see next item)

GetKnownSpells vs NWNXFuncs_GetKnownSpells
It's an error in the prototype "declaration" even in the latest include
Back to top
View user's profile Send private message Send e-mail MSN Messenger
ArielT



Joined: 26 Jan 2010
Posts: 30

PostPosted: Sat May 29, 2010 6:07    Post subject: Reply with quote

MaxRock wrote:
Spells and bic files
Just like Baaleos said, AddKnownSpell simply pushes a new spell id into the regular list of spells for a character. So when the character gets saved, it gets saved.
Are you having problems with duplicate spells?
Yeah, I was adding the spells again every time the player logged in and it was causing bic bloat / strange effects on leveling up. I did a NWNXFuncs_RemoveKnownSpell() prior to adding the spells and that seems to fix things, though. You know, it might be nice to have a way to just delete all spells of a particular level for a class.
Back to top
View user's profile Send private message MSN Messenger
ArielT



Joined: 26 Jan 2010
Posts: 30

PostPosted: Sat May 29, 2010 22:15    Post subject: Reply with quote

NWNXFuncs_GetKnownSpellCount() seems to just not work. I have a sorcerer that does:
Code:
SendMessageToPC(oPC,IntToString(NWNXFuncs_GetKnownSpellCount(oPC,CLASS_TYPE_SORCERER,0)));


And I always get zero in response. Am I maybe doing something wrong?
Back to top
View user's profile Send private message MSN Messenger
ArielT



Joined: 26 Jan 2010
Posts: 30

PostPosted: Sat May 29, 2010 22:47    Post subject: Reply with quote

NWNXFuncs_GetKnownSpells() should really return -1 if there are no spells known for a level rather than the current return of the original sent message including a big mass of spacer.
Back to top
View user's profile Send private message MSN Messenger
MaxRock



Joined: 24 Jan 2008
Posts: 196

PostPosted: Sun May 30, 2010 4:16    Post subject: Reply with quote

new (small bugfix) version is up:

Code:

v 0.0.72
   Fixed:
      NWNXFuncs_GetAllSpellsKnown will return an empty string on error or if no spells are found
      Wrong data type for effect index used by effect functions could lead to server crash
      Mismatch between prototype and implementation of NWNXFunsc_GetKnownSpells
      NWNXFuncs_GetKnowsSpell should now work correctly
      NWNXFuncs_GetKnownSpellCount wasn't passing any parameters


...forgot to put this in the changelog:
NWNXFuncs_AddKnownSpell will not add a duplicate spell if caster class and spell level are the same.
Back to top
View user's profile Send private message Send e-mail MSN Messenger
ArielT



Joined: 26 Jan 2010
Posts: 30

PostPosted: Sun May 30, 2010 19:27    Post subject: Reply with quote

Heroic.
Back to top
View user's profile Send private message MSN Messenger
Baaleos



Joined: 02 Sep 2007
Posts: 830

PostPosted: Wed Jun 02, 2010 18:33    Post subject: NWNXFuncs_GetAllSpellsKnown will return an empty string on e Reply with quote

Just a suggestion, but would it not be wiser to have the return values differ between empty spells, and Error unable to read spells?


Eg - On error return -1

- On No spells found return 0


I usually always try to differentiate between empty and unable to complete.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    nwnx.org Forum Index -> Windows development All times are GMT + 2 Hours
Goto page Previous  1, 2, 3 ... 6, 7, 8 ... 27, 28, 29  Next
Page 7 of 29

 
Jump to:  
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