• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Creating Bounty System

Is this idea any good?

  • Yes

    Votes: 1 50.0%
  • No

    Votes: 0 0.0%
  • Seen it before

    Votes: 1 50.0%

  • Total voters
    2
Status
Not open for further replies.
Level 3
Joined
Jan 3, 2011
Messages
19
I'm creating a game as a school project and it's going to be a first person shooter. I have all the units done and the camera and movement set up but now I need a new system. I need a bounty system thats set up so that when someone kills a unit, their bounty increases depending on the units level, and when they kill a hero, either a player or a boss, their bounty rises depending on that level. This would be awesome if it was shown on a multiboard or somehow shown with all the players. You win the game by reaching 5000 gold, which you get through killing units and bosses and other players.

Any help would be greatly appreciated!!!:goblin_good_job:
(P.S. + rep for any good suggestions and/or solutions)
 
Well... if all of the levels are constant, then this should work (just cnp into map and watch it go)

This will also show the leaderboard (uses gold as requested)

This requires vjass- http://www.hiveworkshop.com/forums/...ing-up-newgen-we-intro-trigger-editor-188349/
JASS:
struct BountySys extends array
    private static constant integer LEVEL_MULTIPLIER = 5
    private static constant integer HERO_LEVEL_MULTIPLIER = 10
    private static leaderboard b = null
    private static method r takes nothing returns nothing
        local player p = GetOwningPlayer(GetKillingUnit())
        if (IsUnitType(GetTriggerUnit(), UNIT_TYPE_HERO)) then
            call SetPlayerState(p, PLAYER_STATE_RESOURCE_GOLD, GetPlayerState(p,PLAYER_STATE_RESOURCE_GOLD)+GetHeroLevel(GetTriggerUnit())*LEVEL_MULTIPLIER)
        else
            call SetPlayerState(p, PLAYER_STATE_RESOURCE_GOLD, GetPlayerState(p,PLAYER_STATE_RESOURCE_GOLD)+GetUnitLevel(GetTriggerUnit())*HERO_LEVEL_MULTIPLIER)
        endif
        call LeaderboardSetItemValue(b, LeaderboardGetPlayerIndex(b, p), GetPlayerState(p,PLAYER_STATE_RESOURCE_GOLD))
    endmethod
    private static method l takes nothing returns nothing
        call LeaderboardRemovePlayerItem(b, GetTriggerPlayer())
    endmethod
    private static method e takes nothing returns nothing
        local trigger t = CreateTrigger()
        local trigger t2 = CreateTrigger()
        local integer i = 15
        local player p
        set b = CreateLeaderboard()
        loop
            set p = Player(i)
            call TriggerRegisterPlayerUnitEvent(t, p, EVENT_PLAYER_UNIT_DEATH, null)
            if (GetPlayerSlotState(p) == PLAYER_SLOT_STATE_PLAYING and GetPlayerController(p) == MAP_CONTROL_USER) then
                call LeaderboardAddItem(b, "Bounty", 0, p)
                call TriggerRegisterPlayerEvent(t2, p, EVENT_PLAYER_LEAVE)
                call PlayerSetLeaderboard(p, b)
            endif
            exitwhen i == 0
            set i = i - 1
        endloop
        call TriggerAddAction(t, function thistype.r)
        call TriggerAddAction(t2, function thistype.l)
        call LeaderboardDisplay(b, true)
        call LeaderboardSortItemsByValue(b,false)
        set t = null
        set t2 = null
        call DestroyTimer(GetExpiredTimer())
    endmethod
    private static method onInit takes nothing returns nothing
        call TimerStart(CreateTimer(), 0, false, function thistype.e)
    endmethod
endstruct

But that'll give the same gold by level for monsters, heroes, and bosses.

For heroes, it'll use the hero level. For units, it'll use the unit level.

If you want to give more gold for hero/boss kills (bigger multiplier), then I can mod it slightly to do that.

An easy way is to make bosses heroes and just give them higher levels =). Then you can have 2 sets of multipliers, one for heroes and one for units.. in fact, I'll do that for you right now =P

edit
done
 
Status
Not open for further replies.
Top