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 ... 10, 11, 12 ... 27, 28, 29  Next
 
Post new topic   Reply to topic    nwnx.org Forum Index -> Windows development
View previous topic :: View next topic  
Author Message
Baaleos



Joined: 02 Sep 2007
Posts: 830

PostPosted: Wed Jun 23, 2010 17:01    Post subject: does it need nwnx? Reply with quote

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
View user's profile Send private message
Terra_777



Joined: 27 Jun 2008
Posts: 216
Location: Sweden

PostPosted: Wed Jun 23, 2010 17:08    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail MSN Messenger
Baaleos



Joined: 02 Sep 2007
Posts: 830

PostPosted: Thu Jun 24, 2010 1:31    Post subject: Ahhhh Reply with quote

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
View user's profile Send private message
Zunath



Joined: 06 Jul 2006
Posts: 183

PostPosted: Tue Jun 29, 2010 2:51    Post subject: Reply with quote

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 Smile
Back to top
View user's profile Send private message
Baaleos



Joined: 02 Sep 2007
Posts: 830

PostPosted: Tue Jun 29, 2010 2:55    Post subject: I tried tinkering with it Reply with quote

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
View user's profile Send private message
MaxRock



Joined: 24 Jan 2008
Posts: 196

PostPosted: Tue Jun 29, 2010 19:19    Post subject: v 0.0.81 Reply with quote

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 Crying or Very sad
Back to top
View user's profile Send private message Send e-mail MSN Messenger
Baaleos



Joined: 02 Sep 2007
Posts: 830

PostPosted: Tue Jun 29, 2010 19:25    Post subject: Your a star!! Reply with quote

If I were female, I would offer to bear your children.....

Wink

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
View user's profile Send private message
Baaleos



Joined: 02 Sep 2007
Posts: 830

PostPosted: Tue Jun 29, 2010 19:35    Post subject: Reply with quote

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
View user's profile Send private message
MaxRock



Joined: 24 Jan 2008
Posts: 196

PostPosted: Tue Jun 29, 2010 21:49    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail MSN Messenger
Baaleos



Joined: 02 Sep 2007
Posts: 830

PostPosted: Tue Jun 29, 2010 22:14    Post subject: Reply with quote

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
View user's profile Send private message
Baaleos



Joined: 02 Sep 2007
Posts: 830

PostPosted: Wed Jun 30, 2010 0:04    Post subject: yip - works great Reply with quote

Can confirm that the new instructions on how to use the timing bar worked a treat. Lol
Back to top
View user's profile Send private message
Zunath



Joined: 06 Jul 2006
Posts: 183

PostPosted: Wed Jun 30, 2010 5:05    Post subject: Reply with quote

Another excellent update. The timing bar works wonderfully. Thanks Maxrock!
Back to top
View user's profile Send private message
Terra_777



Joined: 27 Jun 2008
Posts: 216
Location: Sweden

PostPosted: Wed Jun 30, 2010 16:15    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail MSN Messenger
Baaleos



Joined: 02 Sep 2007
Posts: 830

PostPosted: Wed Jun 30, 2010 17:20    Post subject: Reply with quote

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
View user's profile Send private message
Zunath



Joined: 06 Jul 2006
Posts: 183

PostPosted: Wed Jun 30, 2010 17:43    Post subject: Reply with quote

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
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 ... 10, 11, 12 ... 27, 28, 29  Next
Page 11 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