• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[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,285
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,285
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