Results 1 to 2 of 2

Thread: Scripting

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

    Default Scripting

    Trying something new here, the idea is that when you reach 8 good creatures a party of horned reapers are spawning in your dungeon.

    When you have 0 creatures the timer should end, and kill all the horned reapers.
    It somewhat functions in that way that it kills the horned reapers when you have 0 creatures but only when the bonus timer hits 0. And not when you reach 0 creatures.

    The thing that doesn't function at all, is when the timer hits 0, and you have one or more creatures left, it should also kill the horned reapers.

    Code:
    IF(​PLAYER0,GOOD_CREATURES == 8​)
    SET_TIMER(PLAYER0,TIMER2)
    BONUS_LEVEL_TIME(2500)
    QUICK_OBJECTIVE(3,"These horny's are here to purge your dungeon",PLAYER0)
    ADD_PARTY_TO_LEVEL(PLAYER_GOOD,THE_PURGE,-1,1)
    ENDIF
    
    IF(​PLAYER0,GOOD_CREATURES == 8​)
    SET_TIMER(PLAYER0,TIMER3)
    ENDIF
    
    IF(PLAYER0,TIMER2 > 2500)
    BONUS_LEVEL_TIME(0)
    IF(PLAYER0,TOTAL_CREATURES == 0)
    KILL_CREATURE(​PLAYER_GOOD,HORNY,MOST_EXPERIENCED,​5)
    ENDIF
    ENDIF
    
    IF(PLAYER0,TIMER3 > 2500)
    IF(PLAYER0,TOTAL_CREATURES >= 1)
    BONUS_LEVEL_TIME(0)
    KILL_CREATURE(​PLAYER_GOOD,HORNY,MOST_EXPERIENCED,​5)
    ENDIF
    ENDIF

  2. #2

    Default Re: Scripting

    Timer2 and Timer3 are started at the same time, so they should have the same value. One can go. Also, the KILL_CREATURE command is keeperfx specific, so you need a LEVEL_VERSION(1):

    I think this is what you want:

    Code:
    LEVEL_VERSION(1)
    
    IF(​PLAYER0,GOOD_CREATURES >= 8​)
        SET_TIMER(PLAYER0,TIMER2)
        BONUS_LEVEL_TIME(2500)
        QUICK_OBJECTIVE(3,"These horny's are here to purge your dungeon",PLAYER0)
        ADD_PARTY_TO_LEVEL(PLAYER_GOOD,THE_PURGE,-1,1)
    ENDIF
    
    REM If the timer runs out or Red runs out of units, the purge ends.
    IF(PLAYER0,TOTAL_CREATURES == 0)
        IF(PLAYER0,TIMER2 > 0)
            SET_FLAG(PLAYER0,FLAG0,1)
        ENDIF
    ENDIF
    IF(PLAYER0,TIMER2 >= 2500
        SET_FLAG(PLAYER0,FLAG0,1)
    ENDIF
    
    IF(PLAYER0,FLAG0 == 1)
        KILL_CREATURE(​PLAYER_GOOD,HORNY,MOST_EXPERIENCED,​5)
        BONUS_LEVEL_TIME(0)
    ENDIF
    Last edited by YourMaster; January 31st, 2020 at 14:39.

Similar Threads

  1. scripting problems
    By darkkingkongman in forum DK1 Mapmaking
    Replies: 5
    Last Post: June 2nd, 2014, 22:02
  2. Camera scripting
    By Hades in forum KeeperFX
    Replies: 1
    Last Post: February 8th, 2013, 01:15
  3. Primary Jobs and scripting, question
    By Skyman in forum KeeperFX
    Replies: 3
    Last Post: January 1st, 2013, 22:10
  4. Replies: 32
    Last Post: January 17th, 2011, 06:15
  5. Replies: 4
    Last Post: January 9th, 2011, 14:46

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
  •