| 06-15-2006, 01:38 PM | #1 |
1. JASS:function Bounty takes player whichplayer, integer bounty, real x, real y returns nothing local texttag t=CreateTextTag() local string s="+" call AdjustPlayerStateBJ( bounty, whichplayer, PLAYER_STATE_RESOURCE_GOLD ) if bounty<0 then set s="" endif call SetTextTagText(t,s+I2S(bounty),0.025) call SetTextTagPos(t,x,y, 0.00) call SetTextTagColor(t,255,220,0,255) call SetTextTagVelocity(t,0,0.03) if (GetLocalPlayer()==whichplayer) then call SetTextTagVisibility(t,true) set s="UI\\Feedback\\GoldCredit\\GoldCredit.mdl" else call SetTextTagVisibility(t,false) set s="" endif call DestroyEffect(AddSpecialEffect(s,x,y)) call SetTextTagFadepoint(t,2) call SetTextTagLifespan(t,3) call SetTextTagPermanent(t,false) set t=null endfunction 2. JASS:function Bounty_DummyId takes nothing returns integer return 'h003' // endfunction function Bounty2 takes unit u,real x,real y returns nothing local unit d = CreateUnit(Player(13),Bounty_DummyId(),x,y,bj_UNIT_FACING) call TriggerSleepAction(0) call UnitDamageTargetBJ(u,d,1000, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL ) set d = null endfunction Which one is better? |
| 06-15-2006, 02:23 PM | #2 |
Based on concept (not necessarily implementation), the first one is more effective (I think) because in the second, you create a unit with the intent of killing to get the bounty out of it which will pretty much do what the first one does. |
| 06-15-2006, 05:15 PM | #3 |
There's nothing wrong with either styles assuming the code is proper. The first may be tougher to understand to the untrained eye, but it's more customizable in the long run. JASS://Turn this... call UnitDamageTargetBJ(u,d,1000, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL ) //Into this... call UnitDamageTarget(u, d, 1000, false, false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL, null) //Turn this... call AdjustPlayerStateBJ( bounty, whichplayer, PLAYER_STATE_RESOURCE_GOLD ) //Into this... call SetPlayerState(whichplayer, PLAYER_STATE_RESOURCE_GOLD, GetPlayerState(whichplayer, PLAYER_STATE_RESOURCE_GOLD) + bounty) |
| 06-15-2006, 05:29 PM | #4 |
The former is much better, as it allows dynamic amounts and works instantly. |
