just ignore

Clan GAOP seems to be history :(

Moderator: ipeonrush

just ignore

Postby Cpt.DaveyJones » 09.04.2008, 19:01

Just need a place where I can save code I write by hand which I can lateron use on my PC. Please just ignore this section 8)
Me be bt a humble pirate from Puff and GAOP
User avatar
Cpt.DaveyJones
Storm-Wind
 
Posts: 123
Joined: 19.12.2007, 21:18

Postby Cpt.DaveyJones » 09.04.2008, 19:50

killing spree system
Do not use this in your map it isn't tested nor complete :D
I just coded it from scratch, online, so please don't try it. I'll upload a tested version once I got Internet on my PC again

Function: Easy Killing Spree System that uses one liners to add new killing spree levels.
Code: Select all
library KillingSpree initializer KillInit
globals
                     integer array Kills
                     integer array KillsWithoutDeath
                     integer array MaxKillsWithoutDeath
    private          integer array KillLevel
                     integer array Deaths

    private          integer array KillLevelLimit
    private          integer array KillLevelBounty
    private          string  array KillLevelStartString
    private          string  array KillLevelEndString
    private          integer array KillLevelPointer
    private          integer       KillLevels = -1

    private          integer array KillLevelDefeatBounty
    private          string  array KillLevelStartDefeatString
    private          string  array KillLevelEndDefeatString

    private          trigger       KillHandler
    private          boolean       InActive = false
    private constant integer       NumPlayers  = 15
endglobals

//! runtextmacro QSORT( "KillLevelLimit" , "KillLevelPointer" , "integer" )
//! runtextmacro BSEARCH( "KillLevelLimit" )

function NewKillLevel takes integer kills , string startmessage , string endmessage , integer bounty , string startdefeatmessage , string enddefeatmessage , integer defeatbounty returns nothing
    set KillLevels = KillLevels + 1
    set KillLevelLimit      [ KillLevels ] = kills
    set KillLevelPointer    [ KillLevels ] = KillLevels
    set KillLevelStartString[ KillLevels ] = startmessage
    set KillLevelEndString  [ KillLevels ] = endmessage
    set KillLevelBounty     [ KillLevels ] = bounty

    set KillLevelStartDefeatString[ KillLevels ] = startdefeatmessage
    set KillLevelEndDefeatString  [ KillLevels ] = enddefeatmessage
    set KillLevelDefeatBounty     [ KillLevels ] = defeatbounty
    set InActive = true
endfunction

private function KillHandler_Actions takes nothing returns nothing
    local player  killPlayer   = GetOwningPlayer( GetKillingUnit() )
    local integer killPlayerId = PlayerId( killPlayer )
    local player  deadPlayer   = GetOwningPlayer( GetTriggerUnit() )
    local integer deadPlayerId = PlayerId( killPlayer )
    local integer index
    set Kills            [ killPlayerId ] = Kills            [ killPlayerId ] + 1
    set KillsWithoutDeath[ killPlayerId ] = KillsWithoutDeath[ killPlayerId ] + 1
    set Deaths           [ deadPlayerId ] = Deaths           [ deadPlayerId ] + 1
    if MaxKillsWithoutDeath[ deadPlayerId ] <  KillsWithoutDeath[ deadPlayerId ] then
        set MaxKillsWithoutDeath[ deadPlayerId ] = KillsWithoutDeath[ deadPlayerId ]
    endif
    set KillsWithoutDeath[ deadPlayerId ] = 0
    if InActive then
        call QSortKillLevelLimit( 0 , KillLevels )
        set InActive = false
    endif
    set index = BSearchKillLevelLimit( Kills[ killPlayerId ] , 0 , KillLevels )
    if index != -1 then
        set index = KillPointer[ index ]
        call DisplayTimedTextToPlayer( GetLocalPlayer() , 0 , 0 , 15 , KillLevelStartString[ index ] + GetPlayerName( killPlayer ) + KillLevelEndString[ index ] )
        call SetPlayerState( killPlayer , PLAYER_STATE_RESOURCE_GOLD , GetPlayerState( killPlayer , PLAYER_STATE_RESOURCE_GOLD ) + KillLevelBounty[ index ] )
        call SetPlayerState( killPlayer , PLAYER_STATE_GOLD_GATHERED , GetPlayerState( killPlayer , PLAYER_STATE_GOLD_GATHERED ) + KillLevelBounty[ index ] )
        set KillLevel[ killPlayerId ] = index
    endif
    if KillLevel[ deadPlayerId ] > 0 then
       
        set index = KillLevel[ deadPlayerId ]
        call DisplayTimedTextToPlayer( GetLocalPlayer() , 0 , 0 , 15 , KillLevelDefeatStartString[ index ] + GetPlayerName( killPlayer ) + KillLevelDefeatEndString[ index ] )
        call SetPlayerState( killPlayer , PLAYER_STATE_RESOURCE_GOLD , GetPlayerState( killPlayer , PLAYER_STATE_RESOURCE_GOLD ) + KillLevelDefeatBounty[ index ] )
        call SetPlayerState( killPlayer , PLAYER_STATE_GOLD_GATHERED , GetPlayerState( killPlayer , PLAYER_STATE_GOLD_GATHERED ) + KillLevelDefeatBounty[ index ] )
        set KillLevel[ deadPlayerId ] = 0
    endif
endfunction

private function KillInit takes nothing returns nothing
    local integer loopA = 0
    set  KillHandler = CreateTrigger()
    call TriggerRegisterAnyUnitEventBJ( KillHandler , EVENT_PLAYER_UNIT_DEATH )
    call TriggerAddAction( KillHandler , function KillHandler_Actions )
    loop
        exitwhen loopA > NumPlayers
        set KillLevel           [ loopA ] = 0
        set Kills               [ loopA ] = 0
        set KillsWithoutDeath   [ loopA ] = 0
        set MaxKillsWithoutDeath[ loopA ] = 0
        set Deaths              [ loopA ] = 0
        set loopA = loopA + 1
    endloop
endfunction
endlibrary
Last edited by Cpt.DaveyJones on 10.04.2008, 17:54, edited 1 time in total.
Me be bt a humble pirate from Puff and GAOP
User avatar
Cpt.DaveyJones
Storm-Wind
 
Posts: 123
Joined: 19.12.2007, 21:18

Postby ipeonrush » 10.04.2008, 00:11

email me serra at xxxxxxxxxxxxxxxx@hotmail.com

thanks.
User avatar
ipeonrush
Normandier
 
Posts: 11
Joined: 30.09.2007, 23:04


Return to Clan GAOP

Who is online

Users browsing this forum: No registered users and 1 guest

cron