• 🏆 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] can i have some jass?

Status
Not open for further replies.
Level 5
Joined
Mar 21, 2007
Messages
155
hi.

basicly, i'm trying to make a trigger for a bomb. so that when a unit (my bomb) uses his ability (detonate) then floating text appears on it (the bomb itself is invisible). it starts at 10 and is a little countdown. (e.g 10 (1 sec later) 9 (1 sec later) 8 e.c.t) and when it gets to 0, boom. =D

but i'm troubled. doing this in GUI may require wait triggers and then it could get leaky. but i've been told that JASS scripting uses some sort of variables (local variables??) that are leak free. i have only the faintest knowledge of JASS, never used it before really, never want to ( tried to learn it and uhh, i hate it!) but, i think i have to use it here..... :thumbs_up:

if theres anyone out there who could maybe design a JASS trigger and tell me in idiot proof language how to change the small things (e.g what type of unit is casting the ability. how i edit the damage dealt, and maybe how to change the special effects that go with it :wink:

ty

p.s. there is not only 1 type of unit or "bomb", there are many. i'm a wiz with GUI. and i'm sorry if you think me as a noob who asks for loads and never even says ty.
 
Level 29
Joined
Jul 29, 2007
Messages
5,174
Can it use vJass ? And it will have to use Kattana's Local Handle Vars (or any other such system) for timers, in case you don't want a wait (and thats all the point of this thread lol).

Anyway here are both versions of Jass and vJass.

Im not so sure if they are leak free and if they are written the best because im a total noob with Texttags (floating text) and with vJass lol.

Explenation on how to use them is after the code.

JASS:
//=================================================
//
// Normal Jass using Handlevars
//

function bombingTimer takes nothing returns nothing
    local timer t = GetExpiredTimer()
    local unit bomb = GetHandleUnit(t, "bomb")
    local real x = GetHandleReal(t, "x")
    local real y = GetHandleReal(t, "y")
    local integer time = GetHandleInt(t, "time")
    local texttag text = CreateTextTag()
    call SetTextTagText(text, I2S(time), 50) // setting the text to be worth the time value
    call SetTextTagPos(text, x, y, 50) // setting position of the text
    call ShowTextTagForceBJ(true, text, GetPlayersAll()) // show text to all players
    call SetTextTagVelocityBJ(text, 64, 90 ) // rate,angle the text moves too
    call SetTextTagLifespanBJ(text, 1.00 ) // life span
    set time = time - 1 // setting the time to be less one second each round
    if time == 0 then
        call KillUnit(bomb) // if the time is 0 kill the bomb
        call FlushHandleLocals(t)
        call DestroyTextTag(text)
        call DestroyTimer(t)
    endif
    call SetHandleHandle(t, "bomb", bomb)
    call SetHandleReal(t, "x", x)
    call SetHandleReal(t, "y", y)
    call SetHandleInt(t, "time", time)
    set t = null
    set bomb = null
    set text = null
endfunction
function bombing takes unit bomb, real x, real y, integer time returns nothing
    local timer t = CreateTimer()
    call SetHandleHandle(t, "bomb", bomb)
    call SetHandleReal(t, "x", x)
    call SetHandleReal(t, "y", y)
    call SetHandleInt(t, "time", time)
    call TimerStart(t, 1, true, function bombingTimer)
    set t = null
endfunction



//=================================================
//
//  vJass using Handlevars and structs
//

struct bombstruct
    unit bomb
    real x
    real y
    integer time
endstruct

function bombingTimer takes nothing returns nothing
    local timer t = GetExpiredTimer()
    local bombstruct data = GetHandleInt(t, "data")
    local texttag text = CreateTextTag()
    call SetTextTagText(text, I2S(data.time), 50) // setting the text to be worth the time value
    call SetTextTagPos(text, data.x, data.y, 50) // setting position of the text
    call ShowTextTagForceBJ(true, text, GetPlayersAll()) // show text to all players
    call SetTextTagVelocityBJ(text, 64, 90 ) // rate,angle the text moves too
    call SetTextTagLifespanBJ(text, 1.00 ) // life span
    set data.time = data.time - 1 // setting the time to be less one second each round
    if data.time == 0 then
        call KillUnit(data.bomb) // if the time is 0 kill the bomb
        call FlushHandleLocals(t)
        call DestroyTextTag(text)
        call DestroyTimer(t)
        call data.destroy()
    endif
    call SetHandleInt(t, "data", data)
    set t = null
    set text = null
endfunction
function bombing takes unit bomb, real x, real y, integer time returns nothing
    local timer t = CreateTimer()
    local bombstruct data = bombstruct.create()
    call SetHandleInt(t, "data", data)
    call TimerStart(t, 1, true, function bombingTimer)
    set t = null
endfunction


Do not copy both of them, only one.

To use either of them, type this custom script:

" call bombing(unit,x,y,time) "

Example:
  • Custom script: call bombing(GetTriggerUnit(),10,50,10)

The unit is the bomb, the x is the bomb's x coordinate, the y is the bomb's y coordinate, and the time is the denotation time.

For the unit, x, and y, you will most likely have to use some Jass sentences.
I made it like this so it will be as optimized as it can.
For your case you will need to type something like this:
  • Custom script: call bombing(GetTriggerUnit(),GetUnitX(GetTriggerUnit()),GetUnitY(GetTriggerUnit()),10)

If you want to simplify it, set the bomb to a unit variable and do something like the example below:
  • Set Bomb = Triggering Unit
  • Custom script: call bombing(udg_Bomb, GetUnitX(udg_Bomb), GetUnitY(udg_Bomb), 10)
Notice: always remember to put udg_VariableName when using globals in Jass ! (globals are the normal variables you use with GUI)

Now I didn't create a thing that will damage units, I just killed the bomb.
That is because there is the ability called "AOE Damage Upon Death" located in the Special->Units abilities (any of the first 3 abilities).
You can use that.
Another way would be creating a trigger that will damage all units around a unit of type "bomb" that dies, but I suggest you to just use the ability.


In case you do not have Handlevars, here it is
JASS:
/ ===========================
function H2I takes handle h returns integer
    return h
    return 0
endfunction
// ===========================
function LocalVars takes nothing returns gamecache
    // Replace InitGameCache("jasslocalvars.w3v") with a global variable!!
    return InitGameCache("jasslocalvars.w3v")
endfunction
function SetHandleHandle takes handle subject, string name, handle value returns nothing
    if value==null then
        call FlushStoredInteger(LocalVars(),I2S(H2I(subject)),name)
    else
        call StoreInteger(LocalVars(), I2S(H2I(subject)), name, H2I(value))
    endif
endfunction
function SetHandleInt takes handle subject, string name, integer value returns nothing
    if value==0 then
        call FlushStoredInteger(LocalVars(),I2S(H2I(subject)),name)
    else
        call StoreInteger(LocalVars(), I2S(H2I(subject)), name, value)
    endif
endfunction
function SetHandleBoolean takes handle subject, string name, boolean value returns nothing
    if value==false then
        call FlushStoredBoolean(LocalVars(),I2S(H2I(subject)),name)
    else
        call StoreBoolean(LocalVars(), I2S(H2I(subject)), name, value)
    endif
endfunction
function SetHandleReal takes handle subject, string name, real value returns nothing
    if value==0 then
        call FlushStoredReal(LocalVars(), I2S(H2I(subject)), name)
    else
        call StoreReal(LocalVars(), I2S(H2I(subject)), name, value)
    endif
endfunction
function SetHandleString takes handle subject, string name, string value returns nothing
    if value==null then
        call FlushStoredString(LocalVars(), I2S(H2I(subject)), name)
    else
        call StoreString(LocalVars(), I2S(H2I(subject)), name, value)
    endif
endfunction
function GetHandleHandle takes handle subject, string name returns handle
    return GetStoredInteger(LocalVars(), I2S(H2I(subject)), name)
    return null
endfunction
function GetHandleInt takes handle subject, string name returns integer
    return GetStoredInteger(LocalVars(), I2S(H2I(subject)), name)
endfunction
function GetHandleBoolean takes handle subject, string name returns boolean
    return GetStoredBoolean(LocalVars(), I2S(H2I(subject)), name)
endfunction
function GetHandleReal takes handle subject, string name returns real
    return GetStoredReal(LocalVars(), I2S(H2I(subject)), name)
endfunction
function GetHandleString takes handle subject, string name returns string
    return GetStoredString(LocalVars(), I2S(H2I(subject)), name)
endfunction
function GetHandleUnit takes handle subject, string name returns unit
    return GetStoredInteger(LocalVars(), I2S(H2I(subject)), name)
    return null
endfunction
function GetHandleTimer takes handle subject, string name returns timer
    return GetStoredInteger(LocalVars(), I2S(H2I(subject)), name)
    return null
endfunction
function GetHandleTrigger takes handle subject, string name returns trigger
    return GetStoredInteger(LocalVars(), I2S(H2I(subject)), name)
    return null
endfunction
function GetHandleEffect takes handle subject, string name returns effect
    return GetStoredInteger(LocalVars(), I2S(H2I(subject)), name)
    return null
endfunction
function GetHandleGroup takes handle subject, string name returns group
    return GetStoredInteger(LocalVars(), I2S(H2I(subject)), name)
    return null
endfunction
function GetHandleLightning takes handle subject, string name returns lightning
    return GetStoredInteger(LocalVars(), I2S(H2I(subject)), name)
    return null
endfunction
function GetHandleWidget takes handle subject, string name returns widget
    return GetStoredInteger(LocalVars(), I2S(H2I(subject)), name)
    return null
endfunction
function FlushHandleLocals takes handle subject returns nothing
    call FlushStoredMission(LocalVars(), I2S(H2I(subject)) )
endfunction


Copy either of the codes + Handlevars into your MAP HEADER.
The map header is that scroll in the Trigger Editor that has your map's name on it (its on top of your first trigger).
Also, make sure the bomb code is AFTER the Handlevars code.

Hope this helps you.
 
Level 5
Joined
Sep 13, 2007
Messages
33
If you ask me the best thing to do would be to use a loop rather than a timer.

JASS:
function bomb takes nothing return nothing
local real time = 10
local texttag text
loop
    set time = time - 1
    <destroy text and create a new texttag use R2S(time)>
    if time == 0 then
        <make unit explode>
        exitwhen true
    endif
endloop
 
Level 5
Joined
Mar 21, 2007
Messages
155
ok i thank both of you very much (+rep) for your ideas. i'm sorry rheias but ill use ghost wolf's system due to hes explained everything (including how to change stuff). just 4 things.

1: u said v jass and jass. i know your only trying to help but please tell me which is the easiest most simplest one to use.

2: whats handlevars?

3: at the start of handlevars, what kind of variable should i use?

4: and i am sorry but i'm not exactly sure how u want me to do the
"to use either of them, type this custom script" (sorry, but i am a total noob when it comes to jass related anything)

note: this post is before i tried anything. sorry buit if theres something amiss or not working i will re-post. tyvm again =D
 
Last edited:
Level 29
Joined
Jul 29, 2007
Messages
5,174
If you ask me the best thing to do would be to use a loop rather than a timer.

JASS:
function bomb takes nothing return nothing
local real time = 10
local texttag text
loop
    set time = time - 1
    <destroy text and create a new texttag use R2S(time)>
    if time == 0 then
        <make unit explode>
        exitwhen true
    endif
endloop

First of all whats that "exitwhen true", when whats true ? (maybe it is allowed, im not sure and I never saw such thing).
And second thing, this will run in less then a second since there are no waits here.

1: u said v jass and jass. i know your only trying to help but please tell me which is the easiest most simplest one to use.

For you they are exacly the same if you are talking on how to make them work. Both of them use exacly the same script.
The vJass is more suggested as it is faster and easier (for the computer) to run it.
If you have Jass New Gen Pack (JNGP) I suggest you to use the vJass version.
If you don't have it, use the normal Jass or get JNGP (JNGP pwnz normal WE even if you do not use Jass).

2: whats handlevars?

It is a system that lets you to move local variables from function to function which is normally not allowed, because local variables are after all locals which mean they can only be used in their function.
There are other systems that do this too but I use Handlevars (the full name is Handle Local Variabels and it was created by Kattana from wc3c).

3: at the start of handlevars, what kind of variable should i use?

Didn't get the question.

4: and i am sorry but i'm not exactly sure how u want me to do the
"to use either of them, type this custom script" (sorry, but i am a total noob when it comes to jass related anything)

A custom script is an action in GUI that allows you to type a line of Jass inside your GUI triggers.
The Custom Script action is located at the third place (after Do Nothing and Comment).


If you need more explenations feel free to ask.
 
Level 5
Joined
Sep 13, 2007
Messages
33
> First of all whats that "exitwhen true", when whats true ?

exitwhen true immediatly stops a loop and exits it. It is much like return only it stops the loop only, not the whole function.

> And second thing, this will run in less then a second since there are no waits here.

Do excuse me, I forgot to place them. Obviously they should have been placed in the end of the loop like so:

JASS:
function bomb takes nothing return nothing
    local real time = 10
    local texttag text
    loop
        set time = time - 1
        <destroy texttag and create a new texttag use R2S(time)>
        if time == 0 then
            <make unit explode>
            exitwhen true
        endif
        call TriggerSleepAction(1.)
    endloop
endfunction

> The vJass is more suggested as it is faster and easier (for the computer) to run it.

It is also easier for the user if I may add. Structs are by far more comfortable than handlevars or the like. textmacros can save you quite some time and make your script look cleaner. And more, of course.

> There are other systems that do this too but I use Handlevars

Please note that this system is quite dangerous as it uses I2H prefix which may cause corruption. I would suggest going with structs, however, if you don't want to use structs at least use CS_Cache.

> i'm sorry rheias but ill use ghost wolf's system due to hes explained everything

No problem. :) I would have gone into further detail if I knew exactly what you want. I gave you in some places specific orders while in others only guides as I don't know what exactly you want to happen.
 
Level 5
Joined
Mar 21, 2007
Messages
155
i thank you both for trying to help me so much ;) but there are still some things i need help with:


>what kind of variables should i use?

Didn't get the question.

i mean, in my map, i have lots of variables (global variables).

at the start of the handlevars code, it says at the top:

// Replace InitGameCache("jasslocalvars.w3v") with a global variable!!
return InitGameCache("jasslocalvars.w3v")

what global variable should i use? should i make a new one?

> about custom script

A custom script is an action in GUI that allows you to type a line of Jass inside your GUI triggers.
The Custom Script action is located at the third place (after Do Nothing and Comment).

i know what a custom script is.... (i'm a wiz with GUI). sorry if i didn't word it right. i was asking about where or how i should introduce the custom script. e.g

  • test
    • Events
      • Unit - A unit Begins casting an ability
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to (my type of bomb)
    • Actions
      • Custom script: call bombing(GetTriggerUnit(),GetUnitX(GetTriggerUnit()),GetUnitY(GetTriggerUnit()),10)
like that????

ty
 
Level 5
Joined
Mar 21, 2007
Messages
155
sorry to be a bugger... but i just typed in the vJass into my map header, below handlevars. and i tried to save my map but it came up with errors. i have no idea what they mean but theres 445 errors and it points 2050 times to lines. =S. this is how its like in my map. what did i do wrong??

ty

JASS:
endfunction 
function FlushHandleLocals takes handle subject returns nothing
  call FlushStoredMission(LocalVars(), I2S(H2I(subject)) ) 
endfunction
// ===========================
struct bombstruct
  unit bomb
  real x
  real y
  integer time  
endstruct
function bombingTimer takes nothing returns nothing
  local timer t = GetExpiredTimer()
  local bombstruct data = GetHandleInt(t, "data")
  local texttag text = CreateTextTag()
  call SetTextTagText(text, I2S(data.time), 50) // setting the text to be worth the time value
  call SetTextTagPos(text, data.x, data.y, 50) // setting position of the text
  call ShowTextTagForceBJ(true, text, GetPlayersAll()) // show text to all players
  call SetTextTagVelocityBJ(text, 64, 90 ) // rate,angle the text moves too
  call SetTextTagLifespanBJ(text, 1.00 ) // life span
  set data.time = data.time - 1 // setting the time to be less one second each round
  if data.time == 0 then
      call KillUnit(data.bomb) // if the time is 0 kill the bomb
      call FlushHandleLocals(t)
      call DestroyTextTag(text)
      call DestroyTimer(t)
      call data.destroy()
  endif
  call SetHandleInt(t, "data", data)
  set t = null
  set text = null 
endfunction 
function bombing takes unit bomb, real x, real y, integer time returns nothing
  local timer t = CreateTimer()
  local bombstruct data = bombstruct.create()
  call SetHandleInt(t, "data", data)
  call TimerStart(t, 1, true, function bombingTimer)
  set t = null 
endfunction

p.s, it worked fine with just handlevars.
 
Level 5
Joined
Mar 21, 2007
Messages
155
uhhhhh.... ok you've confused me...
Copy either of the codes + Handlevars into your MAP HEADER.

and whats a newgen???

EDIT: ok i copied the normal jass and it seems to like it. nvm about vjass. i'd rather the computer do some extra number crunching than to super confuse me =S.

EDIT: just tested. it all almost works... almost....

after i activate my "detonate ability" it dose eventually die. but no floating test is shown....

EDIT: and sorry, but out of desperation to get this working, i tried Rheias one. it dosen't like it, it found about 1000 errors when i put it in. =S
 
Last edited:
Level 5
Joined
Aug 16, 2007
Messages
149
JassNewGenPack

newgen is JassNewGenPack. It's basically an alternate WE, but with lots of things to help JASSers. You can download it here. Note it requires 7Zip to open, which you can download here. The reason you get errors is because you need vJass (comes with newgen) for it to compile properly.
 
Level 5
Joined
Mar 21, 2007
Messages
155
ok. nevermind then. screw vjass =). what about the other one, that seems to work. well almost. it kills the bomb after 10 secs, but no floating text is shown.

can something about that be done?? or dose ghosts scripting look like it should work and maybe i've copied it wrong??
 
Level 5
Joined
Aug 16, 2007
Messages
149
try this:
JASS:
function bombingTimer takes nothing returns nothing
    local timer t = GetExpiredTimer()
    local unit bomb = GetHandleUnit(t, "bomb")
    local real x = GetHandleReal(t, "x")
    local real y = GetHandleReal(t, "y")
    local integer time = GetHandleInt(t, "time")
    local texttag text = CreateTextTag()
    call SetTextTagText(text, I2S(time), 50) // setting the text to be worth the time value
    call SetTextTagPos(text, x, y, 50) // setting position of the text
    call ShowTextTagForceBJ(true, text, GetPlayersAll()) // show text to all players
    call SetTextTagVelocityBJ(text, 64, 90 ) // rate,angle the text moves too
    call SetTextTagLifespanBJ(text, 1.00 ) // life span
    call SetTextTagVisibilty(text,true)//VISIBILITY: THIS IS IMPORTANT!!!
    set time = time - 1 // setting the time to be less one second each round
    if time == 0 then
        call KillUnit(bomb) // if the time is 0 kill the bomb
        call FlushHandleLocals(t)
        call DestroyTextTag(text)
        call DestroyTimer(t)
    endif
    call SetHandleHandle(t, "bomb", bomb)
    call SetHandleReal(t, "x", x)
    call SetHandleReal(t, "y", y)
    call SetHandleInt(t, "time", time)
    set t = null
    set bomb = null
    set text = null
endfunction
function bombing takes unit bomb, real x, real y, integer time returns nothing
    local timer t = CreateTimer()
    call SetHandleHandle(t, "bomb", bomb)
    call SetHandleReal(t, "x", x)
    call SetHandleReal(t, "y", y)
    call SetHandleInt(t, "time", time)
    call TimerStart(t, 1, true, function bombingTimer)
    set t = null
endfunction
 
Level 5
Joined
Mar 21, 2007
Messages
155
thank you bubba. (+rep)

just a small problem that i know (and hope to hell) you can fix in a snap of a finger =D.

call SetTextTagVisibilty(text,true)//VISIBILITY: THIS IS IMPORTANT!!!


the error script points to this line and says "expected a function name"
 
Level 5
Joined
Aug 16, 2007
Messages
149
oh ye spelling mistake in the function name lol. Use this:
JASS:
call SetTextTagVisibility(text,true)
 
Level 5
Joined
Mar 21, 2007
Messages
155
ok yes, it will save now. thank you very much =D.

i'm really sorry to continue to be a bother, but. i have different bombs. i was planning on some of them to have diffrent countdown's (lengths). can you show be some sort of basic if,then,else function in jass and where i should enter my bomb type and the set countdown starter?

sorry. if this requires a new trigger altogether then just ignore me and ill live, i guess.
 
Level 5
Joined
Aug 16, 2007
Messages
149
no it's really simple! For the time parameter, just enter a number depending on how long you want the countdown to last! You'd just do
JASS:
if myUnit ==  unitA then
     call bombing(myUnit,GetUnitX(myUnit),GetUnitY(myUnit),timeA)
 elseif myUnit == unitB then
     call bombing(myUnit,GetUnitX(myUnit),GetUnitY(myUnit),timeB)
 //more elseifs if necessary
 endif
so if my unit is unit a, call bombing on my unit , x of my unit, y of my unit, time a.
else if my unit is unit b, call bombing on my unit , x of my unit, y of my unit, time b.

Hope that makes sense!

EDIT:
omg I just realised an easy way of making the spell better still, by just adding another line! Reveal below to see the function that also makes a unit explode!
JASS:
function bombingTimer takes nothing returns  nothing
     local timer t = GetExpiredTimer()
     local unit bomb = GetHandleUnit(t, "bomb")
     local real x = GetHandleReal(t, "x")
     local real y = GetHandleReal(t, "y")
     local integer time = GetHandleInt(t, "time")
     local texttag text = CreateTextTag()
     call SetTextTagText(text, I2S(time), 50) // setting the text to be worth  the time value
     call SetTextTagPos(text, x, y, 50) // setting position of the text
     call ShowTextTagForceBJ(true, text, GetPlayersAll()) // show text to all  players
     call SetTextTagVelocityBJ(text, 64, 90 ) // rate,angle the text moves  too
     call SetTextTagLifespanBJ(text, 1.00 ) // life span
     call SetTextTagVisibilty(text,true)//VISIBILITY: THIS IS IMPORTANT!!!
     set time = time - 1 // setting the time to be less one second each  round
     if time == 0 then
         call SetUnitExploded(bomb, true)
         call KillUnit(bomb) // if the time is 0 kill the bomb
         call FlushHandleLocals(t)
         call DestroyTextTag(text)
         call DestroyTimer(t)
     endif
     call SetHandleHandle(t, "bomb", bomb)
     call SetHandleReal(t, "x", x)
     call SetHandleReal(t, "y", y)
     call SetHandleInt(t, "time", time)
     set t = null
     set bomb = null
     set text = null
 endfunction
 function bombing takes unit bomb, real x, real y, integer time returns  nothing
     local timer t = CreateTimer()
     call SetHandleHandle(t, "bomb", bomb)
     call SetHandleReal(t, "x", x)
     call SetHandleReal(t, "y", y)
     call SetHandleInt(t, "time", time)
     call TimerStart(t, 1, true, function bombingTimer)
     set t = null
 endfunction
 
Last edited:
Level 5
Joined
Mar 21, 2007
Messages
155
ok umm, sorry to be a pain, but its still not showing the floating numbers. did i mistype anything??

JASS:
function bombingTimer takes nothing returns nothing
  local timer t = GetExpiredTimer()
  local unit bomb = GetHandleUnit(t, "bomb")
  local real x = GetHandleReal(t, "x")
  local real y = GetHandleReal(t, "y")
  local integer time = GetHandleInt(t, "time")
  local texttag text = CreateTextTag()
  call SetTextTagText(text, I2S(time), 50) // setting the text to be worth the time value
  call SetTextTagPos(text, x, y, 50) // setting position of the text
  call ShowTextTagForceBJ(true, text, GetPlayersAll()) // show text to all players
  call SetTextTagVelocityBJ(text, 64, 90 ) // rate,angle the text moves too
  call SetTextTagLifespanBJ(text, 1.00 ) // life span
  call SetTextTagVisibility(text,true)
  set time = time - 1 // setting the time to be less one second each round
  if time == 0 then
      call KillUnit(bomb) // if the time is 0 kill the bomb
      call FlushHandleLocals(t)
      call DestroyTextTag(text)
      call DestroyTimer(t)
  endif
  call SetHandleHandle(t, "bomb", bomb)
  call SetHandleReal(t, "x", x)
  call SetHandleReal(t, "y", y)
  call SetHandleInt(t, "time", time)
  set t = null
  set bomb = null
  set text = null 
endfunction 
function bombing takes unit bomb, real x, real y, integer time returns nothing
  local timer t = CreateTimer()
  call SetHandleHandle(t, "bomb", bomb)
  call SetHandleReal(t, "x", x)
  call SetHandleReal(t, "y", y)
  call SetHandleInt(t, "time", time)
  call TimerStart(t, 1, true, function bombingTimer)
  set t = null 
endfunction

this is my custom function (what i use to dedicate the time)

  • test
    • Events
      • Unit - A unit Begins casting an ability
    • Conditions
      • (Ability being cast) Equal to Detonate
    • Actions
      • Wait 0.03 seconds
      • Unit - Pause (Triggering unit)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of (Triggering unit)) Equal to Crude Bomb
        • Then - Actions
          • Custom script: call bombing(GetTriggerUnit(),GetUnitX(GetTriggerUnit()),GetUnitY(GetTriggerUnit()),5)
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Unit-type of (Triggering unit)) Equal to Explosive warhead
            • Then - Actions
              • Custom script: call bombing(GetTriggerUnit(),GetUnitX(GetTriggerUnit()),GetUnitY(GetTriggerUnit()),20)
            • Else - Actions
what did i do wrong lol

ty
 
Level 5
Joined
Aug 16, 2007
Messages
149
JASS:
function bombingTimer takes nothing returns nothing
  local timer t = GetExpiredTimer()
  local unit bomb = GetHandleUnit(t, "bomb")
  local real x = GetHandleReal(t, "x")
  local real y = GetHandleReal(t, "y")
  local integer time = GetHandleInt(t, "time")
  local texttag text = CreateTextTag()
  call SetTextTagText(text, I2S(time), 50) // setting the text to be worth the time value
  call SetTextTagPos(text, x, y, 50) // setting position of the text
  call SetTextTagVisibility(text,true)
  set time = time - 1 // setting the time to be less one second each round
  if time == 0 then
      call KillUnit(bomb) // if the time is 0 kill the bomb
      call FlushHandleLocals(t)
      call DestroyTextTag(text)
      call DestroyTimer(t)
  endif
  call SetHandleHandle(t, "bomb", bomb)
  call SetHandleReal(t, "x", x)
  call SetHandleReal(t, "y", y)
  call SetHandleInt(t, "time", time)
  set t = null
  set bomb = null
  set text = null
endfunction
function bombing takes unit bomb, real x, real y, integer time returns nothing
  local timer t = CreateTimer()
  call SetHandleHandle(t, "bomb", bomb)
  call SetHandleReal(t, "x", x)
  call SetHandleReal(t, "y", y)
  call SetHandleInt(t, "time", time)
  call TimerStart(t, 1, true, function bombingTimer)
  set t = null
endfunction
maybe this?
 
Status
Not open for further replies.
Top