Count downs and Count ups

Discussion in 'Modding and Scripting Support' started by Ruelz, Apr 5, 2003.

Remove all ads!
Support Terra-Arcanum:

GOG.com

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

    Ruelz New Member

    Messages:
    75
    Likes Received:
    0
    Joined:
    Jun 25, 2002
    Try as i might (and I've really gone at it diligently) the art of making a script that will count a certain number of things ahppening eludes me. For example, say i want to make a quest where I have to convert X number of people to a certain religion (nifty idea for a charisma based quest), I don't know how to script it so that it keeps track of the number of people I have converted, as well as have the relevant NPC respond or reward at certain numbers.

    Can anyone then offer me an example or perhaps just an exlpanation as to how to do numbered scripting. It opens up a whole bunch of other quest ideas I have, and will greatly reduce the number of redundant, stupid "Fed-Ex" quests I mix in for side quests if I have the knowledge to make something truly complex. Incidentally, i have read the end of the ANTUT where DU talks briefly about it, but I have to be missing something since I have tried it in different situations and can't get it to store properly.
    I know it has to do with storing numbers and adding to them... but that's about as far as I can get.

    Thanks in advance
     
  2. Gunnut

    Gunnut New Member

    Messages:
    36
    Likes Received:
    0
    Joined:
    Jan 26, 2003
    I'm not real sure how to fix your problem but I know somebody who can. DJ Unique knows alot about script problems and can probably answer your question. He stops in here from time to time but I usually see him on the official Sierra Arcanum World Editing boards.
     
  3. Dj_Unique

    Dj_Unique Member

    Messages:
    79
    Likes Received:
    5
    Joined:
    Nov 14, 2001
    I think I know how to do this.

    I've been a bit occupied with my new modding tool project lately. It's quite a complex one (has a built-in scripting engine for various purposes and in addition to that, DLL plugin support etc), a beta version for testing purposes is coming up as soon as I feel it's ready to be released. I haven't even announced it because it wasn't originally meant for public release (the reason for that being the lack of user-friendliness and confusing interface and a completely redefined syntax for *.scr files), but I'll get back to that later on with a link to the beta.

    As for the scripting question, it's quite simple. You need to define in which global variable to store the count of whatever you want to be checked. Then increment it using the statement:

    if Global Variable n <= count - 1 (because this statement checks for less than or equals)
    then Global Variable n = Global Variable n + 1

    (where n is the number of the global variable and count is the maximum value)
    This would increment the variable while the count is less than what the maximum value would be. The place for this to happen is yours to decide.

    You will also need a global flag to be set to true when the maximum amount is reached. It would look like this:

    if Global Variable n == count
    then set global flag x to true

    So if the count is 5, you'll need to check for global variable<=4
    (after the last increment, it should be 5)

    I hope this helps at least a little bit. (Ready to help further, though, as always :))

    I think I'll do some testing on this myself, to make sure my information is accurate. (It's easy to throw this kind of theoretic stuff around, being a programmer and all..;))
     
  4. Ruelz

    Ruelz New Member

    Messages:
    75
    Likes Received:
    0
    Joined:
    Jun 25, 2002
    Great! Thank you. This is more than enough of a clear start for me to get to work with. I anticipate some difficulties when i try and set the NPC so that he can reward the player after every five or so people, but I have a feeling I can rig something up now that I have the basics.

    The part I was missing completely was the "count - 1" statement, which is irksome since it makes logical sense, and usually i can figure that stuff out before retreating to the forums.
     
  5. Anonymous

    Anonymous Guest

    :)

    Ruelz, nice to see you again! Good luck on this mod!

    Snobothehobo
     
Our Host!