Results 1 to 6 of 6

Thread: need help with script

  
  1. #1
    Imp
    Join Date
    Jan 2014
    Location
    Netherlands
    Posts
    43

    Post need help with script

    when i use this code in the script, i do get the
    but the library becomes available a lot later, instead of giving it when the enters the dungeon.
    the comes in the level through a hero gate, at a timed event.
    the code below is the Original code from the original Dungeon keeper maps as used in Wishvale.
    just changed for

    Code:
    IF(PLAYER0,SORCEROR > 0)
    ROOM_AVAILABLE(PLAYER0,RESEARCH,1,1)
    QUICK_INFORMATION(0,"A Sorceror joins you and brings with him the plans for building a Library. In this room you can research more spells and rooms.",PLAYER0)
    ENDIF

  2. #2
    KeeperFX Author mefistotelis's Avatar
    Join Date
    Sep 2009
    Location
    Poland
    Posts
    1,242

    Default Re: need help with script

    Quote Originally Posted by Edwin View Post
    when i use this code in the script, i do get the
    but the library becomes available a lot later, instead of giving it when the enters the dungeon.
    DK checks one script line per game turn. If you're unlucky, it may take a few seconds for this particular part of script to be executed. But it may take seconds, not a lot later.

    Ie. if there are 20 turns per second and script has 200 lines, the maximum time of waiting is less than 10 seconds (only some lines are added to the per-turn checklist, so it will be more like up to 6 seconds).
    Last edited by mefistotelis; March 17th, 2014 at 20:04.

  3. #3
    Imp
    Join Date
    Jan 2014
    Location
    Netherlands
    Posts
    43

    Default Re: need help with script

    i just timed the time it takes for the library to appear in the rooms section of the menu, 2 minutes after the sorceror appeared i got the library.

    map00203.txt

  4. #4
    KeeperFX Author mefistotelis's Avatar
    Join Date
    Sep 2009
    Location
    Poland
    Posts
    1,242

    Default Re: need help with script

    Quote Originally Posted by Edwin View Post
    i just timed the time it takes for the library to appear in the rooms section of the menu, 2 minutes after the sorceror appeared i got the library.
    With script written the way it is, it may take long before the condition is met.

    Note that the DK script doesn't really work like typical programming language - it isn't sequential in the same manner.
    You could even say it resembled hardware design languages is the area of sequencing instructions.

    When the condition:
    Code:
    IF(all_players,TIMER0 > 2500)
    is met, the lines inside it are not neccessarily executed in sequence - they may, for example, start with your line:
    Code:
        SET_TIMER(all_players,TIMER0)
    If this will happen, no other instructions from IF block will be executed - because the condition will no longer be met.
    The condition isn't checked once at the beginning of the block - it is checked for each instruction inside.

    There is no reason for your condition:
    Code:
    IF(PLAYER0,SORCEROR > 0)
    to be nested in TIMER0 check conditional. Close the conditional earlier and this will work better.

  5. #5
    Dragon DragonsLover's Avatar
    Join Date
    Aug 2009
    Location
    Quebec
    Posts
    1,490
    Gamer IDs

    Steam ID: dragonslover

    Default Re: need help with script

    Setting a timer for ALL_PLAYERS is kind of weird. Better use a normal player instead.

    And yup, like Mefisto said, close the conditional earlier. You have a huge IF condition with all of the other IFs inside. Better separate them in many different small IFs.

    Also, why setting the TIMER0 another time for no reason? If you want to do a loop, you know what command to do.

    And I don't catch this:
    Code:
    IF(PLAYER3,DUNGEON_DESTROYED == 0)
        MAGIC_AVAILABLE(ALL_PLAYERS,POWER_DISEASE,0,0)
    ENDIF
    Just to mention: if you set a timer from the beginning and you don't plan to reset the timer, use IF(PLAYER0,GAME_TURN >= X) instead.
    I like dragons! They're the center of my life! I'll never forget them...



  6. #6
    Imp
    Join Date
    Jan 2014
    Location
    Netherlands
    Posts
    43

    Default Re: need help with script

    Quote Originally Posted by DragonsLover View Post
    Setting a timer for ALL_PLAYERS is kind of weird. Better use a normal player instead.

    And I don't catch this:
    Code:
    IF(PLAYER3,DUNGEON_DESTROYED == 0)
        MAGIC_AVAILABLE(ALL_PLAYERS,POWER_DISEASE,0,0)
    ENDIF
    the thing with the power_disease is that only player3 should be able to use it. so no other player can get the spell if player3's library is taken, after the dungeon is destroyed.

    just removed the
    Code:
    set_timer(all_players,timer0)
    and placed and ENDIF, now it works.

Similar Threads

  1. New script commands
    By mefistotelis in forum KeeperFX
    Replies: 89
    Last Post: May 18th, 2016, 09:04
  2. There is an error in my script??
    By Kerdinario in forum KeeperFX
    Replies: 4
    Last Post: June 2nd, 2013, 14:27
  3. Script error in level 20
    By friscmanseby in forum KeeperFX
    Replies: 1
    Last Post: June 19th, 2012, 04:36
  4. Research Order Script
    By Metal Gear Rex in forum DK1 Mapmaking
    Replies: 4
    Last Post: November 5th, 2010, 18:15
  5. Creatures Not Entering (Not Script Problem)
    By Metal Gear Rex in forum DK1 Mapmaking
    Replies: 3
    Last Post: December 6th, 2009, 00:57

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •