| 11-19-2003, 04:32 PM | #1 |
I know this has been asked a lot and I will hopfully have something a little different to ask. I know how to make a unit drop it's bounty by setting the player flag on for the player and setting the bounty in the unit editor. Now, I didn't use that method because I wanted an increasing bounty with hero level so I went complete triggers. Player - Add ((Hero level of (Dying unit)) x 100) to (Owner of (Killing unit)) Current gold but, I want it to display the number/amount of gold above the dying units head when it's collected. How do I do this? Setting bounty doesn't have anything to do with this, I believe it's all trigger based... help would be appreciated. Hope this is different than what these other people are asking. |
| 11-19-2003, 05:57 PM | #2 |
Eeek. Toughy. As far as I know there are no actions to change a unit's bounty... so you have a couple options: 1. Have heroes that level-up quickly replaced by new units, and make as many units for each hero as you want levels. (yuck) 2. Do away with the game's bounty system and make your own, using floating text and special effects to reproduce the bounty-dropping. Neither way is very much fun. The first is less conceptually difficult, but also much less elegant. Meanwhile, the second is a pain in the, uh, neck. Floating texts are incredibly touchy and buggy, and you'd have to have at least two arrays - one to keep track of the floating texts, and one to keep track of the special effects... |
| 11-19-2003, 06:08 PM | #3 |
well, it sounds like I'm not going to be doing that anytime soon... forget all the work that's involved in that one... :) Create a new hero for every level?? yikes! I wish there was just a way to create an expanding bounty in triggers... that would make it so much easier... Editor Wish List maybe? If anyone can think of another way to make this work... please let me know... I'm sure others would like to know as well. |
| 11-19-2003, 06:56 PM | #4 |
Just use the second idea that Ligature said. Use floating text to display it above the dying units head. It only takes 1 trigger and is not really that long or complicated. I added one for my rpg to display the exp the dying unit gave to my hero. You just have to make sure to set the floating texts to an array just incase he kills 2 heros at the same time. |
| 11-20-2003, 12:09 AM | #5 |
Floating text isn't nearly as hard as some make out... yes it can be flaky as hell but it's entirely possible to make a functioning. Code:
Fake Bounty Events Unit - A unit owned by Player 12 (Brown) Dies Conditions Actions Custom script: local texttag udg_BountyText Floating Text - Create floating text that reads (String((Point-value of (Dying unit)))) above (Dying unit) with Z offset 0.00, using font size 10.00, color (90.00%, 80.00%, 0.00%), and 0.00% transparency Set BountyText = (Last created floating text) Floating Text - Set the velocity of BountyText to 64.00 towards 90.00 degrees Wait 1.00 game-time seconds Floating Text - Destroy BountyText This is about as simple as it gets, no fading though. If you want the text to fade it's a bit more work, altough not much more... |
| 11-20-2003, 12:19 AM | #6 |
You can also manually add that Coin special effect to the location of the unit that's killed, to get the visuals that accompany bounty. |
| 11-20-2003, 01:33 AM | #7 |
Grater's trigger will work under most conditions, but it fails when: 1. you have weird camera angles that can change - the text moves horizontally, not vertically. 2. you have many units dying and giving bounties simultaneously - in this case, you can use Grater's trigger with just a little tweaking to set up a Floating Text array; otherwise floating texts are likely to persist forever, when one unit is killed during the "wait 1 second" of the fake bounty triggered by another unit. |
| 11-20-2003, 01:51 PM | #8 |
Check this function I made, copy it to the trigger root Code:
function Bounty_child takes nothing returns nothing
local texttag t= bj_lastCreatedTextTag
local effect goldcoins=bj_lastCreatedEffect
local integer alpha=255
call DestroyTrigger( GetTriggeringTrigger() )
call TriggerSleepAction(2.00)
loop
set alpha=alpha - 64
exitwhen alpha <= 0
call SetTextTagColor(t,255,220,0,alpha)
call TriggerSleepAction(0.01)
endloop
call DestroyTextTag(t)
call DestroyEffect(goldcoins)
endfunction
function Bounty takes player whichplayer, integer bounty, real x, real y returns nothing
local texttag t=CreateTextTag()
local trigger child=CreateTrigger()
set bj_lastCreatedEffect=AddSpecialEffect("UI\\Feedback\\GoldCredit\\GoldCredit.mdl",x,y)
call SetTextTagVisibility(t,(GetLocalPlayer() == whichplayer))
call AdjustPlayerStateBJ( bounty, whichplayer, PLAYER_STATE_RESOURCE_GOLD )
call SetTextTagText(t,"+"+I2S(bounty),0.025)
call SetTextTagPos(t,x,y, 0.00)
call SetTextTagColor(t,255,220,0,255)
call SetTextTagVelocity(t,0,0.02)
call TriggerAddAction( child, function Bounty_child )
set bj_lastCreatedTextTag=t
call TriggerExecute( child )
endfunctionThen whenever you want to give bounty to a player then use this: set deadunit=(triggering unit) set bountyplayer = (owner of (killing unit)) set bounty = 1000 Custom Script: call Bounty( udg_bountyplayer , udg_bounty ,GetUnitX(udg_deadunit) , GetUnity(udg_deadunit) ) You'll need an unit variable called deadunit (case sensitive please) , a player variable called bountyplayer and an integer variable called bounty It will give the player the bounty, show the floatting text to the player, the special effect, and it will also fade the text as the normal bounty does. |
| 12-05-2003, 09:06 PM | #9 |
Great job, but how do you add the JASS to the Trigger Root? That's the only part I'm stuck on. I got the variables and other stuff... The only thing I need is where you add the JASS to and where you put the actions "setting variables" at... |
| 12-05-2003, 09:17 PM | #10 |
Well I guess that you should check my attachment , also these things: set deadunit=(triggering unit) set bountyplayer = (owner of (killing unit)) set bounty = 1000 Custom Script: call Bounty( udg_bountyplayer , udg_bounty ,GetUnitX(udg_deadunit) , GetUnity(udg_deadunit) ) go in the trigger's actions |
