accum magic


(Flippy) #1

Hey…
got a lil question about accums…
(i cant try it myself atm)

Is this possible:

accum 0 abort_if_greater_than accum 1

:???:

If not… is there any other way to check if one accum is greater than another accum?

I want this for a map where the team which holds a central flag gets one point deducted from their start score (30) for each 5 seconds they hold the flag…

if they get to 0, they win… if the timelimit is hit, i want the team with the lowest score to win…

trigger timelimit_hit
{
accum 0 abort_if_greater_than accum 1
[whole lot of things]
}

is it possible?


(kamikazee) #2

So you know to check if one of the two gets zero, set the winner to that team and end the round.

Now, there is a trick to check if one accum is greater: simply store the difference in a third accum. That accum is either positive, negative or 0.
now you only need to choose if positive means that the allies are winning, or the axis.
When modifying the difference, it’s allso best to check if the difference changes from positive to negative, or vice versa. Change the winner in that case.


(Flippy) #3

yeah i thought of that too, but it only got more complicated i think :\

how do i let the game keep track of the difference between 2 accums??
and how do i let it know that this difference changed from say 0 to positive?

and why is scripting in ET so complicated? :clap: why not visual basic style “if axisscore > alliedscore then trigger axis_win” :smiley:


(kamikazee) #4

How to keep track of the difference you say?
Simple:


gamemanager {
    // accum 0 = allies score
    // accum 1 = axis score
    // accum 2 = score difference
    //    -> positive: allies are ahead
    //    -> negative: axis are ahead
    spawn {
        wait 100
        accum 0 set 30
        accum 1 set 30
        accum 2 set 0
    }
    trigger allies_held {
        accum 0 inc -1
        accum 2 inc 1
        accum 2 abort_if_less_than 1
        // Difference is positive, allies are ahead
        wm_setwinner 1
    }
    trigger axis_held {
        accum 1 inc -1
        accum 2 inc -1
        accum 2 abort_if_greater_than -1
        // Difference is negative, axis are ahead
        wm_setwinner 0
    }
    // trigger check_score
    // etc.
}

I agree that W:ET scripting is counter-intuitive. Doom 3 scripting is better in that aspect, so ET:QW will probably be comparable to that.