• 🏆 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!

[JASS] getting started with JASS / vJASS / JNGP

Status
Not open for further replies.
Level 6
Joined
Sep 9, 2006
Messages
92
what do i download for JNGP? i have a version from a while ago i downloaded and noticed the syntax coloring in the trigger editor didnt highlight SaveInteger (used as "call SaveInteger(..."). Also, i tried finding the newest JassHelper, which the newest i found was 0.A.2.B, but the exe file does not start, with the error being it can't find "bin\SFmpq.dll". Can someone please help me out? i just want the newest JNGP and to be able to start out JASS / vJASS / etc...
 
Level 6
Joined
Sep 9, 2006
Messages
92
rofl.... ok!! Doesn't mean to laugh at you.

you don't open jasshelper, everything already embedded inside the JNGP.

All you got to is open JNGP, go to trigger, convert the trigger to custom text and then start scripting in JASS.

well i know its integrated however i remember a while ago having one that was separate from the world editor; just got integrated after a few other versions?
 
Level 6
Joined
Sep 9, 2006
Messages
92
my JNGP is 5d and i have jasshelper (unlabled version) and then i have 0.A.2.B; in the a2b version the exe is in a different location than in the unlabled version so im not wanting to simply change the folder name because im afraid ill get an error. also, on a somewhat related topic, what does it mean if i get an LUA error "wehack.lua:437: attempt to index global 'rtc_enabled; (a nil value)"?

(heres code if you would like to check it; and credits to The_Witcher, im using his Electrifying Smash spell to help me build this)
JASS:
scope Rend initializer Init

globals
    //ability id of Rend
    private constant integer ABILITY_ID = 'A005'
    //refresh rate of timer
    private constant real INTERVAL = 0.01
    //total ticks of spell
    private constant integer TICKS = 9
    //number of "INTERVAL"s between ticks
    private constant integer TIME = 100
    //damage attack type
    private constant attacktype ATTACK_TYPE = ATTACK_TYPE_NORMAL
    //damage damage type
    private constant damagetype DAMAGE_TYPE = DAMAGE_TYPE_NORMAL
    //damage weapon type
    private constant weapontype WEAPON_TYPE = WEAPON_TYPE_WHOKNOWS
    //blood effect when dealing damage
    private constant string BLOOD_EFFECT = "Objects\\Spawnmodels\\Critters\\Albatross\\CritterBloodAlbatross.mdl"
    //attach point
    private constant string EFFECT_ATTACH = "chest"
    
    
    private hashtable h = InitHashtable()
endglobals

private function Damage takes integer level, integer agi, integer str returns real
    return I2R(level) * ( I2R(agi) + 3.00 * (I2R(str)) ) / 5.00
endfunction

private struct data
    unit c
    unit t
    timer tim = CreateTimer()
    integer lvl
    integer ticks = TICKS
    integer time = TIME
    integer agi
    integer str
endstruct

private function periodic takes nothing returns nothing
    local data dat = LoadInteger(h,GetHandleId(GetExpiredTimer()),0)
    if dat.time >= 0 then
        set dat.time = dat.time - 1
    else
        if dat.ticks > 0 then
            set dat.ticks = dat.ticks - 1
            call UnitDamageTarget(dat.c, dat.t, Damage(dat.lvl, dat.agi, dat.str), true, false, ATTACK_TYPE, DAMAGE_TYPE, WEAPON_TYPE)
            call DestroyEffect(AddSpecialEffectTarget(BLOOD_EFFECT, dat.t, EFFECT_ATTACH))
            if dat.ticks > 0 then
                set dat.time = TIME
            else
                call PauseTimer(dat.tim)
                call DestroyTimer(dat.tim)
                call FlushChildHashtable(h,GetHandleId(dat.tim))
                call dat.destroy()
            endif
        endif
    endif
endfunction

private function Conditions takes nothing returns boolean
    local data dat
    if GetSpellAbilityId() == ABILITY_ID then
        set dat = data.create()
        set dat.t = GetSpellTargetUnit()
        set dat.c = GetTriggerUnit()
        set dat.lvl = GetUnitAbilityLevel(dat.c, ABILITY_ID)
        set dat.agi = GetHeroAgi(dat.c, true)
        set dat.str = GetHeroStr(dat.c, true)
        call SaveInteger(h,GetHandleId(dat.tim),0,dat)
        call TimerStart(dat.tim,INTERVAL,true,function periodic)
    endif
    return false
endfunction

//===========================================================================
private function Init takes nothing returns nothing
    local trigger t = CreateTrigger()
    call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( t, Condition( function Conditions ) )
    call Preload(BLOOD_EFFECT)
    set t = null
endfunction

endscope
ps if you find any places where my code can be improved dont be afraid to tell :p
 
Level 6
Joined
Sep 9, 2006
Messages
92
i cant test it; there is no syntax problem; i get an error message when trying to test the map, that being:
---------------------------
Lua Error
---------------------------
wehack.lua:437: attempt to index global 'rtc_enabled' (a nil value)
---------------------------
OK
---------------------------


WC3 doesn't launch, nor do progress bars pop up for saving the map to prepare it for loading in wc3; right when i click the test map button the error pops up.

also just as a side note: i'm heading to bed now and won't respond until at least 8 hours from now (stupid school..)
 
Status
Not open for further replies.
Top