View previous topic :: View next topic |
Author |
Message |
Baaleos
Joined: 02 Sep 2007 Posts: 830
|
Posted: Wed Jun 23, 2010 17:01 Post subject: does it need nwnx? |
|
|
To call this function on a player, does it require nwnx, or can nss scripting do it?
Im hoping it might be possible to pseudo level my players to 40, then remove their stats and then let my custom leveling system take over.
This way, it gives the lvlstatlist of 40 levels to work with, rather than just level 1. |
|
Back to top |
|
|
Terra_777
Joined: 27 Jun 2008 Posts: 216 Location: Sweden
|
Posted: Wed Jun 23, 2010 17:08 Post subject: |
|
|
nwscript:
Code: | // Levels up a creature using default settings.
// If successfull it returns the level the creature now is, or 0 if it fails.
// If you want to give them a different level (ie: Give a Fighter a level of Wizard)
// you can specify that in the nClass.
// However, if you specify a class to which the creature no package specified,
// they will use the default package for that class for their levelup choices.
// (ie: no Barbarian Savage/Wizard Divination combinations)
// If you turn on bReadyAllSpells, all memorized spells will be ready to cast without resting.
// if nPackage is PACKAGE_INVALID then it will use the starting package assigned to that class or just the class package
int LevelUpHenchman(object oCreature, int nClass = CLASS_TYPE_INVALID, int bReadyAllSpells = FALSE, int nPackage = PACKAGE_INVALID) |
_________________ I dun have any signature, I'm happy anyway. |
|
Back to top |
|
|
Baaleos
Joined: 02 Sep 2007 Posts: 830
|
Posted: Thu Jun 24, 2010 1:31 Post subject: Ahhhh |
|
|
I was gonna reply saying it doesnt work.
But I see it does work.
You have to use it in combo with the GiveXP Functions, when it says LevelUpHenchman, it really means level up, but in the sense that it completes the levelup process automatically, it doesnt give xp or anything.
Code: |
void main()
{
object oPC = GetPCChatSpeaker();
if(GetPCChatMessage() == "test")
{int i;
for(i=1;i<=40;i++){
GiveXPToCreature(oPC,10000);
LevelUpHenchman(oPC,CLASS_TYPE_SORCERER,FALSE,PACKAGE_SORCERER_ILLUSION);
}
}
}
|
So, using this code, (with some minor modifications, I could level all my players to 40. Instantly)
Then I can in more scripting, remove their given skill bonuses, remove feats, and ability score bonuses, making it as if they are level 1.
Then, if they want to level up, they have to acquire 'pseudo' xp in my own experience system.
Perfect. |
|
Back to top |
|
|
Zunath
Joined: 06 Jul 2006 Posts: 183
|
Posted: Tue Jun 29, 2010 2:51 Post subject: |
|
|
No rush or anything but any news on the next update? I got the timing bar to work thanks to Baaleos but it seems to fill up at the same rate regardless of how long I set the delay to.
Thanks |
|
Back to top |
|
|
Baaleos
Joined: 02 Sep 2007 Posts: 830
|
Posted: Tue Jun 29, 2010 2:55 Post subject: I tried tinkering with it |
|
|
I tried tinkering with the different methods of triggering the timing bar,
Its definitly not a case of the data being sent to nwnx in correctly.
Ive seen that Timing Bar function in nwnserver.exe in IDA, and it does acceptt hose parameters.
Time Duration, and a char value for the type of timing bar.
Ive tried putting Spaces between the variables in the SetLocalString in nwn too, as well as - which seems to be used for all the other nwnx functions.
As far as I can see, there is nothing 'wrong' with the nwnx plugin, or the way we are calling it which would explain why its not working.
It just seems to 'fill up' within a second, and then we must wait until the Timing Bar stop method is invoked.
I only realised today, that the timing bar does not lock the GUI or the player character... need to do CutsceneParalysis on him too. |
|
Back to top |
|
|
MaxRock
Joined: 24 Jan 2008 Posts: 196
|
Posted: Tue Jun 29, 2010 19:19 Post subject: v 0.0.81 |
|
|
Code: |
Changed the lookup table from map to hash_map; should provide a small performance gain
Added:
NWNXFuncs_SetAreaEventScript
NWNXFuncs_SetAge
Fixed:
Put in the bodies for NWNXFuncs_StartTimingbar and NWNXFuncs_StopTimingbar (sorry about forgetting that that)
|
I couldn't do anything about SetMaxHitPoints; there has to be a way, though because the toolset allows to set the hp of a creature to well above 12,000
Same with NWNXFuncs_SetClassLevel. I've managed to create and attach new levelstats to a creature but the server still crashes trying to delete it |
|
Back to top |
|
|
Baaleos
Joined: 02 Sep 2007 Posts: 830
|
Posted: Tue Jun 29, 2010 19:25 Post subject: Your a star!! |
|
|
If I were female, I would offer to bear your children.....
SetAge is something I always wanted, but could only attain via letoscript.
Note - I was working on PossessCreature in my first attempt at calling a nwnserver function from c++
Although I found the function address etc, I couldnt figure out how to call it from c++.
I was wondering if you might wana have a go, it would be possibly one of the greatest things to have, being able to possess npcs etc.
Code: |
void (__fastcall *CNWSCreature__PossessCreature)(CNWSCreature* cre) = (void (__fastcall *)(CNWSCreature* cre))0x004CD1B0;
|
This was my attempt at doing it, but it crashed the server when I called it, think I called it wrong.
The address is the address shown in nwnserver.exe for the PossessCreature method, and it accepts a uLong argument, I thought a CNWSCreature might be compatible, obviously wrong.
Any chance you might wana fiddle round with it? |
|
Back to top |
|
|
Baaleos
Joined: 02 Sep 2007 Posts: 830
|
Posted: Tue Jun 29, 2010 19:35 Post subject: |
|
|
Code: | void NWNXFuncs_StartTimingbar(object oPC, int iDuration, int iLabel) {
SetLocalString(oPC, "NWNX!FUNCS!TIMEBARSTART", IntToString(iDuration)+" "+IntToString(iLabel));
DeleteLocalString(oPC, "NWNX!FUNCS!TIMEBARSTART");
}
|
The timing bar still fills up in less than a second, which leads me to believe maybe it is meant to accept a float value or something?
But other than that, it works well, the labels all seem to work. |
|
Back to top |
|
|
MaxRock
Joined: 24 Jan 2008 Posts: 196
|
Posted: Tue Jun 29, 2010 21:49 Post subject: |
|
|
Baaleos wrote: |
The timing bar still fills up in less than a second, which leads me to believe maybe it is meant to accept a float value or something?
|
You're using milliseconds for the duration right?
Code: |
//fill up the timingbar in 4.5 seconds
NWNXFuncs_StartTimingbar(OBJECT_SELF, 4500, 1); |
|
|
Back to top |
|
|
Baaleos
Joined: 02 Sep 2007 Posts: 830
|
Posted: Tue Jun 29, 2010 22:14 Post subject: |
|
|
Lol
That explains it.
The values that were being passed into my function, were around the duration of 17.00 etc.
Didnt realise it was in Miliseconds.
Will fix that up rite now. hehe. |
|
Back to top |
|
|
Baaleos
Joined: 02 Sep 2007 Posts: 830
|
Posted: Wed Jun 30, 2010 0:04 Post subject: yip - works great |
|
|
Can confirm that the new instructions on how to use the timing bar worked a treat. Lol |
|
Back to top |
|
|
Zunath
Joined: 06 Jul 2006 Posts: 183
|
Posted: Wed Jun 30, 2010 5:05 Post subject: |
|
|
Another excellent update. The timing bar works wonderfully. Thanks Maxrock! |
|
Back to top |
|
|
Terra_777
Joined: 27 Jun 2008 Posts: 216 Location: Sweden
|
Posted: Wed Jun 30, 2010 16:15 Post subject: |
|
|
Possible/how hard is it to make a function to modify the PC FirstName, LastName, Description and DescriptionOverr fields without leto? _________________ I dun have any signature, I'm happy anyway. |
|
Back to top |
|
|
Baaleos
Joined: 02 Sep 2007 Posts: 830
|
Posted: Wed Jun 30, 2010 17:20 Post subject: |
|
|
Code: |
int CNWNXFuncs::SetAge() {
if (!GetIsCreature()) {
_log(2, "o Error: SetAge used on non-creature object.\n");
sprintf(Params, "-1");
return 0;
}
((CNWSCreature*)oObject)->cre_stats->cs_age = P1;
sprintf(Params, "1");
return 1;
}
|
This is the definition for the SetAge method, so I would assume that in a similar way this works, a SetFirstName / LastName / Description etc
would all work too.
Something like
Code: |
((CNWSCreature*)oObject)->cre_stats->cs_firstname = P1;
sprintf(Params, "1");
|
Code: |
((CNWSCreature*)oObject)->cre_stats->cs_lastname = P1;
sprintf(Params, "1");
|
The same for these two....
"cs_desc_base
"cs_desc_override
The details at the top of the funcsdef.cpp file give some useful var names.
Quote: |
_log(1, "cs_firstname : %08X\n", (uint32_t)&stats->cs_firstname - iGO);
_log(1, "cs_lastname : %08X\n", (uint32_t)&stats->cs_lastname - iGO);
_log(1, "cs_conv[16] : %08X\n", (uint32_t)&stats->cs_conv[16] - iGO);
_log(1, "cs_conv_interruptable : %08X\n", (uint32_t)&stats->cs_conv_interruptable - iGO);
_log(1, "cs_desc_base : %08X\n", (uint32_t)&stats->cs_desc_base - iGO);
_log(1, "cs_desc_override : %08X\n", (uint32_t)&stats->cs_desc_override - iGO);
_log(1, "cs_age : %08X\n", (uint32_t)&stats->cs_age - iGO);
|
This is all just an assumption though, I've never had much luck at compiling nwnx_funcs so I cant really help you find out if it would work. |
|
Back to top |
|
|
Zunath
Joined: 06 Jul 2006 Posts: 183
|
Posted: Wed Jun 30, 2010 17:43 Post subject: |
|
|
On that note, how difficult would it be to change the amount of time between attacks via script? Ideally, it would be nice to be able to set the delay on a per-character basis but I have a feeling it's a global variable. I'm just going off a hunch here and may be off base.
I don't have much experience with coding NWNX plugins but if someone can give me a little direction on how to get started I should be able to figure it out (If it's even possible). |
|
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
|