PDA

View Full Version : Scripting



Edwin
January 31st, 2020, 11:46
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.



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_EXPERIENCE D,​5)
ENDIF
ENDIF

IF(PLAYER0,TIMER3 > 2500)
IF(PLAYER0,TOTAL_CREATURES >= 1)
BONUS_LEVEL_TIME(0)
KILL_CREATURE(​PLAYER_GOOD,HORNY,MOST_EXPERIENCE D,​5)
ENDIF
ENDIF

YourMaster
January 31st, 2020, 14:30
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:



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_EXPERIENCE D,​5)
BONUS_LEVEL_TIME(0)
ENDIF