• 🏆 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] JASS help - Variable "transfer"

Status
Not open for further replies.
Level 10
Joined
Dec 13, 2008
Messages
222
I have a question that will maybe be simple to experienced mappers. It is about JASS functions. Can someone tell me how can I "transfer" local variables from one function to another, WITHOUT using vJass?

Example

JASS:
function bb takes ??? returns nothing
i want to transfer unit u, integer i and real r variables here
...
endfunction

function aa takes nothing returns nothing
local unit u
local real r
local integer i
local timer t = CreateTimer()

set u = MyUnit
set r = MyReal
set i = MyInt

call TimerStart(t, 0.04, true, function bb)

I hope someone can help me. :)
 
Level 16
Joined
Jun 9, 2008
Messages
734
erm you need global variables, or you can use gamecache (Handle Variables coded by KaTTaNa)

JASS:
//with global variables
//WARNING: THIS IS NOT MULTI-INSTANCEABLE!

function bb takes nothing returns nothing
local unit u=udg_MyUnit
local integer i=udg_MyInt
local real r=udg_MyReal
...
...

set u=null
endfunction

function aa takes nothing returns nothing
local timer t = CreateTimer()

set udg_MyUnit= GetSpellAbilityUnit()//or whatever
set udg_MyReal= 1.0//or whatever
set udg_MyInt=1//or whatever
call TimerStart(t, 0.04, true, function bb)

set t=null
endfunction
 
Status
Not open for further replies.
Top