• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • ✅ The POLL for Hive's Texturing Contest #33 is OPEN! Vote for the TOP 3 SKINS! 🔗Click here to cast your vote!

[Solved] Trigger crashes a game

Status
Not open for further replies.
Level 2
Joined
Jul 4, 2016
Messages
14
For some reason I am getting game crash, using following code:

local unit u
local real r = 0.0
set u = udg_Fear_Passive_victim
set r = r + (0.5 - 0.05 * (I2R(GetUnitLevel(u)))
set r = r + (1 - GetUnitLifePercent(u))/2

What's wrong?
Thanks in advanse!
P.S. For weird reasons my PC doesn't run syntax checker correctly(
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,239
How can that cause the game to crash when the editor will not even let it save? Might be a good idea to show the full trigger.
P.S. For weird reasons my PC doesn't run syntax checker correctly(
The standard World Edit has a rather poor syntax checker. I would recommend you use JNGP with JASS Helper as the syntax checker and default syntax checker disabled.

The default syntax checker/GUI trigger engine of the World Edit is very crash prone. Common typo level mistakes can often cause the editor to crash when saving, something which is not at all helpful and very annoying. Jass Helper in JNGP does not crash under these conditions and if it does then the editor still will not crash.
 
Level 2
Joined
Jul 4, 2016
Messages
14
How can that cause the game to crash when the editor will not even let it save? Might be a good idea to show the full trigger.

The standard World Edit has a rather poor syntax checker. I would recommend you use JNGP with JASS Helper as the syntax checker and default syntax checker disabled.

The default syntax checker/GUI trigger engine of the World Edit is very crash prone. Common typo level mistakes can often cause the editor to crash when saving, something which is not at all helpful and very annoying. Jass Helper in JNGP does not crash under these conditions and if it does then the editor still will not crash.

I use WE Unlimited with many plugins, including JNPG with Jass helper, but something gone wrong with installation of it(
The thing is - WE saves map even if jass code is broken. And I am getting a crash while trying to launch the map in WC3.
Thanks for reply
 
Last edited:

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,239
Does GetUnitLifePercent(u) return Real value or Integer one?
It returns the following...
JASS:
function GetUnitLifePercent takes unit whichUnit returns real
  return GetUnitStatePercent(whichUnit, UNIT_STATE_LIFE, UNIT_STATE_MAX_LIFE)
endfunction
Which returns the following...
JASS:
function GetUnitStatePercent takes unit whichUnit,unitstate whichState,unitstate whichMaxState returns real
    local real value    = GetUnitState(whichUnit, whichState)
    local real maxValue = GetUnitState(whichUnit, whichMaxState)
    if (whichUnit == null) or (maxValue == 0) then
        return 0.0
    endif
    return value / maxValue * 100.0
endfunction
So it is pretty self-explanatory.

If there are syntax errors the map can be considered corrupt as it does not have a valid jass script so the game behaviour is undefined.

One really should not be using WEU as it is known to be unstable, corrupt maps and have other problems.
 
Last edited:
Level 2
Joined
Jul 4, 2016
Messages
14
It returns the following...

Which returns the following...

So it is pretty self-explanatory.

If there are syntax errors the map can be considered corrupt as it does not have a valid jass script so the game behaviour is undefined.

One really should not be using WEU as it is known to be unstable, corrupt maps and have other problems.
Much thanks! I will take it into consideration.
 
Status
Not open for further replies.
Top