View previous topic :: View next topic |
Author |
Message |
Terra_777
Joined: 27 Jun 2008 Posts: 216 Location: Sweden
|
Posted: Sun Oct 02, 2011 5:26 Post subject: NWNX Weapons |
|
|
Well no. Its NWNX cool! But it can override several otherwise hardcoded features. So how does it work? It works by reading local-ints off various objects (mostly items) to overrides number of attacks, unarmed base attack, weapon focus feats etc. It can also spawn a console window printing what nwn is printing. Random can also be overiden to use another algorithm to determine random numbers (dicerolls included).
Latest 1.1: http://nwvault.ign.com/View.php?view=Other.Detail&id=225463&id=1537
For a more updated list of features look into nwnx_cool and inc_cool scripts for function defs and examples.
NWNX localdata modifiers examples:
//The weapon when wielded in the mainhand will have 100 attacks
SetLocalInt( oWeapon, "mainattks", 100 );
//The weapon when wielded in the offhand will have 100 attacks
SetLocalInt( oWeapon, "offhdnatt", 100 );
//The weapon will respect weapon finesse
SetLocalInt( oWeapon, "finesse", TRUE );
//The weapon will look for feat 10 as its epic weapon focus feat
SetLocalInt( oWeapon, "ewf", 10 );
//The weapon will look for feat 10 as its weapon focus feat
SetLocalInt( oWeapon, "wf", 10 );
//The weapon will look for feat 10 as its weapon specialization feat
SetLocalInt( oWeapon, "ws", 10 );
//The weapon will look for feat 10 as its weapon epic spec feat
SetLocalInt( oWeapon, "ews", 10 );
//The weapon will look for feat 23 as its improved crit feat
SetLocalInt( oWeapon, "ic", 23 );
//The weapon will look for feat 23 as its overwhelming crit feat
SetLocalInt( oWeapon, "oc", 23 );
//The weapon will respect unarmed base attack bonus
//This will work reguardless of class composition
SetLocalInt( oWeapon, "ubab", TRUE );
//The game will check for the weapon of choice feat off the creature
//1 = longsword in this case
//Longswords weapon of choice is feat 10 for oCreature
SetLocalInt( oCreature, "woc_1", 10 );
//The creatures casterlevel is now 9000
SetLocalInt( oCreature, cstrlvl, 9000 );
//The creature has +10 AC Calculated ACVsX+Mod
//This modifier WILL be reflected on the character sheet
SetLocalInt( oCreature, "AC", 10 );
//The creature has -10 AB Calculated ABVsX+Mod
//This modifier WILL be reflected on the character sheet
SetLocalInt( oCreature, "AB", -10 );
//Creature will not trigger attack of oppertunity
SetLocalInt( oCreature, "NOAOO", TRUE );
//Creature is allowed to level up to level ##
//Note: Setting this will override XP calculations
//It will also allow PCs to level past 40
//2da data might be missing for levels higher then 40 for baseclasses
//If you level PCs higher then 40 you need to use GetSetServerMaxLevel()
//Otherwise pcs higher then the cap can't login
SetLocalInt( oCreature, "levelup", ## );
//If this is true timingbar events will end upon moving (including custom onces)
//If a timing bar event is cancled the timinbbar event is triggered aswell
SetLocalInt( oCreature, "BAR", TRUE );
NWNX events:
1: Cast spell
OBJECT_SELF = Caster
parameters: target location, spell, class-index, target object
By-passable: yes
2: item use
OBJECT_SELF = Caster
parameters: target location, spellid, item used, target object
By-passable: yes
3: Polymorph
OBJECT_SELF = polymorph target
parameters: polymorph, effect creator
By-passable: yes
4: UnPolymorph
OBJECT_SELF = polymorph target
parameters: EffectspellID, effect creator
By-passable: yes
5: UseSkill
OBJECT_SELF = user
parameters: target location, skill-used, target object
By-passable: yes
6: UseFeat
OBJECT_SELF = user
parameters: target location, feat-used, target object
By-passable: yes
7: Toggle Mode
OBJECT_SELF = user
parameters: target location, mode-toggled, target object
By-passable: yes
8: Critical hit (Devastating critical check)
OBJECT_SELF = attacker
parameters: target, baseitemtype, weapon
By-passable: yes, the normal crit will still occur however.
9: Special attack onhit melee (knockdown, smite, etc)
OBJECT_SELF = user
parameters: target, special-attack-type
By-passable: yes. No-hit will occur at all.
10: Ranged special attack onhit
OBJECT_SELF = user
parameters: target, special-attack-type
By-passable: yes. No-hit will occur at all.
11: Pause
OBJECT_SELF = module
parameters: pause-state about to be set
By-passable: yes.
12: PvP attitude change (untested!)
OBJECT_SELF = invoker
parameters: target, state
By-passable: yes i think so.
13: Remove Combat Invisibility
OBJECT_SELF = attacker
parameters: none
By-passable: yes. The invisibility/gs stays on.
14: Timingbar event (lockpick, rest, disable trap, etc)
OBJECT_SELF = owner of the timingbar
paramters = timingbar event, status
By-passabl: eYes.
15: Attack
OBJECT_SELF: Attacker
Paramters: Target
By-passable: Yes
Unrelated functions:
//Get the latest combat data from oCreature (rolls, damage, crits etc)
string GetCurrentCombatData( object oCreature, int nType );
//Get an object based of their objectID
object GetObject( string sID );
//Get the firstname from a creature
string GetFirstName( object oCreature );
//Get the lastname from a creature
string GetLastName( object oCreature );
//Set the last name on a creatures (PCs needs to relog for this to take effect)
void SetLastName( object oCreature, string sLastName );
//Set the last name on a creatures (PCs needs to relog for this to take effect)
void SetFirstName( object oCreature, string sFirstName );
//Prints sText to the console
void PrintToConsole( string sText );
//Generates a random number from the nwnx plugin itself
int CoolRandom( int nSeed );
//Get current timestamp
int Time( );
//Returns the maxalloed level for the sever
//If nLevel is higher then 0 the max level is set aswell
int GetSetServerMaxLevel( int nLevel = 0 );
inisettings:
WriteToLogFile=### ;(When this number is higher then 0 the plugin will create a console window and hook nwn's log function. 1=nwn's logs is printed to the console window, 2=only the nwscript command will be printed to the console window, 3= all data is printed to the console including the plugins logs very spammy, 4=only the plugin's logdata is printed to the console)
Rand=1/0 ;(When 1 nwn's random functions are hooked and replaced by a frame based random system. Initial frame=unixtimestamp/2. Every random call advances the frame+1. The frame is then used to compute a seed for rand unixtime+frame. At initialization the function fills a buffer with random bytes from rand. Random numbers is returned to nwn though casting random sizes of data from the generated buffer which moves the cursor though the buffer. When the buffer hits its re-buffered with new bytes and the cursor is set back to 0.)
TogglePauseState=1/0 ;(when 1 pause is hooked and runs nwnx_cool.nss)
weapon_hook=1/0 ;(when 1 the plugin will hook the feat functions which enables use of the local-ints: local-int reference. This will completely override ubab and weapon finesse)
GetCasterLevel=1/0 ;(When set to 1 functions reguarding casterlevels are hooked and overriden by a localint)
CastSpell=1/0 ;(Adds a script event to castspell)
ItemCastSpell=1/0 ;(Adds a scriptevent to item-uses)
Polymorph=1/0 ;(Adds a script event to polymorph)
UnPolymorph=1/0 ;(same as above)
UseSkill=1/0 ;(script event)
UseFeat=1/0 ;(script event)
ToggleMode=1/0 ;(same as above)
DevCrit=1/0 ;(Hooks critical/devcrit properly, if nwnx_events is present that hook needs to be disabled)
SpecialAttack=1/0 ;(Hooks into the special attack routine (knockdown, disarm, smite, etc) and runs a script even when the attack is actually occuring)
SetPVPPlayerLikesMe=1/0 ;(Hooks the player attitude change to fire a script when one occurs)
RemoveCombatInvisibility=1/0 ;(Hooks the combat function that removes invisibility effects to fire a script. NOTE: This one fires alot)
RandomBuffer=#### ;(The number of random (including dice) calls that will be rolled before the plugin re-seeds) Default is 100.
AC=1/0 ;(When 1 it enables the AC local data to be used)
AB=1/0 ;(When 1 it enables the AC local data to be used)
ConsoleOnly=1/0 ;(When set to 1 the plugin will only print data to the console and not the logfile)
AttackOfOpportunit=2/1/0 ;(When set 1 or higher the NOAOO int is enabled. If 2 or higher AOOs are completely disabled)
CanLevelUp=1/0 ;(Enables/Disables the "levelup" localint)
GuiTimingEvent=1/0 ;(Attaches a script event to start/stop timingbar events)
Also credits to MaxRock for his Funcs API and everyone else who helped develop NWNX. _________________ I dun have any signature, I'm happy anyway.
Last edited by Terra_777 on Fri Mar 29, 2013 1:26; edited 10 times in total |
|
Back to top |
|
|
ShaDoOoW
Joined: 20 Aug 2005 Posts: 584
|
Posted: Mon Oct 03, 2011 4:41 Post subject: |
|
|
Just wanted to thank you as this will allow me to make Tempest working exactly as he should. Hell good work! _________________ Community Patch / NWNX Patch / NWNX Files / NWNX Connect |
|
Back to top |
|
|
Terra_777
Joined: 27 Jun 2008 Posts: 216 Location: Sweden
|
Posted: Wed Oct 05, 2011 1:26 Post subject: |
|
|
nwnx_cool v0.2
Download: http://www.megaupload.com/?d=A4OM3W58
I havent tested all of this but feel free to post in this thread if you find a problem.
*changed the "ubab" localint to just check for a boolean value instead of checking for monk-levels.
Example:
Code: | if( GetBaseItemType( oItem ) == BASE_ITEM_BANANA ){
SetLocalInt( oItem, "ubab", GetLevelByClass( CLASS_TYPE_MONK, GetItemPossessor( oItem ) ) > 0 );
} |
*added overrides to casterlevel "cstrlvl" localint will override for a coming spellscript (can be set in the spellhook or the cast-spell event) including for spell-resistance checks.
*New ini-settings:
GetCasterLevel=1/0 ;(When set to 1 functions reguarding casterlevels are hooked and overriden by a localint)
CastSpell=1/0 ;(Adds a script event to castspell)
ItemCastSpell=1/0 ;(Adds a scriptevent to item-uses)
Polymorph=1/0 ;(Adds a script event to polymorph)
UnPolymorph=1/0 ;(same as above)
UseSkill=1/0 ;(script event)
UseFeat=1/0 ;(script event)
ToggleMode=1/0 ;(same as above)
DevCrit=1/0 ;(Hooks critical/devcrit properly, if nwnx_events is present that hook needs to be disabled)
SpecialAttack=1/0 ;(Hooks into the special attack routine (knockdown, disarm, smite, etc) and runs a script even when the attack is actually occuring)
The script event runs script "nwnx_cool" havent added functionality to change this yet. See the script example attached for functions. All events can be canceled including dev-crit but devcrit will not abort the critical just the devcrit check. _________________ I dun have any signature, I'm happy anyway. |
|
Back to top |
|
|
Terra_777
Joined: 27 Jun 2008 Posts: 216 Location: Sweden
|
Posted: Wed Oct 05, 2011 15:35 Post subject: |
|
|
NWNX Cool 0.3
http://www.megaupload.com/?d=SFE1JWAK
*Fixed a crash that occurred when passing 0 instead of object_invalid back to the game at unarmed devcrit
*Special attack shouldnt run wtihout valid combat data
*Tweaked script functions for the event script and added functionality to fetch combatdata. GetCurrentCombatData should work for normal onhit effect aswell.
Code: | //Aborts the event
//nReturnVal is passed back to the engien functions
//Events:
//1: 0
//2: 0
//3: 0
//4: 0
//5: 0
//6: 0
//7: 0
//8: 1/0 (1: a devcrit attempt will be made by the game)
//9: Cancels the melee special attack
//10: Cancels the ranged special attack
void ByPass( int nReturnVal=0 );
//Gets the event that is running
//0: Nothing
//1: Cast spell
//2: item use
//3: Polymorph
//4: UnPolymorph
//5: UseSkill
//6: UseFeat
//7: Toggle Mode
//8: Critical hit (Devastating critical check)
//9: Special attack onhit melee (knockdown, smite, etc)
//10: Ranged special attack onhit
int GetEvent( );
//Get event target location
location GetEventLocation( );
//Get the target
//Event:
//1: SpellTarget
//2: Item target
//3: EffectCreator for the poly effect
//4: EffectCreator for the poly effect
//5: skill target
//6: feat target
//7: nothing
//8: Item performing the critical hit
//9: Target for the special attack
//10: Target for the special attack
object GetEventTarget( );
//Get the secondary target
//Event:
//1: nothing
//2: item used
//3: nothing
//4: nothing
//5: area(?) used in
//6: area(?) used in
//7: nothing
//8: Target of the critical hit
//9: nothing
//10: nothing
object GetEventTargetSecond( );
//Get the event data
//events:
//1 (spellcast): spell id
//2: item use spellid
//3: polymorph (POLYMORPH_*)
//4: effect spellID
//5: skill used (SKILL_*)
//6: feat used (FEAT_*)
//7: mode about to be toggled (ACTION_MODE_*)
//8: baseitem type of the item doing the critical hit
//9: The special attack used (COOL_SPECIAL_ATTACK_* for the onces I know)
//10: The special attack used (COOL_SPECIAL_ATTACK_* for the onces I know)
int GetEventData( );
//This will feed nwn another parameter reguarding data
//This will set and pass the parameter GetEventData returns
void OverrideEventData( int nData );
//Will return latest combatdata for oCreature
//nType:
//0: ammo item (object ID)
//1: Animation Length
//2: Attack Debugtext
//3: Attack Deflected
//4: Attack Group
//5: Attack Mode
//6: Attack Resault
//7: Attack Type
//8: Base Damage
//9: Concealment
//10: GoupDeGrace
//11: Critical Threat
//12: Damage Acid (65535 indicates no damage from this type)
//13: Damage Bludgeonoing (65535 indicates no damage from this type)
//14: Damage Cold (65535 indicates no damage from this type)
//15: Damage Divine (65535 indicates no damage from this type)
//16: Damage Electrical (65535 indicates no damage from this type)
//17: Damage Fire (65535 indicates no damage from this type)
//18: Damage Magical (65535 indicates no damage from this type)
//19: Damage Negative (65535 indicates no damage from this type)
//20: Damage Piercing (65535 indicates no damage from this type)
//21: Damage Positive (65535 indicates no damage from this type)
//22: Damage Slashing (65535 indicates no damage from this type)
//23: Damage Sonic (65535 indicates no damage from this type)
//24: Damage Debug Text
//25: Killing blow
//26: Missed by
//27: Ranged attack
//28: Ranged target X
//29: Ranged target y
//30: Ranged target z
//31: React Object (object ID)
//32: SneakAttack
//33: Threatroll
//34: Tohitmod
//35: Tohitroll
//36: Weapon attack type
string GetCurrentCombatData( object oCreature, int nType );
//Gets the object of sID
//sID is a hexadecimal number
object GetObject( string sID ); |
_________________ I dun have any signature, I'm happy anyway. |
|
Back to top |
|
|
ShaDoOoW
Joined: 20 Aug 2005 Posts: 584
|
Posted: Tue Oct 11, 2011 5:59 Post subject: |
|
|
small request: would be IsTwoHand possible? I mean like a variable on weapon. _________________ Community Patch / NWNX Patch / NWNX Files / NWNX Connect |
|
Back to top |
|
|
Nob
Joined: 16 Apr 2005 Posts: 21
|
Posted: Tue Oct 11, 2011 9:05 Post subject: |
|
|
This is neat to know.
Some questions:
Is it specifically possible to override the dev crit event within the plugin rather than use a script override?
For stuff in the combat data if we just set these values via the CNWSCombatAttackData pointer will it override the stock engine values? |
|
Back to top |
|
|
Baaleos
Joined: 02 Sep 2007 Posts: 830
|
Posted: Wed Oct 12, 2011 11:38 Post subject: Messages |
|
|
Hey Terra,
It looks like you have worked hard on this, and made a very neat and tidy nwnx_events alternative.
Some events that might be useful to hook:
Player Hostility Changes - Hook this to set whether players can or cannot change their own PVP Attitudes.
Pause - This ones easy to do.
Also - this is kinda a separate request - but since the name of this plugin is nwnx_cool, and I think this would be 'cool' I shall request it.
In the linux plugins, there is a plugin called nwnx_hak.
It allows the PW Host to 'Hide' hak's from the hak list that is sent to players.
This essentially allows the host to hide specific hak's from a player on Login, which would allow them to bypass the 'You are missing this hak' message.
The result would be Players without CEP2.3 being able to get into a CEP2.3 server.
Granted, they would crash if they tried to view CEP2.3 tilesets - but that becomes the job of the server host to police.
An extra use of the plugin, would be to allow for UNLIMITED server side hak's to be used, without requiring the player to possess identically named haks.
I was wondering if you might be up for trying to convert it to WIN32?
Pretty Please?
http://www.nwnx.org/phpBB2/viewtopic.php?t=1786&postdays=0&postorder=asc&start=15
It seems to be a little buggy in its initial release - maybe you can improve upon the concept? |
|
Back to top |
|
|
ShaDoOoW
Joined: 20 Aug 2005 Posts: 584
|
Posted: Thu Oct 13, 2011 5:40 Post subject: |
|
|
Another request: would be possible to set a variable to increase attack bonus or damage with weapon in order to not be subject to +20cap?
I would like to create a new greater weapon focus and greater weapon specialization feats for fighter as well as fix the broken weapon focus: trident. The damage feature would also allow me to provide bonus with power attack when character uses two hand weapon in better way than current EffectDamageIncrease which has cap of 20 damage so I have to apply this effect multiple times .
good work so far, sh _________________ Community Patch / NWNX Patch / NWNX Files / NWNX Connect |
|
Back to top |
|
|
Terra_777
Joined: 27 Jun 2008 Posts: 216 Location: Sweden
|
Posted: Mon Oct 17, 2011 13:14 Post subject: |
|
|
Hooking pause is already done, just need to add a script event to it. Player attitude shouldn't be a problem at all though that one is harder to test because I'm only one person.
Weapon-size, Damage and AB can probably be done with local-ints much like the way I've already done with the other attack things.
Reguarding the trident I think forcing the game to use the correct feats with the local-data above would fix that. _________________ I dun have any signature, I'm happy anyway. |
|
Back to top |
|
|
Baaleos
Joined: 02 Sep 2007 Posts: 830
|
Posted: Mon Oct 17, 2011 13:48 Post subject: |
|
|
I had a version of events that did the pvp hooking.
http://www.nwnx.org/phpBB2/viewtopic.php?t=1615
But alas- It still delivered the pvp change message/and toggle button message.
I bet you could hook it more efficiently than I did.
Its possible that the pvp hook I had, is what was causing my instability issues.
So far - I havent had any crashes resulting from your plugin - which is always a good sign.
So once again - It seems like an improvement on the old Events Plugin - Maybe you should enquire as to whether it can be added to the nwnx svn - like funcs was. |
|
Back to top |
|
|
Terra_777
Joined: 27 Jun 2008 Posts: 216 Location: Sweden
|
Posted: Tue Oct 18, 2011 19:56 Post subject: |
|
|
Sure! I can hook that. I'm also working on trying to solve the combat engine so we can construct our own combat feats. Alá Greater improved critical, Unfettered Defense, Insightful Strike etc.
Also regarding pause I can hook it but I'm not sure how to get the creature doing it. Anyone know where I can find the object toggling pause? _________________ I dun have any signature, I'm happy anyway. |
|
Back to top |
|
|
Nob
Joined: 16 Apr 2005 Posts: 21
|
Posted: Wed Oct 19, 2011 5:54 Post subject: |
|
|
Some things I'd love to know about the combat engine:
1. What determines how many spell actions per round are fired? Can this be altered easily? (e.g. allowing a PC to "dual wield" two wands and as a result fire two wands/round rather than just the usual one item)
2. Is it possible to add additional combat modes that currently don't exist? Where's the data kept about what each combat mode toggle actually does?
3. Favored enemy bonus. We know there's a CalculateFavoredEnemyBonus function, but it seems to hook very strangely.
4. Parry actions per round. How are these handled and what happens when we increase them? |
|
Back to top |
|
|
Baaleos
Joined: 02 Sep 2007 Posts: 830
|
Posted: Wed Oct 19, 2011 11:01 Post subject: |
|
|
Quote: | 2. Is it possible to add additional combat modes that currently don't exist? Where's the data kept about what each combat mode toggle actually does? |
I think the Modes, are just int values that link to entries in a 2da file.
However, where it goes from there, im not sure.
But yeah, if Activate/Deactivate mode has been hooked, it would be easy to fire the event itself, and feed it a customized mode number.
eg
ActivateMode(66); // 66 in the mode 2da could relate to something like?? Cooking Mode... or something.
Now, the question. What all does the client need?
No doubt to get the modal text to appear, certain strings must exist in the tlk.
However, one could argue, that this step could be overriden with the nwnx_cool.ncs script.
Eg- When mode is toggled with value of 66, bypass the toggle mode call, and then apply whatever effects desired.
I am currently doing this in my PW, to override default Stealth, and Detect for vampires.
Eg- Vampire Invisibility, and Vampire Detection/Senses
The only thing i noticed, was that Visual Effects need to be applied to the player about 0.75 of a second before applying nwnx_funcs's SetVisabilityOverride - but thats another plugin's querk.. not nwnx_cool.
Yeah - the vampire stealth toggle on my PW, will make vampires vanish from other players sight via nwnx_funcs's override. |
|
Back to top |
|
|
Terra_777
Joined: 27 Jun 2008 Posts: 216 Location: Sweden
|
Posted: Wed Oct 19, 2011 11:55 Post subject: |
|
|
Nob wrote: | Some things I'd love to know about the combat engine:
1. What determines how many spell actions per round are fired? Can this be altered easily? (e.g. allowing a PC to "dual wield" two wands and as a result fire two wands/round rather than just the usual one item)
2. Is it possible to add additional combat modes that currently don't exist? Where's the data kept about what each combat mode toggle actually does?
3. Favored enemy bonus. We know there's a CalculateFavoredEnemyBonus (http://pastebin.com/7xSJc6J1) function, but it seems to hook very strangely.
4. Parry actions per round. How are these handled and what happens when we increase them? |
1: Not sure. But I've seen functions like GetIsSpellCastRound but I'm not sure how it handles spellcasting.
2: What Baaleos said.
3: Its called by (Say hello to a decompiled combat engine):
CNWSCreatureStats__GetAttackModifierVersus http://pastebin.com/dqhX22BP
CNWSCreatureStats__GetDamageBonus http://pastebin.com/QNjJcmgG
CNWSCreature__DoListenDetection http://pastebin.com/B8XMR4ji
CNWSCreature__DoSpotDetection http://pastebin.com/hmTP6xzY
CNWSCreature__AIActionTaunt http://pastebin.com/A0LLTHZL
The checks are boolean IE:
if( CNWSCreatureStats__GetFavoredEnemyBonus( ... ) > 0 )
So I think it'd be perfectly viable to override it local-int style and just pass a boolean value back to the game.
4: Parry is resolved in CNWSCreature__ResolveAttackRoll Which seems to be the only function calling CNWSCombatRound__AddParryAttack. http://pastebin.com/BiJbGirt Just to figure out where it actually does the limitation then it could possibly be hooked and fixed.
P.S don't count on the decompile date to be super accurate. _________________ I dun have any signature, I'm happy anyway. |
|
Back to top |
|
|
Baaleos
Joined: 02 Sep 2007 Posts: 830
|
Posted: Wed Oct 19, 2011 13:18 Post subject: I might make |
|
|
Might make a subrace on my PW called 'Wife'
Available modes
Cooking - Higher ranks in this skill, reduces the chances that the food will be rejected by the master.
Tidying - More chance of finding hidden treasure while tidying up.
Sweeping - Higher Ranks will increase the speed at which she can Sweep, and reduce damage from Gas/Dust.
Nagging - Verbal, non-somatic skill. Increased ranks inflict fear in Males, and affect them with the 'Turned' status ailment.
Customized Skills for each. lol |
|
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
|