My Script is Crashing World Editor...

elmstfreddie

The Finglonger
Reaction score
203
Uhmm... The title pretty much explains it. I have a feeling it's because JASSCraft is giving me this error on line 69
Return types not correct or nonexistant returns
However, line 69 is
JASS:
endfunction

Line 68 is
JASS:
endif

and line 70 is an empty line (line break)!

What the heck is wrong :banghead:

The whole script is kind of long and for my incomplete system so I won't post that unless you need it posted.
 

Waaaaagh

I lost all my rep and my title being a jerk
Reaction score
70
It hates YOU! Well... return types not correct... your function returns something? Does in actually return it? Are you trying to return a unit when it should return a destructible? Show us the script? PLEASE?
 

elmstfreddie

The Finglonger
Reaction score
203
This is the function above line 69 (right above it)

JASS:
constant function MiningTime takes integer UnitType, player Owner returns real
    if UnitType == MinerUnit1() then
        if GetPlayerTechResearched(Owner,ImprovedPicksId(),true) == true then
            return 7.50
        else
            return 8.50                       
        endif                              
    elseif UnitType == MinerUnit2() then        
        return 6.00
    elseif UnitType == MinerUnit3() then
        return 4.50
    endif
endfunction


The one below it is
JASS:
function TextTagProgressBar takes texttag tt,real x,real y,string message returns nothing
    call SetTextTagPermanent(tt,false)
    call SetTextTagLifespan(tt,0.03)
    call SetTextTagColor(tt,255,255,255,0)
    call SetTextTagPos(tt,x,y,0.0)
    call SetTextTagVelocity(tt,0.0,0.0)
    call SetTextTagText(tt,message,0.024)
    call SetTextTagVisibility(tt,true)
endfunction
 

AceHart

Your Friendly Neighborhood Admin
Reaction score
1,495
> MiningTime

There's no way to know it that function always returns a real.
Add a "return 5.0" line before the endfunction.

Alternatively, if you're sure it will never be called with anything other than miners 1-3, replace the last "elseif" with "else".
Actually, if you are sure, you don't need the last test...
 

Waaaaagh

I lost all my rep and my title being a jerk
Reaction score
70
yeah. The last line has to return something. Put "return 0." at the end.

EDIT: DAMN YOU ACEHART!
 

Rheias

New Helper (I got over 2000 posts)
Reaction score
232
JASS:
constant function MiningTime takes integer UnitType, player Owner returns real
    if UnitType == MinerUnit1() then
        if GetPlayerTechResearched(Owner,ImprovedPicksId(),true) == true then
            return 7.50
        else
            return 8.50                       
        endif                              
    elseif UnitType == MinerUnit2() then        
        return 6.00
    elseif UnitType == MinerUnit3() then
        return 4.50
    endif
    return 0.
endfunction


Try that.
 

elmstfreddie

The Finglonger
Reaction score
203
Okay cool, didn't know I needed to do that, because it will only be those 3 units that will ever call that, but WE doesn't know that :)
thanks.
 

Waaaaagh

I lost all my rep and my title being a jerk
Reaction score
70
Yet another soul falls victim to Acehart's undeniably speedy replies. :p

Anyway, it's just a safety. Because, if something happens, and NOTHING gets returned... well, your screwed. So, yeah, that's the reason for that syntax.
 

elmstfreddie

The Finglonger
Reaction score
203
Yes that was definately the problem no more crashes of WE :p
Waaaagh I +repped you anyways since no one can beat AceHart's speed hax.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top