• 🏆 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!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Editor Bug? Can't initialize Gamecaches

Status
Not open for further replies.
Level 4
Joined
Aug 9, 2008
Messages
67
Ok well my experience with JASS is rather limited so forgive me if I am wrong here:
Its not complaining about the "udg_GameCache" part, if it where it would say "udg_GameCache is an undeclared variable" or something similar. The problem lies in the parameter the stuff in brackets after InitGameCache. It wants to see a Gamecache there but you give it a string. Maybe you mispelled it or something similar.

I hope (but Im not being very hopeful :p) that this helps :)
 
Another problem


JASS:
private function Conditions takes unit caster returns boolean
  return GetSpellAbilityId() == AID and IsUnitPaused(caster) == false
endfunction


set g = GroupEnumUnitsInRange  (g, x, y,  256.00, Condition(function ConditionsOfEnum(caster)))

The JassHelper says:
Syntax error ( set g ... )
Unable to use nothing here (g).

Well and the function with the Gamecache is the normal function like in Local Handle Vars, I just replaced it with a global variable with type gamecache.
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,198
set udg_GameCache = InitGameCache("Whatever") works fine if GameCache is a cache variable.

set g = GroupEnumUnitsInRange (g, x, y, 256.00, Condition(function ConditionsOfEnum(caster)))
Has to be inside a function. JASS only lets you execute code within functions for a logical reason. Thus what you are doing makes no sense.
 
set udg_GameCache = InitGameCache("Whatever") works fine if GameCache is a cache variable.

set g = GroupEnumUnitsInRange (g, x, y, 256.00, Condition(function ConditionsOfEnum(caster)))
Has to be inside a function. JASS only lets you execute code within functions for a logical reason. Thus what you are doing makes no sense.

it actually is,...

so the JNGP text is something like this:

JASS:
function condition takes unit u returns boolen
   return blah..
endfunction

function blah takes nothing returns nothing
set g = GroupEnumUnitsInRange  (g, x, y,  256.00, Condition(function ConditionsOfEnum(caster)))
endfunction

I think the problem is the unit that I transfair with the condition, or?
 
Well, you can not ask for help with syntax errors unless you post the WHOLE code and list ALL the variables used.

Remember that functions can not call functions below them in the script.

Ok,
here is an example of the code:

JASS:
function condition takes nothing returns nothing
return IsUnitEnemy(GetFilterUnit(),GetOwningPlayer(GetFilterUnit())) == true
endfunction

function action takes nothing returns nothing
local group g
local unit caster = GetTriggerUnit()
local unit target = GetSpellTargetUnit()
local real x = GetUnitX(target)
local real y = GetUnitY(target)

set g = GroupEnumUnitsInRange (g, x, y, 256.00, Condition(function Conditions))

call DestroyGroup(g)

set g = null
endfunction
The only problem is that I don't want to check the owner of the Filterunit, but the owner of the caster. Is that possible?
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,198
JASS:
globals
    player ActionOwner
endglobals

function Conditions takes nothing returns boolean
    return IsUnitEnemy(GetFilterUnit(),ActionOwner)
endfunction

function action takes nothing returns nothing
    local unit caster = GetTriggerUnit()
    local unit target = GetSpellTargetUnit()
    local real x = GetUnitX(target)
    local real y = GetUnitY(target)
    local group g = CreateGroup()

    set ActionOwner = GetOwningPlayer(caster)
    set g = GroupEnumUnitsInRange(g, x, y, 256, Condition(function Conditions))
    //set ActionOwner = null //Only needed if the caster will be destroyed shortly and the spell never recast, otherwise leave this disabled.

    call DestroyGroup(g)

    set g = null
    set caster = null
    set target = nill
endfunction

Notice the changes.
 
Status
Not open for further replies.
Top