Google results consist of a post on bnet forums where vexorian also asks this. wc3sear.ch results 0. Is it possible with JASS script to change a unit's Model attribute mid-game?
i.e. have a footman walk onto a pad and he looks like a knight, but other than appearence hes still the same footman.
If not, is it possible to use the "Something comes within -range- of -unit-" event with a newely-created-mid-game unit, despite having to select a pre-placed-existing unit in the WorldEdit GUI.
Actually it looks like this " "Something comes within -range- of -unit-" event" does not work at all.
But it may be possible by using the "Something enters the region -region-" event.
I will try to solve your problem, but please first describe, where exactly the unit shall "transform". Is it a static place? A moving location? A jumping one? Maybe the surroundings of another unit?
And shall extra stuff occur? Maybe the selection of the "transforming" unit jumping from the removed to the newly created one?
Thankyou for the responce, it has been confirmed that: changing a units model property mid-game is not possible. Moving on..
metamorphosis is not an option.
using regions is not an option, because while they can technically move, to all intense purposes they effectively cant, its basically a trigger which shouldnt be in the world edit because its not possible with the war3 game engine.
the matter at hand now, is the (comes within -range- of -unit-) event.
LordZsar1 i can confirm that the event works because my dodgeball map's dodge detection has been using it successfully for 5 patches.
However what does NOT work, due to being denied by the World Edit GUI, is to have the -unit- equal to any old unit. The unit MUST be a pre-existing pre-placed on-map-initialisation unit somewhere on the map.
More specifically, dodgeball maps give players the freedom to choose their heros (from 6 options) at the start. Multiple players can have the same hero. Thus when a player chooses his hero, a new hero is made for them. Players do not play with pre-placed pre-existing units.
This problem is about providing an event to proc when a ball comes within a certain range of any of the heros. Its not possible by constantly centering a region on each player, because as ive just said regions CANNOT be moved (it doesn't work). Its not possible using the World Edit within -range- event because the players heros cannot be used as the -unit- of the event, because they didnt exist on map loading.
What i seek, specifically, is whether JASS has the power to use a newly created unit as the -unit- of that event; because the world edit does not.
There is no other way to go about what i seek, the map is already operational but using a laggy work-around. Using the within -range- event with the players newely created units as the -unit-, is the ONLY way to further this map function.
In most likelyhood there really isnt anything else to be done, this is just a hopeful post ^_^
would add the event "a unit comes in 150 range of hero[a]" to the trigger "ballhits". You can add this in a "Custom Script" line in a GUI trigger. You just should add a condition to "ballhits" which is: Unit Type Comparison - Unit Type of (Triggering Unit) equal to (Ball Unit Type)
What i seek, specifically, is whether JASS has the power to use a newly created unit as the -unit- of that event; because the world edit does not.
It does, I have that in my map. But I don't know the details of yours, so ... Hmm... So, let's see: Try this
local trigger OK = CreateTrigger()
local unit created
set created = CreateUnit(Player(0),'H000',1,1,1)//or whatever...
call TriggerRegisterUnitInRangeSimple(OK,200.00,created)
call TriggerAddAction(OK,function do_as_you_wish)
call SetHandleHandle(OK,"Created",created)
Now that you have this function do_as_you_wish, you can get the unit who was approached, not the approacher!
function do_as_you_wish takes nothing returns nothing
local unit created = GetHandleUnit(GetTriggeringTrigger(),"Created")
//etc..
Of course, you would need the following in your header!
function H2I takes handle h returns integer
return h
return 0
endfunction
function game_cache takes nothing returns gamecache
if (udg_gamecache==null) then
call FlushGameCache(InitGameCache("haxs,w3v"))
set udg_gamecache=InitGameCache("haxs.w3v")
endif
return udg_gamecache
endfunction
function SetHandleHandle takes handle subject, string name, handle value returns nothing
if value==null then
call FlushStoredInteger(game_cache(),I2S(H2I(subject)),name)
else
call StoreInteger(game_cache(), I2S(H2I(subject)), name, H2I(value))
endif
endfunction
function GetHandleUnit takes handle subject, string name returns unit
return GetStoredInteger(game_cache(), I2S(H2I(subject)), name)
return null
endfunction
You're looking for an javascript eval() statement. Since strings can be manipulated by people playing a map, allowing trigger names to be stored in strings could be used to allow the user to dynamically pick triggers. Rather dangerous, if you ask me.
Try using a global trigger var. It can point to any trigger that you tell it to.