d is not of a type that allows .syntax

GetTriggerUnit-

DogEntrepreneur
Okay, I get this Jasshelper error (yes I got it almost fully working).
Basicly, the only one that gives me this error is d.offsetWTH?
I'm new to vJass (btw)
_I want this spell MUI so I use struct data.

JASS:

scope HookShot initializer Init
    globals
        private constant integer SPELL_ID = 'H00K'
        private constant integer DUMMY_ID = 'dumy'
    endglobals

private struct data
    unit caster
    real offset
    real angle
    real lenght
    location cpoint
    player p
endstruct

function Cond takes nothing returns boolean
    return GetSpellAbilityId() == SPELL_ID
endfunction

function Callback takes nothing returns nothing
    local location spawnpoint
    local unit c
    set d.offset = d.offset + 20.00
    set d.lengh = d.lenght - 0.05
    
    set spawnpoint = PolarProjectionBJ( d.cpoint, d.offset, d.angle )
    set c = CreateUnitAtLoc( p, DUMMY_ID, spawnpoint, d.angle )
    call UnitApplyTimedLife( c, 'BTLF', d.lenght )
        
    call RemoveLocation( spawnpoint)
    set spawnpoint = null
endfunction

function Main takes nothing returns nothing
    local unit u = GetTriggerUnit()
    local timer t
    local location tloc = GetSpellTargetLoc()
    local location uloc = GetUnitLoc( u)
    
    set d.cpoint = uloc
    set d.offset = 0.00
    set d.lengh = 2.00
    set d.angle = AngleBetweenPoints( uloc, tloc)
    set d.p = GetOwningPlayer( u)
    call TimerStart( t, 0.05, true, function Callback)
    
    call RemoveLocation( tloc)
    call RemoveLocation( uloc)
    call RemoveLocation( d.cpoint)
    set u = null
    set t = null
    set tloc = null
    set uloc = null
endfunction

//===========================================================================
function Init takes nothing returns nothing
    local trigger t = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( t, Condition( function Cond))
    call TriggerAddAction( t, function Main )
endfunction

endscope
 

cleeezzz

The Undead Ranger.
JASS:
scope HookShot initializer Init
    globals
        private constant integer SPELL_ID = 'H00K'
        private constant integer DUMMY_ID = 'dumy'
    endglobals

private struct data
    unit caster
    real offset
    real angle
    real lenght
    location cpoint
    player p
endstruct

function Cond takes nothing returns boolean
    return GetSpellAbilityId() == SPELL_ID
endfunction

function Callback takes nothing returns nothing
    local data d = GetCSData(GetExpiredTimer())
    local location spawnpoint
    local unit c
    set d.offset = d.offset + 20.00
    set d.lengh = d.lenght - 0.05
    
    set spawnpoint = PolarProjectionBJ( d.cpoint, d.offset, d.angle )
    set c = CreateUnitAtLoc( p, DUMMY_ID, spawnpoint, d.angle )
    call UnitApplyTimedLife( c, 'BTLF', d.lenght )
        
    call RemoveLocation( spawnpoint)
    set spawnpoint = null
endfunction

function Main takes nothing returns nothing
    local unit u = GetTriggerUnit()
    local timer t
    local location tloc = GetSpellTargetLoc()
    local location uloc = GetUnitLoc( u)
    local data d = data.create()

    set d.cpoint = uloc
    set d.offset = 0.00
    set d.lengh = 2.00
    set d.angle = AngleBetweenPoints( uloc, tloc)
    set d.p = GetOwningPlayer( u)
    call TimerStart( t, 0.05, true, function Callback)
    call SetCSData(t,d)
    call RemoveLocation( tloc)
    call RemoveLocation( uloc)
    call RemoveLocation( d.cpoint)
    set u = null
    set t = null
    set tloc = null
    set uloc = null
endfunction

//===========================================================================
function Init takes nothing returns nothing
    local trigger t = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( t, Condition( function Cond))
    call TriggerAddAction( t, function Main )
endfunction

endscope

you didn't use any attachment system so the struct would not be carried over to the callback function
the code now requires CSData

(and btw, you never created the struct, you must create it by doing (struct name).create(), in your case, data.create()

and you must set it to a variable in order to use it

local (struct name) (variable)
set (variable) = (struct name).create()

in your case

local data d
set d = data.create()

or you could skip a step like i did in the code

local data d = data.create()
 

cleeezzz

The Undead Ranger.
http://www.wc3c.net/showthread.php?t=80534

16.0 for 1.23b patch
15.3 for current


>>>>Oh and, in the call TimerStart, what does the boolean means?
periodic or not

if true, the timer will restart when it expires. so

call TimerStart(t,1,true,function hi)
would run function hi every second

call TimerStart(t,1,false,function hi)
would run function hi only once
 

GetTriggerUnit-

DogEntrepreneur
>>>>Oh and, in the call TimerStart, what does the boolean means?
periodic or not

if true, the timer will restart when it expires. so

call TimerStart(t,1,true,function hi)
would run function hi every second

call TimerStart(t,1,false,function hi)
would run function hi only once
Do I need a special system for CSData?

and, how can I stop the function to be ran?
 

cleeezzz

The Undead Ranger.
>Do I need a special system for CSData?
not that i know of, unless you dont have newgen?

>and, how can I stop the function to be ran?
stop the timer?
 

T.s.e

Wish I was old and a little sentimental
Sure. Just remember to pause the timer before destroying it, or else it will bug up and continue to run, after what I've heard.

Something like this perhaps?

JASS:
// Structs and such

private function CB takes nothing returns nothing
    local data d = GetCSData(GetExpiredTimer())
    set d.counter = d.counter + 1
    if d.counter < 50 then
       // Do your things, including nulling of handles within this block
    
    else
        call PauseTimer(GetExpiredTimer())
        call DestroyTimer(GetExpiredTimer())
        call d.destroy()
        return
     endif
endfunction

private function Actions takes nothing returns nothing
    local timer t = CreateTimer()
    local data d = data.create()
    set d.counter = 0
    call TimerStart(t, 0.035, true, function CB)
    // Your other actions go here, of course.
    set t = null
endfunction
 

Romek

Super Moderator
Staff member
Use TimerUtils instead of CSData.
 

Romek

Super Moderator
Staff member
TimerUtils has timer recycling.
 

Romek

Super Moderator
Staff member
Obviously CSData won't leak; It's a system which doesn't even create handles... :confused:
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • C Cherry.Grove:
    My boyfriend is super into Bethesda modding so I'm probably going to join him in that for a bit, then move on to making mobile/browser games.
  • C Cherry.Grove:
    I mostly just want to look at my old projects because I know I posted uploads on here somewhere.
  • C Cherry.Grove:
    My one game was basically Among Us but you sabotaged an entire medieval city simulated drastically inefficiently with dynamic NPCs :S
  • C Cherry.Grove:
    of course I never finished it x D
  • jonas jonas:
    xD
  • jonas jonas:
    I think you can still run the original game, just there's a chance your map won't work with the newer patches
  • jonas jonas:
    what development framework have you been looking at for mobile development?
  • jonas jonas:
    I'm currently creating (as a hobby) a space invaders like game for mobile using Xamarin, after starting a few larger projects that I also may not have finished :rolleyes::p
  • The Helper The Helper:
    Awesome! you should look at the Atari VCS platform it does not have a huge user base but the one it has is super active at around 11k and they have no games in there store
  • The Helper The Helper:
    basically it is linux
  • The Helper The Helper:
    OMG it is BanLord as Blackveiled on the forum
  • The Helper The Helper:
    what is up buddy
  • jonas jonas:
    thanks for the tip, that sounds cool. Never heard about the VCS before but seems like it should be a good match
  • tom_mai78101 tom_mai78101:
    The winter vacation left a toll on me. I missed staying up late and sleeping in late.
  • C Cherry.Grove:
    i haven't looked into it yet
  • C Cherry.Grove:
    If I could use something Python compatible it would save me some learning
  • C Cherry.Grove:
    But Unity might be easiest
  • C Cherry.Grove:
    looking at old posts here makes me happy. Makes me be all like "wow I was pretty smart in 2009"
  • C Cherry.Grove:
    mostly failing at life through adulthood really demotivated me for a while
  • C Cherry.Grove:
    ....what I don't get is why the fuck they would force us to permanently convert to a version of the game everyone fucking hated : \
  • C Cherry.Grove:
    Raid Shadow Legends texture pack smh
  • jonas jonas:
    Most people fail at life throughout their adulthood. Sometimes we get to learn from it. Usually it just feels like crap.
    +1
  • The Helper The Helper:
    What does not kill you makes you stronger is what they say
  • C Cherry.Grove:
    for real! :cool:

    Members online

    No members online now.

    Affiliates

    Hive Workshop NUON Dome
    Top