wc3edit.net

United Warcraft 3 map hacking!
It is currently March 28th, 2024, 6:56 pm

All times are UTC




Post new topic Reply to topic  [ 1 post ] 
Author Message
PostPosted: June 20th, 2022, 8:48 am 
Offline
Newcomer

Joined: March 28th, 2020, 6:37 am
Posts: 7
Extracted .j file and used a simple regex to find consecutive returns. Feast your eyes on the problem:

Code:
function jt takes rect R returns unit
return R
return null
endfunction


Found some guides and helpful info (see below).
Not clear how to fix given examples taking and returning a unit and the above is taking and returning different variable types.

Please help :D

Thank you!!

Quote:
the way to fix it (IIRC):

Code:
function returnBug takes unit u returns unit
return u
return null
endfunction


This is an example for a return bug. It has 2 returns, 1 after the other.

Code:
function fix1 takes unit u returns unit
return u
endfunction
function returnBug takes unit u returns unit
call fix1(u)
return u
endfunction


Now those are 2 functions, each returning 1 value.

Though I can't understand how it works, it keeps the maps working.


If at all helpful below is where the return bug func is used. Would appear to be for pathing.
Spoiler:
Code:

function K1 takes nothing returns nothing
local integer L=KL(GetTriggeringTrigger())
local integer Id=jr(GetTriggerUnit())
local integer K0=GetPlayerId(GetOwningPlayer(GetTriggerUnit()))
local group G
if GetStoredBoolean(jS(),"IsPathing"+I2S(Id),"UnitAttached")then
return
endif
if DistanceBetweenPoints(GetUnitLoc(jt(bn[L])),GetUnitLoc(GetTriggerUnit()))<DistanceBetweenPoints(GetUnitLoc(jt(bM[L])),GetUnitLoc(GetTriggerUnit()))then
if GetTerrainCliffLevelBJ(GetUnitLoc(GetTriggerUnit()))>GetTerrainCliffLevelBJ(GetUnitLoc(jt(bn[L])))then
return
endif
else
if GetTerrainCliffLevelBJ(GetUnitLoc(jt(bM[L])))>GetTerrainCliffLevelBJ(GetUnitLoc(jt(bn[L])))then
return
endif
endif
set G=It(GetOwningPlayer(GetTriggerUnit()))
if not IsUnitInGroup(GetTriggerUnit(),G)then
call StoreBoolean(jS(),"BeenDeselected"+I2S(Id),"UnitAttached",true)
call DisplayTimedTextToPlayer(Player(0),0,0,5,"not selected")
else
call StoreBoolean(jS(),"BeenDeselected"+I2S(Id),"UnitAttached",false)
call StoreBoolean(jS(),"CurrentlyPathing"+I2S(K0),"PlayerAttached",true)
endif
call GroupAddUnit(jU(GetStoredInteger(jS(),"PathingUnits"+I2S(K0),"PlayerAttached")),GetTriggerUnit())
call StoreBoolean(jS(),"IsPathing"+I2S(Id),"UnitAttached",true)
call ShowUnitHide(GetTriggerUnit())
call PauseUnit(GetTriggerUnit(),true)
call TriggerSleepAction(DistanceBetweenPoints(GetUnitLoc(jt(bn[L])),GetUnitLoc(jt(bM[L])))/500)
call PauseUnit(GetTriggerUnit(),false)
call SetUnitPathing(GetTriggerUnit(),false)
call TriggerSleepAction(0.5)
call ShowUnitShow(GetTriggerUnit())
if not GetStoredBoolean(jS(),"BeenDeselected"+I2S(Id),"UnitAttached")then
if GetStoredBoolean(jS(),"CurrentlyPathing"+I2S(K0),"PlayerAttached")then
call StoreBoolean(jS(),"CurrentlyPathing"+I2S(K0),"PlayerAttached",false)
call SelectUnitAddForPlayer(GetTriggerUnit(),Player(K0))
call TriggerSleepAction(0)
call StoreBoolean(jS(),"CurrentlyPathing"+I2S(K0),"PlayerAttached",true)
else
call SelectUnitAddForPlayer(GetTriggerUnit(),GetOwningPlayer(GetTriggerUnit()))
endif
endif
call GroupRemoveUnit(jU(GetStoredInteger(jS(),"PathingUnits"+I2S(K0),"PlayerAttached")),GetTriggerUnit())
if CountUnitsInGroup(jU(GetStoredInteger(jS(),"PathingUnits"+I2S(K0),"PlayerAttached")))<=0 then
call StoreBoolean(jS(),"CurrentlyPathing"+I2S(K0),"PlayerAttached",false)
endif
call FlushStoredBoolean(jS(),"BeenDeselected"+I2S(Id),"UnitAttached")
call TriggerSleepAction(0.2)
call SetUnitPathing(GetTriggerUnit(),true)
call FlushStoredBoolean(jS(),"IsPathing"+I2S(Id),"UnitAttached")
call DestroyGroup(G)
set G=null
endfunction


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 21 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group

phpBB SEO


Privacy Policy Statement
Impressum (German)