Topic hỏi đáp (tập 3) về cách làm map

Status
Không mở trả lời sau này.
Mã:
function Trig_Guardian_Conditions takes nothing returns boolean
    if ( not ( GetUnitTypeId(GetSummonedUnit()) == 'hphx' ) ) then
        return false
    endif
    return true
endfunction

function Trig_Guardian_Func004C takes nothing returns boolean
    if ( not ( DistanceBetweenPoints(GetUnitLoc(udg_ball), GetUnitLoc(udg_master)) >= 1000.00 ) ) then
        return false
    endif
    return true
endfunction

function Trig_Guardian_Actions takes nothing returns nothing
    set udg_master = GetSummoningUnit()
    set udg_ball = GetSummonedUnit()
    exitwhen IsUnitDeadBJ(ball)
    if ( Trig_Guardian_Func004C() ) then
        set udg_target = GetUnitLoc(udg_master)
        call IssuePointOrderByIdLoc(ball,851986,target)
        call RemoveLocation(target)
    else
        set udg_target = GetUnitLoc(udg_master)
        set udg_angel = GetRandomReal(0, 360.00)
        set udg_distance = GetRandomReal(100.00, 500.00)
        call PolarProjectionNL(target,distance,angle)
        call IssuePointOrderByIdLoc(ball,851983,target)
        call RemoveLocation(target)
    endif
    call TriggerSleepAction(.5)
endfunction

//===========================================================================
function InitTrig_Guardian takes nothing returns nothing
    set gg_trg_Guardian = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Guardian, EVENT_PLAYER_UNIT_SUMMON )
    call TriggerAddCondition( gg_trg_Guardian, Condition( function Trig_Guardian_Conditions ) )
    call TriggerAddAction( gg_trg_Guardian, function Trig_Guardian_Actions )
endfunction

Không :>

Vãi đạn bác này, đoạn Trig_Guardian_Func004C , chả có tí tác dụng nào cả =))

target không phải là biến mảng, chưa hề được local

ball với udg_ball loạn cả lên
distance, angle vẫn chưa được local :-w

Thực sự đoạn code này sai be bét cả rùi, thôi bác mô tả skill này ra rùi để ai khác làm hộ, mình gà mà :">
Lúc đầu nhìn tưởng bác này dùng shadowing, local với globals loạn xạ, thật awesome
 
thì đây là skil Guardian trong map dday trước đây tui post rùi mà pác đưa tui 1 bài ko giống trong dday kiểu gì cả=((

mô tả:
gọi summon
summon bay lanh quanh hero
co khả năng tấn công
ko nhấn đc (hình như là thêm skil locust)
và dieu quan trong là con summon này có thể bị ng` khác tấn công

dưới đây là bản code nguyên mẫu của dday pác kiểm tra xem có cách nào chuyển từ jass sang GUI ko:-*
Mã:
function Trig_Guardian_Conditions takes nothing returns boolean
	return(GetUnitTypeId(GetSummonedUnit())=='n00S')
endfunction

function Trig_Guardian_Actions takes nothing returns nothing
	local unit ball=GetSummonedUnit()
	local unit master=GetSummoningUnit()
	local location target
	local real angle
	local real distance
	loop
		exitwhen IsUnitDeadBJ(ball)
		if(DistanceBetweenPoints(GetUnitLoc(ball),GetUnitLoc(master))>1000.)then
			set target=GetUnitLoc(master)
			call IssuePointOrderByIdLoc(ball,851986,target)
			call RemoveLocation(target)
		else
			set target=GetUnitLoc(master)
			set angle=GetRandomReal(0,360)
			set distance=GetRandomReal(100.,500.)
			call PolarProjectionNL(target,distance,angle)
			call IssuePointOrderByIdLoc(ball,851983,target)
			call RemoveLocation(target)
		endif
		call TriggerSleepAction(.5)
	endloop
endfunction
event
Mã:
	call TriggerRegisterAnyUnitEventBJ(udg_trigger116,EVENT_PLAYER_UNIT_SUMMON)
	call TriggerAddCondition(udg_trigger116,Condition(function Trig_Guardian_Conditions))
	call TriggerAddAction(udg_trigger116,function Trig_Guardian_Actions)
 
Cho hỏi làm sao tạo mấy cái Destructible ở 1 vực làm cho nguyên đám trong không ra dc khi mình cast :-/
 
Anh Tom có cái Handle Vars của 1.24 không gửi em với. Tưởng fix mỗi Return Bug là xong hóa ra còn cái Handle Vars, thẳng nào mãi không chơi được.
 
^
^
^ Add locust rồi thì "bị tấn công" kiểu gì?
 
Mã:
function Trig_Flamer_Actions takes nothing returns nothing
	local unit ballz=GetSummonedUnit()
	local unit masterz=GetSummoningUnit()
	local location targetz
	local real anglez
	local real distancez
	loop
		exitwhen IsUnitDeadBJ(ballz)
		if(DistanceBetweenPoints(GetUnitLoc(ballz),GetUnitLoc(masterz))>1000.)then
			set targetz=GetUnitLoc(masterz)
			call IssuePointOrderByIdLoc(ballz,[COLOR="Red"]851986[/COLOR],targetz)
			call RemoveLocation(targetz)
		else
			set targetz=GetUnitLoc(masterz)
			set anglez=GetRandomReal(0,360)
			set distancez=GetRandomReal(100.,500.)
			call PolarProjectionNL(targetz,distancez,anglez)
			call IssuePointOrderByIdLoc(ballz,[COLOR="Red"]851983[/COLOR],targetz)
			call RemoveLocation(targetz)
		endif
		call TriggerSleepAction(.5)
	endloop
endfunction

function Trig_Lightning_Ball_Enters_Copy_Conditions takes nothing returns boolean
	return(GetUnitTypeId(GetTriggerUnit())=='n02O')
endfunction

function Trig_Lightning_Ball_Enters_Copy_Func001Func001C takes nothing returns boolean
	return(GetRandomInt(1,'d')<=50)
endfunction

function Trig_Lightning_Ball_Enters_Copy_Func001C takes nothing returns boolean
	return(GetRandomInt(1,'d')<=67)
endfunction

function Trig_Lightning_Ball_Enters_Copy_Actions takes nothing returns nothing
	if(Trig_Lightning_Ball_Enters_Copy_Func001C())then
		if(Trig_Lightning_Ball_Enters_Copy_Func001Func001C())then
			call UnitAddAbility(GetTriggerUnit(),'S000')
		else
			call UnitAddAbility(GetTriggerUnit(),'S000')
		endif
	endif
	call UnitAddAbility(GetTriggerUnit(),'Aloc')
	call UnitAddAbility(GetTriggerUnit(),'Awan')
endfunction

bị rõ riĩ 3 error .pác nào pro fix dùm
cho hỏi 851986 & 851983 là gì vậy
.
___________Auto Merge________________

.
event là goi summon:| VD: golem water
 
Mã:
function Trig_Flamer_Actions takes nothing returns nothing
    local unit ballz=GetSummonedUnit()
    local unit masterz=GetSummoningUnit()
    local location targetz
    local real anglez
    local real distancez
    loop
        exitwhen IsUnitDeadBJ(ballz)
        if(DistanceBetweenPoints(GetUnitLoc(ballz),GetUnitLoc(masterz))>1000.)then
            set targetz=GetUnitLoc(masterz)
            call IssuePointOrderByIdLoc(ballz,[COLOR=Red]851986[/COLOR],targetz)
            call RemoveLocation(targetz)
        else
            set targetz=GetUnitLoc(masterz)
            set anglez=GetRandomReal(0,360)
            set distancez=GetRandomReal(100.,500.)
            call PolarProjectionNL(targetz,distancez,anglez)
            call IssuePointOrderByIdLoc(ballz,[COLOR=Red]851983[/COLOR],targetz)
            call RemoveLocation(targetz)
        endif
        call TriggerSleepAction(.5)
    endloop
endfunction

function Trig_Lightning_Ball_Enters_Copy_Conditions takes nothing returns boolean
    return(GetUnitTypeId(GetTriggerUnit())=='n02O')
endfunction

function Trig_Lightning_Ball_Enters_Copy_Func001Func001C takes nothing returns boolean
    return(GetRandomInt(1,'d')<=50)
endfunction

function Trig_Lightning_Ball_Enters_Copy_Func001C takes nothing returns boolean
    return(GetRandomInt(1,'d')<=67)
endfunction

function Trig_Lightning_Ball_Enters_Copy_Actions takes nothing returns nothing
    if(Trig_Lightning_Ball_Enters_Copy_Func001C())then
        if(Trig_Lightning_Ball_Enters_Copy_Func001Func001C())then
            call UnitAddAbility(GetTriggerUnit(),'S000')
        else
            call UnitAddAbility(GetTriggerUnit(),'S000')
        endif
    endif
    call UnitAddAbility(GetTriggerUnit(),'Aloc')
    call UnitAddAbility(GetTriggerUnit(),'Awan')
endfunction
bị rõ riĩ 3 error .pác nào pro fix dùm
cho hỏi 851986 & 851983 là gì vậy
.
___________Auto Merge________________

.
event là goi summon:| VD: golem water

Càng ngày mình càng thấy xuất hiện nhiều đoạn trigger kì ảo :-j

Mã:
set ballz = null
set masterz = null
calll RemoveLocation(targetz)
set targetz = null
Vậy là hết 3 rò rỉ :|
 
Sao không để thanh hp của nó ( Selection Scale ) là 0.01, gần như hem thấy rùi + terrain màu xanh thì chỉ những bố lắm chuyện mới vặn vẹo thôi :|
 
vậy chắt pác chưa vô dday rui,mây con linh trong do select ko dc
 
tui vừa mới download một số spell trên mạng về, mà hok bik làm cho hero sử dụng spell đó, ai bik chỉ tui với ?:P
 
Bạn thử up spell đó lên đây cho mọi người xem đi có gì còn giúp được
 
vậy chắt pác chưa vô dday rui,mây con linh trong do select ko dc

khi Locust bị remove, việc select vẫn không thể được nhưng unit đó vẫn bị tấn công bằng "attack tự động" của unit khác

tui vừa mới download một số spell trên mạng về, mà hok bik làm cho hero sử dụng spell đó, ai bik chỉ tui với ?:P

làm spell gốc trên một spelll nào tự sử dụng <--- cách dễ nhất

còn không thì "trigger" vậy (ở ngoài có topic về AI đấy)
 
^ Mình nghĩ ý của câu hỏi ko phải như vậy.
@ *darkman* : Trước hết phải import spell (nghĩa là đoạn code, hay còn gọi là Trigger hoặc Jass) đó vào map của bạn. Sau đó add cho Hero skill mà đoạn code đề cập và sử dụng thôi!
Còn import ntn, Trigger, Jass là gì,... thì bạn tự tìm hiểu nhé :)!
 
Làm thế nào để khi cast 1 spell thì terrain ở chỗ đó trồi lên hoặc sụt xuống theo ý mình? Sau đó vài giây thì trở lại như cũ?
 
YAN[asian];13877530 nói:
Làm thế nào để khi cast 1 spell thì terrain ở chỗ đó trồi lên hoặc sụt xuống theo ý mình? Sau đó vài giây thì trở lại như cũ?

Mã:
call TerrainDeformationCraterBJ( [COLOR="Red"]Thời gian[/COLOR], false, [COLOR="Red"]Vị trí[/COLOR]), [COLOR="Red"]Khoảng cách[/COLOR], Độ sâu )
Code trên chỉ là làm sụp xuống còn trồi lên thì pó tay:|

-----------------------------------------------------------------

Bác Tom nói:
khi Locust bị remove, việc select vẫn không thể được nhưng unit đó vẫn bị tấn công bằng "attack tự động" của unit khác

Sao tìm hoài ko thấy ability locust trong [Unit-remove ability] vậy?
Ko lẽ remove ability này là = jass hả=((
Nếu jass thì pác cho xin code với;;)
 
Mã:
Bác Tom nói:


Sao tìm hoài ko thấy ability locust trong [Unit-remove ability] vậy?
Ko lẽ remove ability này là = jass hả=((
Nếu jass thì pác cho xin code với;;)[/quote]

Locust ko có trong danh sách đó
Locust = 'Aloc'

[CODE]Custom Script: call UnitRemoveAbility( udg_<unit variable>, 'Aloc' )
-> remove ability Locust khỏi unit được chứa trong biến <unit variable>
:|
 
Mã:
call TerrainDeformationCraterBJ( [COLOR="Red"]Thời gian[/COLOR], false, [COLOR="Red"]Vị trí[/COLOR]), [COLOR="Red"]Khoảng cách[/COLOR], Độ sâu )
Code trên chỉ là làm sụp xuống còn trồi lên thì pó tay:|

"Khoảng cách" chắc là "độ rộng" của cái hố?
Phải chăng điền giá trị âm vào "Độ sâu" thì nó trồi lên?
 
Status
Không mở trả lời sau này.
Back
Top