Advancing NPC's

Discussion in 'Modding and Scripting Support' started by Gunnut, Mar 6, 2003.

Remove all ads!
Support Terra-Arcanum:

GOG.com

PayPal - The safer, easier way to pay online!
  1. Gunnut

    Gunnut New Member

    Messages:
    36
    Likes Received:
    0
    Joined:
    Jan 26, 2003
    I just thought of something I'd like to add to my multi player mod. I've got several NPC's that you can hire as followers but I'd like to make a dialoge/script that would cause the NPC to level up to match the PC. That way I can make the NPC's start off as low level and they could still be useful when you run the game again with a stronger character. Anybody have an idea how to do this?
     
  2. Ruelz

    Ruelz New Member

    Messages:
    75
    Likes Received:
    0
    Joined:
    Jun 25, 2002
    I'm not quite sure what you're trying for, but we'll see if this helps.

    First of all, the game automaticlly levels NPC's that are followers when you level up. But if I am understanding you correctly, you want to have a bunch of low-level NPC's that would immediately advance to the level of the player upon being hired.

    I am not sure that's possible. In order to do that, opne neesd a script that would get the character level of the PC, store it in a data file, and then set the NPC's level to match. The latter is easy enough to do, using the [Set stat (num) of (obj) to (num)] command. But without the game right in front of me, i am unaware of a way to have the game figure out what level the PC is. You would be looking for some kind of command like "Store [num] as [num]" or [stat (num) of (obj): Store in (num)]. There might be a script like that, or soemthing reasonably close to it, and that's what you need.

    So assuming that there is such a command, your finished dialogue/script, when the NPC became follower, would call to the lines below:

    Get stat (num) of (obj), store in/as (num) <-- store this number as a local or global variable, NOT an integer.
    Set stat (num) of (obj) to (num)<-- again, the local or global variable you stored it as before, NOT an integer.

    If this is all baffling, post your questions and I will do what i can to clear it up. But if you find nothing liek the stat command i mentioned, then I believe the chances for success are slim. Tell you what, when i get home I will look up the script commands, and will post tomorrow afternoon if I find anything conclusive for you.

    Bets of luck
    Ruelz
     
  3. Gunnut

    Gunnut New Member

    Messages:
    36
    Likes Received:
    0
    Joined:
    Jan 26, 2003
    From what you've told me I think I've devised a new way to approach this. Thank you VERY much :grin:
     
  4. Dj_Unique

    Dj_Unique Member

    Messages:
    79
    Likes Received:
    5
    Joined:
    Nov 14, 2001
    I thought I'd chime in here, attempting to help a bit :)

    I can at least verify that the stat commands have access to an object's level field. The number for the level stat is 17 (according to the WorldEd manual).

    It should be possible to (script examples included)

    a) get the player's level

    stat 17 of Player: store in Local 0

    b) set the NPC's level to match

    Since there's no 'stat (num) of (obj): set to (num)' command,
    we have to calculate the difference and use that value to level the NPC

    stat 17 of Attachee: store in Local 1
    Local 2 = Local 0 - Local 1
    stat 17 of Attachee: adjust by Local 2

    [NOTE: I haven't tested if these actually work, this is only theoretical knowledge]
     
  5. Gunnut

    Gunnut New Member

    Messages:
    36
    Likes Received:
    0
    Joined:
    Jan 26, 2003
    Well that's some pretty good theoretical knowledge. I set up something pretty similar. While it didn't work exactly like I planned I was able to manually increase the npc's level. However, it seemed to just change that stat and not trigger the auto leveling scheme that was selected for them. Hopefully that is just a by product that I can fix by redoing my script later.
     
  6. Ruelz

    Ruelz New Member

    Messages:
    75
    Likes Received:
    0
    Joined:
    Jun 25, 2002
    Thanks for catching that. I suppose I dont have to look it up myself now! :grin:

    Gunnut wrote:
    My pleasure! It's what the community here is for. I only wish i could have had the leisure of being perfectly accurate in my advice. But I'm glad I was at least able to help.
     
  7. Gunnut

    Gunnut New Member

    Messages:
    36
    Likes Received:
    0
    Joined:
    Jan 26, 2003
    After rewriting my script it correctly changes the npc's level. However, all it does is change the number and does not give the npc any character points to spend on their assigned level scheme. Anybody have some ideas?
     
  8. Ruelz

    Ruelz New Member

    Messages:
    75
    Likes Received:
    0
    Joined:
    Jun 25, 2002
    Yes, actually, although it is a theory that you will need to test. When you alter stat like level, you are immediately advancing an NPC TO that level. In other words, when you alter a stat like that, its as though you had spawned that particular NPC at that original level--it actually is not advancing and earning those levels, and therefore the auto-level scheme isn't kicking in.

    What's needed to solve this problem is a way to take the PC down to level one, then re-level with the exact amount of experience, but without awarding additional character points. Becasue NPC's dont actually have an experience value--they have the level they are spawned with, and they level up when you do, so experience is irrelevent to them. Therefore, the insanely complicated solution I outlined. I don't know if it's actually possible to do that, since taking a PC down and then back up to their levels is the only way that I know of to initiate the auto-level scheme.

    If that gives you an idea, and it works, let me know. I can only hope that at least that sparks some sort of clever plan to work out the problem.

    best of luck,
    ruelz
     
Our Host!