can you change the trigger from jass to GUI or MUI

ijal razi

New Member
Reaction score
2
function H2I takes handle h returns integer
return h
return 0
endfunction

function GetTrue takes nothing returns boolean
return true
endfunction

constant function Dummy_Ability_Rawcode takes nothing returns integer
return 'A004' //CHANGE THIS - Abilities given to Dummies that aren't supposed to be hit by Spells
endfunction

constant function Dummy_Unit_Rawcode takes nothing returns integer
return 'h000' //CHANGE THIS
endfunction

constant function Dummy_Visibility_Rawcode takes nothing returns integer
return 'h001' //CHANGE THIS
endfunction

function Wait takes real duration returns nothing
local timer waitTimer
local real timeRemaining

if (duration > 0.00) then
set waitTimer = CreateTimer ()
call TimerStart (waitTimer,duration,false,null)
loop
set timeRemaining = TimerGetRemaining (waitTimer)
exitwhen timeRemaining <= 0.00

if (timeRemaining > 0.271828) then
call TriggerSleepAction (timeRemaining / 10.00)
else
call TriggerSleepAction (0.10)
endif
endloop
call PauseTimer (waitTimer)
call DestroyTimer (waitTimer)
endif
set waitTimer = null
endfunction

//########################################################################################
//## Handle Variables //##
//## By KaTTaNa //##
//## Requires the Global Game Cache Variable "HandleVars" (udg_HandleVars) //##
//########################################################################################

function HV_H2I takes handle h returns integer
return h
return 0
endfunction

function LocalVars takes nothing returns gamecache
if udg_HandleVars == null then
call FlushGameCache (udg_HandleVars)
set udg_HandleVars = InitGameCache ("jasslocalvars")
endif
return udg_HandleVars
endfunction

function SetHandleHandle takes handle subject, string name, handle value returns nothing
if value == null then
call FlushStoredInteger (LocalVars(),I2S(HV_H2I(subject)),name)
else
call StoreInteger (LocalVars(),I2S(HV_H2I(subject)),name,HV_H2I(value))
endif
endfunction

function SetHandleInt takes handle subject, string name, integer value returns nothing
if value == null or value == 0 then
call FlushStoredInteger (LocalVars(),I2S(HV_H2I(subject)),name)
else
call StoreInteger (LocalVars(),I2S(HV_H2I(subject)),name,value)
endif
endfunction

function SetHandleBoolean takes handle subject, string name, boolean value returns nothing
if value == null or value == false then
call FlushStoredBoolean (LocalVars(),I2S(HV_H2I(subject)),name)
else
call StoreBoolean (LocalVars(),I2S(HV_H2I(subject)),name,value)
endif
endfunction

function SetHandleReal takes handle subject, string name, real value returns nothing
if value == null or value == 0.00 then
call FlushStoredReal (LocalVars(),I2S(HV_H2I(subject)),name)
else
call StoreReal (LocalVars(),I2S(HV_H2I(subject)),name,value)
endif
endfunction

function SetHandleString takes handle subject, string name, string value returns nothing
if value == null or value == "" then
call FlushStoredString (LocalVars(),I2S(HV_H2I(subject)),name)
else
call StoreString (LocalVars(),I2S(HV_H2I(subject)),name,value)
endif
endfunction

function GetHandleHandle takes handle subject, string name returns handle
return GetStoredInteger (LocalVars(),I2S(HV_H2I(subject)),name)
return null
endfunction

function GetHandleInt takes handle subject, string name returns integer
return GetStoredInteger (LocalVars(),I2S(HV_H2I(subject)),name)
endfunction

function GetHandleBoolean takes handle subject, string name returns boolean
return GetStoredBoolean (LocalVars(),I2S(HV_H2I(subject)),name)
endfunction

function GetHandleReal takes handle subject, string name returns real
return GetStoredReal (LocalVars(),I2S(HV_H2I(subject)),name)
endfunction

function GetHandleString takes handle subject, string name returns string
return GetStoredString (LocalVars(),I2S(HV_H2I(subject)),name)
endfunction

function GetHandleUnit takes handle subject, string name returns unit
return GetStoredInteger (LocalVars(),I2S(HV_H2I(subject)),name)
return null
endfunction

function GetHandleTimer takes handle subject, string name returns timer
return GetStoredInteger (LocalVars(),I2S(HV_H2I(subject)),name)
return null
endfunction

function GetHandleTrigger takes handle subject, string name returns trigger
return GetStoredInteger (LocalVars(),I2S(HV_H2I(subject)),name)
return null
endfunction

function GetHandleEffect takes handle subject, string name returns effect
return GetStoredInteger (LocalVars(),I2S(HV_H2I(subject)),name)
return null
endfunction

function GetHandleGroup takes handle subject, string name returns group
return GetStoredInteger (LocalVars(),I2S(HV_H2I(subject)),name)
return null
endfunction

function GetHandleLightning takes handle subject, string name returns lightning
return GetStoredInteger (LocalVars(),I2S(HV_H2I(subject)),name)
return null
endfunction

function GetHandleWidget takes handle subject, string name returns widget
return GetStoredInteger (LocalVars(),I2S(HV_H2I(subject)),name)
return null
endfunction

function FlushHandleLocals takes handle subject returns nothing
call FlushStoredMission (LocalVars(),I2S(HV_H2I(subject)))
endfunction

//##########################################################################################

this in map header
this main trigger
//*****************************************************************************************
//*****************************************************************************************
//** //**
//** Name : Dragons' Horde //**
//** Author : --Thanatos-- //**
//** //**
//*****************************************************************************************
//*****************************************************************************************
//** //**
//** Credits: KaTTaNa's Handle Vars //**
//** //**
//*****************************************************************************************
//*****************************************************************************************

//#########################################################################################
//#####################################configurations######################################
//## //##
constant function Dragons_Horde_Rawcode takes nothing returns integer //##
return 'A006' //##
endfunction //##
//## //##
constant function Dragons_Horde_LimitRawcode takes nothing returns integer //##
return 'A001' //##
endfunction //##
//## //##
constant function Dragons_Horde_BreathRawcode takes nothing returns integer //##
return 'A007' //##
endfunction //##
//## //##
constant function Dragons_Horde_DragonRawcode takes nothing returns integer //##
return 'h004' //##
endfunction //##
//## //##
constant function Dragons_Horde_Radius takes nothing returns real //##
return 700. //##
endfunction //##
//## //##
constant function Dragons_Horde_DragonSpeed takes nothing returns real //##
return 500. //##
endfunction //##
//## //##
constant function Dragons_Horde_DragonSpeedDist takes nothing returns real //##
return 150. //##
endfunction //##
//## //##
constant function Dragons_Horde_DragonRadius takes nothing returns real //##
return 200. //##
endfunction //##
//## //##
constant function Dragons_Horde_DragonRadiusDist takes nothing returns real //##
return 100. //##
endfunction //##
//## //##
constant function Dragons_Horde_DragonRadiusSpeed takes nothing returns real //##
return 20. //##
endfunction //##
//## //##
constant function Dragons_Horde_DragonRadiusSpeedDist takes nothing returns real //##
return 5. //##
endfunction //##
//## //##
constant function Dragons_Horde_TimerPeriod takes nothing returns real //##
return .04 //##
endfunction //##
//## //##
constant function Dragons_Horde_RegistryPeriod takes nothing returns real //##
return 2. //##
endfunction //##
//## //##
constant function Dragons_Horde_MaxDragons takes nothing returns integer //##
return 3 //##
endfunction //##
//## //##
constant function Dragons_Horde_DamagePoint takes nothing returns real //##
return .75 //##
endfunction //##
//## //##
constant function Dragons_Horde_Dragons takes integer level returns integer //##
if level == 0 then //##
return 0 //##
elseif level == 1 then //##
return 2 //##
elseif level == 2 then //##
return 2 //##
elseif level == 3 then //##
return 3 //##
elseif level == 4 then //##
return 3 //##
else //##
return level / 2 + 1 //##
endif //##
endfunction //##
//## //##
constant function Dragons_Horde_Cooldown takes integer level returns real //##
if level == 1 then //##
return 1.5 //##
elseif level == 2 then //##
return 1.5 //##
elseif level == 3 then //##
return 1.5 //##
elseif level == 4 then //##
return 1.5 //##
else //##
return 1.5 //##
endif //##
endfunction //##
//## //##
constant function Dragons_Horde_BirthEffect takes nothing returns string //##
return "Abilities\\Spells\\NightElf\\Blink\\BlinkCaster.mdl" //##
endfunction //##
//## //##
//#########################################################################################
//#########################################################################################

//***************************************conditions****************************************
//* //*
function Dragons_Horde_Conditions takes nothing returns boolean //*
//*
return GetSpellAbilityId () == Dragons_Horde_Rawcode () //*
//*
endfunction //*
//* //*
//*****************************************************************************************

//*************************************spell's script*************************************

function Dragons_Horde_Filter takes nothing returns boolean

local player owner = GetOwningPlayer (GetHandleUnit(GetExpiredTimer(),"caster"))
local unit target = GetFilterUnit ()
local boolean returnVal = false

if GetUnitAbilityLevel (target,Dummy_Ability_Rawcode()) <= 0 then
if IsUnitHidden (target) == false then
if GetWidgetLife (target) > .405 then
if IsUnitEnemy (target,owner) then
if IsUnitVisible (target,owner) then
if IsUnitType (target,UNIT_TYPE_STRUCTURE) == false then
if IsUnitType (target,UNIT_TYPE_MAGIC_IMMUNE) == false then
set returnVal = true
endif
endif
endif
endif
endif
endif
endif

set owner = null
set target = null
return returnVal

endfunction

//We know we hate BJ ^_^"
function Dragons_Horde_RandomUnit takes nothing returns nothing

set bj_groupRandomConsidered = bj_groupRandomConsidered + 1
if (GetRandomInt(1,bj_groupRandomConsidered) == 1) then
set bj_groupRandomCurrentPick = GetEnumUnit ()
endif

endfunction

function Dragons_Horde takes nothing returns nothing

local timer DhTimer = GetExpiredTimer ()

local unit caster = GetHandleUnit (DhTimer,"caster")
local integer level = GetUnitAbilityLevel (caster,Dragons_Horde_Rawcode())

local integer dragons = Dragons_Horde_Dragons (level)
local real cooldown = Dragons_Horde_Cooldown (level)

local player owner = GetOwningPlayer (caster)

local real castX = GetWidgetX (caster)
local real castY = GetWidgetY (caster)
local real drgnX
local real drgnY
local real targX
local real targY
local real nextX
local real nextY
local real angle
local real dist
local real Dist

local boolean Random
local real random

local real attack
local real spin
local boolean breath
local boolean Attack

local group targets
local unit target

local unit dummy

local unit eDragon
local integer lDragon = 0
local string lString

local integer maxDragon = Dragons_Horde_MaxDragons ()

local real period = Dragons_Horde_TimerPeriod ()
local real dmgPoint = Dragons_Horde_DamagePoint ()
local real radius = Dragons_Horde_Radius ()
local real drgnSpd = Dragons_Horde_DragonSpeed ()
local real drgnSpdDist = Dragons_Horde_DragonSpeedDist ()
local real drgnRad = Dragons_Horde_DragonRadius ()
local real drgnRadDist = Dragons_Horde_DragonRadiusDist ()
local real drgnRadSpd = Dragons_Horde_DragonRadiusSpeed ()
local real drgnRadSpdDist = Dragons_Horde_DragonRadiusSpeedDist ()
local real multiplier = period

local filterfunc DhFilter = Filter (function Dragons_Horde_Filter)

loop
set lDragon = lDragon + 1
exitwhen lDragon > maxDragon

set lString = I2S (lDragon)
set eDragon = GetHandleUnit (DhTimer,"dragon" + lString)

if lDragon > dragons or GetWidgetLife (caster) <= .405 then
call UnitApplyTimedLife (eDragon,'BTLF',.00001)
else
if GetWidgetLife (eDragon) <= .405 then
set random = GetRandomReal (drgnRad - drgnRadDist,drgnRad + drgnRadDist)
set angle = GetRandomReal (0.,360.)
set attack = 0.
set breath = false
set drgnX = castX + random * Cos (angle * (3.14159 / 180.))
set drgnY = castY + random * Sin (angle * (3.14159 / 180.))
set targX = 0.
set targY = 0.
set eDragon = CreateUnit (owner,Dragons_Horde_DragonRawcode(),drgnX,drgnY,angle + 90.)
call DestroyEffect (AddSpecialEffectTarget(Dragons_Horde_BirthEffect(),eDragon,"chest"))

call SetUnitAnimationByIndex (eDragon,0)

call SetUnitX (eDragon,drgnX)
call SetUnitY (eDragon,drgnY)

call SetHandleHandle (DhTimer,"dragon" + lString,eDragon)
call SetHandleReal (DhTimer,"dragondist" + lString,random )
call SetHandleReal (DhTimer,"dragonangle" + lString,angle )
call SetHandleReal (DhTimer,"dragoncool" + lString,attack )
call SetHandleBoolean (DhTimer,"dragondone" + lString,breath )
call SetHandleReal (DhTimer,"dragontargx" + lString,targX )
call SetHandleReal (DhTimer,"dragontargy" + lString,targY )
endif
set dist = GetHandleReal (DhTimer,"dragondist" + lString)
set angle = GetHandleReal (DhTimer,"dragonangle" + lString)
set attack = GetHandleReal (DhTimer,"dragoncool" + lString)
set breath = GetHandleBoolean (DhTimer,"dragondone" + lString)
set targX = GetHandleReal (DhTimer,"dragontargx" + lString)
set targY = GetHandleReal (DhTimer,"dragontargy" + lString)
set drgnX = GetWidgetX (eDragon)
set drgnY = GetWidgetY (eDragon)

set Attack = attack > 0. and attack <= dmgPoint

if Attack then
set multiplier = 0.
endif

set random = GetRandomReal (drgnSpd - drgnSpdDist,drgnSpd + drgnSpdDist)
set spin = random / (2. * 3.14159 * dist / 360.) * multiplier
set angle = angle + spin

loop
set random = GetRandomReal (drgnRadSpd - drgnRadSpdDist,drgnRadSpd + drgnRadSpdDist) * GetRandomReal (-1.,1.) * multiplier
set Dist = dist + random
exitwhen Dist <= drgnRad + drgnRadDist and Dist >= drgnRad - drgnRadDist
endloop
set dist = dist + random

set nextX = castX + dist * Cos (angle * (3.14159 / 180.))
set nextY = castY + dist * Sin (angle * (3.14159 / 180.))
set drgnX = nextX
set drgnY = nextY
call SetUnitX (eDragon,drgnX)
call SetUnitY (eDragon,drgnY)
call SetHandleReal (DhTimer,"dragondist" + lString,dist )
call SetHandleReal (DhTimer,"dragonangle" + lString,angle)

if Attack then
set angle = Atan2 (targY - drgnY,targX - drgnX) * (180. / 3.14159)
else
set angle = angle + 90.
endif
call SetUnitFacing (eDragon,angle)

if attack >= cooldown then
set attack = 0.
set breath = false
call SetHandleReal (DhTimer,"dragoncool" + lString,attack)
call SetHandleBoolean (DhTimer,"dragondone" + lString,breath)

elseif attack > 0. then
if attack >= dmgPoint and (breath == false) then
set breath = true
call SetHandleBoolean (DhTimer,"dragondone" + lString,breath)

set dummy = CreateUnit (owner,Dummy_Unit_Rawcode(),drgnX,drgnY,0.)
call UnitApplyTimedLife (dummy,'BTLF',1.)
call UnitAddAbility (dummy,Dragons_Horde_BreathRawcode())
call SetUnitAbilityLevel (dummy,Dragons_Horde_BreathRawcode(),level)
call IssuePointOrderById (dummy,852218,targX,targY)

call SetUnitAnimationByIndex (eDragon,0)
endif

set attack = attack + period
call SetHandleReal (DhTimer,"dragoncool" + lString,attack)

elseif attack == 0. then
set targets = CreateGroup ()
call GroupEnumUnitsInRange (targets,drgnX,drgnY,radius,Condition(function Dragons_Horde_Filter))
if FirstOfGroup (targets) != null then
set bj_groupRandomConsidered = 0
set bj_groupRandomCurrentPick = null
call ForGroup (targets,function Dragons_Horde_RandomUnit)
set target = bj_groupRandomCurrentPick //We know we hate BJ ^_^"
set targX = GetWidgetX (target)
set targY = GetWidgetY (target)
call SetHandleReal (DhTimer,"dragontargx" + lString,targX)
call SetHandleReal (DhTimer,"dragontargy" + lString,targY)
call SetUnitFacing (eDragon,Atan2(targY - drgnY,targX - drgnX) * (180. / 3.14159))

call SetUnitAnimationByIndex (eDragon,1)

set attack = attack + period
call SetHandleReal (DhTimer,"dragoncool" + lString,attack)

endif
call DestroyGroup (targets)
endif
set multiplier = period
endif
endloop

if caster == null then
call FlushHandleLocals (DhTimer)
call PauseTimer (DhTimer)
call DestroyTimer (DhTimer)
endif

set DhTimer = null
set caster = null
set eDragon = null
set owner = null
set targets = null
set target = null
set dummy = null
set eDragon = null
set DhFilter = null

endfunction

function Dragons_Horde_Register_Filter takes nothing returns boolean

local unit target = GetFilterUnit ()
local boolean returnVal = false

if GetUnitAbilityLevel (target,Dragons_Horde_Rawcode()) > 0 then
if GetUnitAbilityLevel (target,Dragons_Horde_LimitRawcode()) <= 0 then
set returnVal = true
endif
endif

set target = null
return returnVal

endfunction

function Dragons_Horde_Register takes nothing returns nothing

local timer DhTimer

local group regGroup = CreateGroup ()
local unit regUnit

local rect entire = GetWorldBounds ()

call GroupEnumUnitsInRect (regGroup,entire,Filter(function Dragons_Horde_Register_Filter))
loop
set regUnit = FirstOfGroup (regGroup)
exitwhen regUnit == null
call GroupRemoveUnit (regGroup,regUnit)
call UnitAddAbility (regUnit,Dragons_Horde_LimitRawcode())
call UnitMakeAbilityPermanent (regUnit,true,Dragons_Horde_LimitRawcode())
set DhTimer = CreateTimer ()
call SetHandleHandle (DhTimer,"caster",regUnit)
call TimerStart (DhTimer,Dragons_Horde_TimerPeriod(),true,function Dragons_Horde)
endloop
call DestroyGroup (regGroup)

call RemoveRect (entire)
set DhTimer = null
set regGroup = null
set regUnit = null
set entire = null

endfunction

//****************************************************************************************

//****************************************preloads*********************************************
//* //*
function Dragons_Horde_Preload takes nothing returns nothing //*
//*
local player neutral = Player (PLAYER_NEUTRAL_PASSIVE) //*
local unit tempUnit = CreateUnit (neutral,Dummy_Unit_Rawcode(),0.,0.,0.) //*
call DestroyEffect (AddSpecialEffectTarget(Dragons_Horde_BirthEffect(),tempUnit,"origin"))//*
call UnitAddAbility (tempUnit,Dragons_Horde_Rawcode()) //*
call UnitAddAbility (tempUnit,Dragons_Horde_LimitRawcode()) //*
call UnitAddAbility (tempUnit,Dragons_Horde_BreathRawcode()) //*
call RemoveUnit (tempUnit) //*
call RemoveUnit (CreateUnit(neutral,Dragons_Horde_DragonRawcode(),0.,0.,0.))//*
set neutral = null //*
set tempUnit = null //*
//*
endfunction //*
//* //*
//*********************************************************************************************

//===========================================================================

function InitTrig_Dragons_Horde takes nothing returns nothing
local integer playerId = 0
call Dragons_Horde_Preload ()
set gg_trg_Dragons_Horde = CreateTrigger ()
call TimerStart (CreateTimer(),Dragons_Horde_RegistryPeriod(),true,function Dragons_Horde_Register)
endfunction
:confused::confused: if you wan to test the map test it
 

Attachments

  • [Spell] Dragons_ Horde.w3x
    170.6 KB · Views: 200
First of all MUI is GUI, MUI just means that the GUI trigger will work when multiple unit's cast it at one time.
Second, why do you need it converted? Some JASS triggers cannot be converted to GUI mainly because most people that use JASS tend to use Local Variables, which are only available for use when using JASS because WE doesn't offer support for them through GUI

Also if it's because the map wont start for you its because you probably need the NEWGEN pack to run it since it probably uses vJASS
 
Doesn't seem like vJASS to me. Even if it's vJASS, you just need it to save, and not test it. Just saying, not sure if it would help.
 
this is classical jass (handlevars on gamecache) and this CANNOT be converted to GUI.

also this wont work on 124 (possible to port but none will do it for you)
 
Because the update 1.24d to 1.24e this spell will not work anymore.Also I want to tell you that JASS to GUI is impossible, but GUI to JASS is possible.This spell will not work because:
Code:
function H2I takes handle h returns integer
return h
return 0
endfunction
This is called "Handle BUG" and it was fixed in the patch i was talking about. I hope this was helpfull for you. :)
 
Code:
function H2I takes handle h returns integer
    return GetHandleId(h)
endfunction

this is not problem, other functions also can be ported to 124, main problem, you must do it self.
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • The Helper The Helper:
    It is weird seeing a way more realistic users online number
  • The Helper The Helper:
    Happy Tuesday Night!
    +1
  • V-SNES V-SNES:
    Happy Friday!
    +1
  • The Helper The Helper:
    News portal has been retired. Main page of site goes to Headline News forum now
  • The Helper The Helper:
    I am working on getting access to the old news portal under a different URL for those that would rather use that for news before we get a different news view.
  • Ghan Ghan:
    Easily done
    +1
  • The Helper The Helper:
    https://www.thehelper.net/pages/news/ is a link to the old news portal - i will integrate it into the interface somewhere when i figure it out
  • Ghan Ghan:
    Need to try something
  • Ghan Ghan:
    Hopefully this won't cause problems.
  • Ghan Ghan:
    Hmm
  • Ghan Ghan:
    I have converted the Headline News forum to an Article type forum. It will now show the top 20 threads with more detail of each thread.
  • Ghan Ghan:
    See how we like that.
  • The Helper The Helper:
    I do not see a way to go past the 1st page of posts on the forum though
  • The Helper The Helper:
    It is OK though for the main page to open up on the forum in the view it was before. As long as the portal has its own URL so it can be viewed that way I do want to try it as a regular forum view for a while
  • Ghan Ghan:
    Yeah I'm not sure what the deal is with the pagination.
  • Ghan Ghan:
    It SHOULD be there so I think it might just be an artifact of having an older style.
  • Ghan Ghan:
    I switched it to a "Standard" article forum. This will show the thread list like normal, but the threads themselves will have the first post set up above the rest of the "comments"
  • The Helper The Helper:
    I don't really get that article forum but I think it is because I have never really seen it used on a multi post thread
  • Ghan Ghan:
    RpNation makes more use of it right now as an example: https://www.rpnation.com/news/
  • The Helper The Helper:

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top