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 ... 20, 21, 22 ... 27, 28, 29  Next
 
Post new topic   Reply to topic    nwnx.org Forum Index -> Windows development
View previous topic :: View next topic  
Author Message
MaxRock



Joined: 24 Jan 2008
Posts: 196

PostPosted: Wed Mar 02, 2011 6:46    Post subject: Reply with quote

Lokey wrote:
On temporary item properties, how are you acquiring the item property in script? There's lots of wonkiness there.


Can you elaborate on your question?
I'm assuming you're not talking about GetFirstItemProperty ... GetNextItemProperty?
Back to top
View user's profile Send private message Send e-mail MSN Messenger
Lokey



Joined: 02 Jan 2005
Posts: 158

PostPosted: Sun Mar 06, 2011 2:47    Post subject: Reply with quote

GetItemPropertyDurationType() is the function that doesn't work iirc...or at least doesn't return anything different for non-permanent item properties. Haven't been able to think of another way to grab temp properties Sad
_________________
Neversummer PW NWNx powered mayhem Wink
Back to top
View user's profile Send private message
MaxRock



Joined: 24 Jan 2008
Posts: 196

PostPosted: Mon Mar 07, 2011 18:55    Post subject: Reply with quote

Code:

void main() {
   object oDagger = GetFirstItemInInventory();
   
   itemproperty ipDamage = ItemPropertyDamageBonus(IP_CONST_DAMAGETYPE_COLD, IP_CONST_DAMAGEBONUS_6);
   itemproperty ipAttack = ItemPropertyAttackBonus(4);
   
   AddItemProperty(DURATION_TYPE_PERMANENT, ipDamage, oDagger);
   AddItemProperty(DURATION_TYPE_TEMPORARY, ipAttack, oDagger, 10.0);
   
   itemproperty ip = GetFirstItemProperty(oDagger);
   while (GetIsItemPropertyValid(ip)) {
      PrintString("ipType: " +IntToString(GetItemPropertyType(ip))+ " | ipDurationType: " +IntToString(GetItemPropertyDurationType(ip)));
      ip = GetNextItemProperty(oDagger);
   }
}


Code:

nwserverlog1.txt

ipType: 16 | ipDurationType: 2  // 16 = ITEM_PROPERTY_DAMAGE_BONUS
ipType: 56 | ipDurationType: 1  // 56 = ITEM_PROPERTY_ATTACK_BONUS


Seems to be working.
Back to top
View user's profile Send private message Send e-mail MSN Messenger
Baaleos



Joined: 02 Sep 2007
Posts: 830

PostPosted: Wed Mar 09, 2011 13:37    Post subject: OnClientLeave hook? Reply with quote

Hey Maxrock,
I got a request from someone to try and hook onto the ClientLeave event, so players can get hold of the character and the area they are in at the time of leaving (onClientLeave fires too late).


Would hooking at this point work?

CNWSPlayer::SaveServerCharacter(int)
Located at 004317A0

I've traced what functions call this, and it looks like it gets called at various times, however the time that we are interested in is when CExoAppInternal::PlayerListChange and RemovePCFromWorld are fired.

However, my hunch would say that it would be better to hook at
CServerExoAppInternal::RemovePCFromWorld(class CNWSPlayer *)
(0045B990)
Because at this point in time, the player still exists in the world (If the player didnt exist, then the function wouldnt be needed), so any hook that is made, will fire before this function, and thus fire while the player still exists, allowing nwnscript to get hold of the player character, then when the nwnscript is finished, the RemovePCFromWorld function will take over, and make the player vanish.
Back to top
View user's profile Send private message
MaxRock



Joined: 24 Jan 2008
Posts: 196

PostPosted: Wed Mar 09, 2011 20:27    Post subject: OnClientLeave hook Reply with quote

ok, here you go Smile

Updated to version 0.88.
Files can be found in the usual place (see very first post of this thread)
Back to top
View user's profile Send private message Send e-mail MSN Messenger
ShaDoOoW



Joined: 20 Aug 2005
Posts: 584

PostPosted: Wed Mar 09, 2011 21:21    Post subject: Reply with quote

Awesome. The original requester was me so thanks a lot MaxRock.
_________________
Community Patch / NWNX Patch / NWNX Files / NWNX Connect
Back to top
View user's profile Send private message
Lokey



Joined: 02 Jan 2005
Posts: 158

PostPosted: Thu Mar 10, 2011 7:15    Post subject: Reply with quote

Thx Max, perhaps it's something polymorph specific then. Works in general case, checked previous code and don't see how it's failing off the top of my head. So something to look into, and hopefully that'll be it for the thread drift Smile

This works in unequip script (some arcane archer cheeseball fun)
Code:
            itemproperty ip = GetFirstItemProperty(oItem);
            while(GetIsItemPropertyValid(ip))
            {
                if(GetItemPropertyType(ip) == ITEM_PROPERTY_KEEN &&
                   GetItemPropertyDurationType(ip) == DURATION_TYPE_TEMPORARY)
                    RemoveItemProperty(oItem, ip);
                ip = GetNextItemProperty(oItem);
            }


This didn't work as part of our polymorph functions (would consider all item props as perm duration)
Code:
     while(GetIsItemPropertyValid(IP))
     {
         if(GetItemPropertyDurationType(IP) == DURATION_TYPE_PERMANENT)
             AddItemProperty(DURATION_TYPE_PERMANENT, IP, oTarget);
         IP = GetNextItemProperty(oSource);
     }
Back to top
View user's profile Send private message
Baaleos



Joined: 02 Sep 2007
Posts: 830

PostPosted: Thu Mar 10, 2011 12:40    Post subject: Reply with quote

Hey, I didnt even realise you had the visibility stuff done. Very Happy

I gotta try this out over the weekend between Dragon Age 2 sessions.
Back to top
View user's profile Send private message
Zunath



Joined: 06 Jul 2006
Posts: 183

PostPosted: Tue Apr 05, 2011 23:33    Post subject: Reply with quote

Haven't been around in a while, but I wanted to give a big THANK YOU for adding the OnPlayerLeaving hook! It works great, and now I can throw out my persistent HP tracking table and store it on the PC's item database. Very Happy

Was also curious if you found any way to hook combat events? For example:

1.) A hook which fires a script when determining whether or a hit lands on a combat target or not.
2.) A hook which defines the amount of time between attacks for a specific PC.

There was some helpful posts on these, but nothing which led me to a working solution unfortunately. Smile

Once again - thanks!
Back to top
View user's profile Send private message
MaxRock



Joined: 24 Jan 2008
Posts: 196

PostPosted: Fri Apr 15, 2011 19:42    Post subject: Reply with quote

v0.89 is up:

Fixed:
NWNXFuncs_SetTag should now work correctly
NWNXFuncs_SetConversation should now work correctly

NWNXFuncs_SetVisibilityOverride, NWNXFuncs_SetVisibility
Addded DeleteLocalString to the script functions which should prevent the server from crashing on shutdown

Added:
NWNXFuncs_Get/SetDestinationTag
Get and change the tag of the destination for area transitions (doors or triggers)
Back to top
View user's profile Send private message Send e-mail MSN Messenger
MaxRock



Joined: 24 Jan 2008
Posts: 196

PostPosted: Sun Apr 17, 2011 0:17    Post subject: Reply with quote

Zunath wrote:

Was also curious if you found any way to hook combat events? For example:

1.) A hook which fires a script when determining whether or a hit lands on a combat target or not.
2.) A hook which defines the amount of time between attacks for a specific PC.

There was some helpful posts on these, but nothing which led me to a working solution unfortunately. Smile


Should be possible. I think I have most of the attack functions written out (might have to get rid of the e3.5 stuff) and I'm pretty sure I saw something that determines the time between attacks.

I think the workaround is to put the OnHitCastSpell itemproperty on the weapon which should let you run a script every time a hit lands
Back to top
View user's profile Send private message Send e-mail MSN Messenger
Sethan



Joined: 04 Oct 2008
Posts: 47

PostPosted: Sun Apr 17, 2011 4:36    Post subject: Reply with quote

Really looking forward to playing with NWNXFuncs_Get/SetDestinationTag

Thanks!
Back to top
View user's profile Send private message
Zunath



Joined: 06 Jul 2006
Posts: 183

PostPosted: Tue Apr 26, 2011 4:37    Post subject: Reply with quote

MaxRock wrote:
Zunath wrote:

Was also curious if you found any way to hook combat events? For example:

1.) A hook which fires a script when determining whether or a hit lands on a combat target or not.
2.) A hook which defines the amount of time between attacks for a specific PC.

There was some helpful posts on these, but nothing which led me to a working solution unfortunately. Smile


Should be possible. I think I have most of the attack functions written out (might have to get rid of the e3.5 stuff) and I'm pretty sure I saw something that determines the time between attacks.

I think the workaround is to put the OnHitCastSpell itemproperty on the weapon which should let you run a script every time a hit lands


Sounds like good news to me, then Smile

I'm currently using the OnHitCastSpell to determine damage, and that would technically also work for calculating misses. Problem with that is the visual effects and possibilities for missing.

Hopefully you're able to figure something out, though. And once again - thanks for all the work you've done. Very Happy
Back to top
View user's profile Send private message
Baaleos



Joined: 02 Sep 2007
Posts: 830

PostPosted: Sun May 15, 2011 17:38    Post subject: Cant build? Reply with quote

I dont seem to be able to build the latest version?

Quote:

1>------ Rebuild All started: Project: nwnx_funcs, Configuration: Release Win32 ------
1>Deleting intermediate and output files for project 'nwnx_funcs', configuration 'Release|Win32'
1>Compiling...
1>StdAfx.cpp
1>Compiling...
1>nwn_internals.cpp
1>CWorldTimer.cpp
1>CVirtualMachine.cpp
1>..\nwn_internals\CVirtualMachine.cpp(1) : warning C4627: '#include "../NWNXdll/stdafx.h"': skipped when looking for precompiled header use
1> Add directive to 'stdafx.h' or rebuild precompiled header
1>..\nwn_internals\CVirtualMachine.cpp(2) : warning C4627: '#include "types.h"': skipped when looking for precompiled header use
1> Add directive to 'stdafx.h' or rebuild precompiled header
1>..\nwn_internals\CVirtualMachine.cpp(3) : warning C4627: '#include "nwn_internals.h"': skipped when looking for precompiled header use
1> Add directive to 'stdafx.h' or rebuild precompiled header
1>..\nwn_internals\CVirtualMachine.cpp(50) : fatal error C1010: unexpected end of file while looking for precompiled header. Did you forget to add '#include "stdafx.h"' to your source?
C4627: '#include "CExoString.h"': skipped when looking for precompiled header use
1> Add directive to 'stdafx.h' or rebuild precompiled header
1>..\nwn_internals\CExoString.cpp(249) : fatal error C1010: unexpected end of file while looking for precompiled header. Did you forget to add '#include "stdafx.h"' to your source?
1>CExoLinkedList.cpp
1>C2DA.cpp
1>NWNXBase.cpp
1>IniFile.cpp
1>nwnx_funcs.cpp
1>nwnfuncs_internal.cpp
1>HookFunc.cpp
1>funcs_lookup.cpp
1>funcs_def.cpp
1>funcs.cpp
1>Compiling...
1>CVisibility.cpp
1>Build log was saved at "x"
1>nwnx_funcs - 2 error(s), 4 warning(s)
========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========
Back to top
View user's profile Send private message
MaxRock



Joined: 24 Jan 2008
Posts: 196

PostPosted: Sun May 15, 2011 19:09    Post subject: Reply with quote

yea... my headers and definitions are kinda disorganized (to say it nicely).
Thankfully motu99 has been working on an API for the windows server. It is structured much better and doesn't have all the cirular references either; so I'm most likely going to switch over to that.

In the meantime, see if CVirtualmachine.cpp and CExoString.cpp actually include stdafx.h

Code:
1>..\nwn_internals\CVirtualMachine.cpp(1) : warning C4627: '#include "../NWNXdll/stdafx.h"': skipped when looking for precompiled header use

Looks like it's trying to include stdafx.h from nwnxdll...
Back to top
View user's profile Send private message Send e-mail MSN Messenger
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 ... 20, 21, 22 ... 27, 28, 29  Next
Page 21 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