lonewolf020291
T.E.T.Я.I.S
- 16/3/07
- 579
- 1,017
YAN[asian];21945611 nói:"Nếu mod 4 = 0" là làm sao hả bạn? Mình ko hiểu lắm.
set Real = Real +0.25
if ( Real mod 4 ) == 0.00 then Show Text else Do nothing
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
YAN[asian];21945611 nói:"Nếu mod 4 = 0" là làm sao hả bạn? Mình ko hiểu lắm.
Events
Unit - A unit Dies
Conditions
((Triggering unit) is A Hero) Equal to True
(Level of Critical Strike10 for (Killing unit)) Greater than 0
Actions
Set YUReal[(Custom value of (Killing unit))] = (YUReal[(Custom value of (Killing unit))] + 0.25)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(YUReal[(Custom value of (Killing unit))] mod 4.00) Equal to 0.00
Then - Actions
Floating Text - Create floating text that reads (+ + ((String((Integer(YUReal[(Custom value of (Killing unit))])))) + %)) above (Killing unit) with Z offset 0.00, using font size 10.00, color (100.00%, 0.00%, 0.00%), and 0.00% transparency
Floating Text - Set the velocity of (Last created floating text) to 64.00 towards 90.00 degrees
Floating Text - Change (Last created floating text): Disable permanence
Floating Text - Change the lifespan of (Last created floating text) to 3.00 seconds
Floating Text - Change the fading age of (Last created floating text) to 1.00 seconds
Else - Actions
scope GroundStorm initializer Init
globals
integer SPELL_ID = 'A007'
string SFX = "Abilities\\Spells\\Orc\\EarthQuake\\EarthQuakeTarget.mdl"
endglobals
private function Conds takes nothing returns boolean
return GetSpellAbilityId() == SPELL_ID
endfunction
private function Check takes unit a returns boolean
if GetWidgetLife(GetEnumUnit()) >= 0.405 and IsUnitVisible(GetEnumUnit(), GetOwningPlayer(a)) == true and IsUnitEnemy(GetEnumUnit(), GetOwningPlayer(a)) == true then
return true
endif
endfuntion
private function Actions takes nothing returns nothing
local unit u = GetTriggerUnit()
local real x = GetUnitX(u)
local real y = GetUnitY(u)
local real dbase = GetRandomReal(((GetHeroStr(u,true)*2)+2)+0, ((GetHeroStr(u, true)*2)+(2*6))+0)))
local real dbonus = (GetHeroStr(u, true)*((GetUnitAbilityLevel(u, SPELL_ID)*60)+100))/100
local unit dumy = CreateUnit(GetOwningPlayer(u), 'u000', x, y, 0.)
local group g = CreateGroup()
local unit p
local integer i = 6
call DestroyEffect(AddSpecialEffect(SFX, x, y))
call GroupEnumUnitsInRange(g, GetUnitX(dumy), GetUnitY(dumy), 400., Condition(function Check(u)))
loop
set i = i-1
exitwhen i <= 0
loop
set p = FirstOfGroup(g)
exitwhen p == null
call UnitDamageTarget(u, p, (dbase+dbonus)/6, false, false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_FIRE)
set p = null
endloop
call TriggerSleepAction(1)
endloop
call GroupClear(g)
call DestroyGroup(g)
set u = null
set dumy = null
endfunction
//===========================================================================
private function Init takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ( gg_trg_Ground_Storm, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition(t, Condition(function Conds)
call TriggerAddAction(t, function Actions )
endfunction
endscope

YAN[asian];21945913 nói:^ Sao ko thấy gì hiện lên nhỉ?
Mã:Events Unit - A unit Dies Conditions ((Triggering unit) is A Hero) Equal to True (Level of Critical Strike10 for (Killing unit)) Greater than 0 Actions Set YUReal[(Custom value of (Killing unit))] = (YUReal[(Custom value of (Killing unit))] + 0.25) If (All Conditions are True) then do (Then Actions) else do (Else Actions) If - Conditions (YUReal[(Custom value of (Killing unit))] mod 4.00) Equal to 0.00 Then - Actions Floating Text - Create floating text that reads (+ + ((String((Integer(YUReal[(Custom value of (Killing unit))])))) + %)) above (Killing unit) with Z offset 0.00, using font size 10.00, color (100.00%, 0.00%, 0.00%), and 0.00% transparency Floating Text - Set the velocity of (Last created floating text) to 64.00 towards 90.00 degrees Floating Text - Change (Last created floating text): Disable permanence Floating Text - Change the lifespan of (Last created floating text) to 3.00 seconds Floating Text - Change the fading age of (Last created floating text) to 1.00 seconds Else - Actions
Real( Integer( YUReal ) ) equal to YUReal
Ai sửa giúp mình spell này:
[SPOIL][/SPOIL]Mã:scope GroundStorm initializer Init globals integer SPELL_ID = 'A007' string SFX = "Abilities\\Spells\\Orc\\EarthQuake\\EarthQuakeTarget.mdl" endglobals private function Conds takes nothing returns boolean return GetSpellAbilityId() == SPELL_ID endfunction private function Check takes unit a returns boolean if GetWidgetLife(GetEnumUnit()) >= 0.405 and IsUnitVisible(GetEnumUnit(), GetOwningPlayer(a)) == true and IsUnitEnemy(GetEnumUnit(), GetOwningPlayer(a)) == true then return true endif endfuntion private function Actions takes nothing returns nothing local unit u = GetTriggerUnit() local real x = GetUnitX(u) local real y = GetUnitY(u) local real dbase = GetRandomReal(((GetHeroStr(u,true)*2)+2)+0, ((GetHeroStr(u, true)*2)+(2*6))+0))) local real dbonus = (GetHeroStr(u, true)*((GetUnitAbilityLevel(u, SPELL_ID)*60)+100))/100 local unit dumy = CreateUnit(GetOwningPlayer(u), 'u000', x, y, 0.) local group g = CreateGroup() local unit p local integer i = 6 call DestroyEffect(AddSpecialEffect(SFX, x, y)) call GroupEnumUnitsInRange(g, GetUnitX(dumy), GetUnitY(dumy), 400., Condition(function Check(u))) loop set i = i-1 exitwhen i <= 0 loop set p = FirstOfGroup(g) exitwhen p == null call UnitDamageTarget(u, p, (dbase+dbonus)/6, false, false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_FIRE) set p = null endloop call TriggerSleepAction(1) endloop call GroupClear(g) call DestroyGroup(g) set u = null set dumy = null endfunction //=========================================================================== private function Init takes nothing returns nothing local trigger t = CreateTrigger() call TriggerRegisterAnyUnitEventBJ( gg_trg_Ground_Storm, EVENT_PLAYER_UNIT_SPELL_EFFECT ) call TriggerAddCondition(t, Condition(function Conds) call TriggerAddAction(t, function Actions ) endfunction endscope
Khi save thì nó hiện ra lỗi này
View attachment 165916
YAN[asian];21941215 nói:Mình đang làm 1 cái như này : Khi có 1 sự kiện nào đó, thì set 1 biến Real = Real + 0.25. Giờ muốn khi biến Real đó thành số nguyên (1.000, 2.000, ...) thì cho hiện 1 text lên thì làm thế nào?

Sao không làm cách đơn giản hơn, tạo thêm 1 biến Integer...
-Mỗi khi set Real thì set luôn Integer = Integer + 1
-Khi Integer = 4 thì hiện text, set lại Integer = 0![]()
Và cái quan trọng là nó ko giải quyết được vấn đề hiện text theo ý muốn, vd nó hiện được +1 +2 +3... chẳng hạn. Nếu làm như kia thì lấy cái gì để "hiện"? Nếu chỉ đơn giản là "4 lần thì hiện text" thì cần quái gì biến real? 
set Real = Real +0.25
if ( Real mod 4 ) == 0.00 then Show Text else Do nothing

YAN[asian];21947117 nói:Cũng đã nghĩ tới. Nhưng thử nghĩ xem cái nào hay hơn? Chỉ cần dùng 1 biến với phải tạo đến 2 biến?Và cái quan trọng là nó ko giải quyết được vấn đề hiện text theo ý muốn, vd nó hiện được +1 +2 +3... chẳng hạn. Nếu làm như kia thì lấy cái gì để "hiện"? Nếu chỉ đơn giản là "4 lần thì hiện text" thì cần quái gì biến real?
![]()

)
Hớ, nhầmChia cho 0.25 trc' rồi mới mod với 4 = 0 thì mới hiện chứ![]()

YAN[asian];21947117 nói:Cũng đã nghĩ tới. Nhưng thử nghĩ xem cái nào hay hơn? Chỉ cần dùng 1 biến với phải tạo đến 2 biến?Và cái quan trọng là nó ko giải quyết được vấn đề hiện text theo ý muốn, vd nó hiện được +1 +2 +3... chẳng hạn. Nếu làm như kia thì lấy cái gì để "hiện"? Nếu chỉ đơn giản là "4 lần thì hiện text" thì cần quái gì biến real?
![]()
. 1 biến, 1 lần convert , ko cần gọi hàm rắc rối như cái đám trên 
Ai cho mình xin demo wild axe mà khi caster ở đâu thì nó bay tới đó mới thôi ko
Trên hive thì khi phóng, xong gần về, mình blink đi thì nó vẫn mất, ko tới nơi mà hero vừa blink @@

Có, làm jass hết. XDP hình như chưa thêm cái này vàocho em xin đoạn crip move unit k0 làm mất animation với.. có hướng dẫn sử dụng. em xài XDP thì còn cách nào khác để move k0? (ít rối hơn là customcrip ấy..)

set [COLOR="#FF0000"]Unit[/COLOR] = <unit cần move>
set [COLOR="#FF0000"]Loc[/COLOR] = <điểm cần move tới>
customscript call SetUnitX( udg_[COLOR="#FF0000"]Unit[/COLOR], GetLocationX( udg_[COLOR="#FF0000"]Loc[/COLOR]) )
customscript call SetUnitY( udg_[COLOR="#FF0000"]Unit[/COLOR], GetLocationY( udg_[COLOR="#FF0000"]Loc[/COLOR]) )
@Leo: Mình muốn nó đánh đc và có thể bị đánh, chỉ là ko select đc thôi.
Set TempPlayer = Owner of ...
Custom script: if IsPlayerAlly( GetLocalPlayer(), udg_TempPlayer ) then
Unit - Add Locust to ...
Custom script: endif
@Leo: Mình muốn nó đánh đc và có thể bị đánh, chỉ là ko select đc thôi.
Actions
Unit - Create 1 Rifleman for Player 1 (Red) at (Center of Region 002 <gen>) facing Default building facing degrees
Set TU = (Last created unit)
Custom script: call UnitAddAbility( udg_TU, 'Aloc')
Custom script: call UnitRemoveAbility( udg_TU, 'Aloc')
^ Dùng local player
Mã:Set TempPlayer = Owner of ... Custom script: if IsPlayerAlly( GetLocalPlayer(), udg_TempPlayer ) then Unit - Add Locust to ... Custom script: endif
Thêm đoạn code trên vào sau chỗ create con đệ.
