Caballero

Barra de Salud : 
Mensajes : 405
Reputación : 48 Monedas de oro : 718 Monedas de Platino : 0 
Inventario :  
 | (#) Tema: Detonadores Sáb Ene 31, 2015 1:51 pm | |
| ¿Que diferencia hay entre un detonador GUI y JASS? No entiendo :S {[+CRONOS+]} |
|


Barra de Salud : 
Mensajes : 3663
Reputación : 729 Monedas de oro : 11240 Monedas de Platino : 0 
Inventario :  
 | (#) Tema: Re: Detonadores Sáb Ene 31, 2015 2:02 pm | |
| Un detonador gui se ve así: [gui]Random Hero Acontecimientos Unidad - A unit enters Random Hero Condiciones (Unit-type of (Triggering unit)) Igual a (==) Wisp Acciones Set RandomHeroSelect = (Random integer number between 1 and Heroes_Registrados) Set Punto = (Random point in Start ) Unidad - Remove (Triggering unit) from the game Unidad - Create 1 HeroeTipo[RandomHeroSelect] for (Owner of (Triggering unit)) at Punto facing Vista edificio predeterminada (270.0) degrees Set Heroes[(Player number of (Owner of (Triggering unit)))] = (Last created unit) Cámara - Aplicar Center for (Owner of (Triggering unit)) over 0.00 seconds Custom script: call RemoveLocation(udg_Punto) [/gui]
Un detonador de JASS se ve algo así:
[jass]function Cold_Snap_Conditions takes nothing returns boolean return GetSpellAbilityId() == 'A000' // Donde dice 'A000' ustedes colocan el rawcode de su habilidad si no saben cual // es simplemente pongan "mostrar valores brutos" en su editor de habilidades y // aparecerá un código de 4 caracteres endfunction
//===================================================================================================================== function Cold_Snap_Actions takes nothing returns nothing // Empezamos a setear nuestras variables local timer Timer = CreateTimer() // Este timer servirá para detener el spell cuando se termine su duración local trigger ColdTrigger = CreateTrigger() // Este trigger servirá para detectar el daño hacia nuestra unidad objetivo local unit Caster = GetTriggerUnit() // La variable del caster (para los novatos ) local unit Congelado = GetSpellTargetUnit() // La variable del objetivo (para los novatos ) local integer level = GetUnitAbilityLevel(Caster, GetSpellAbilityId()) // El nivel de la spell casteada local unit DummyColdSnap= CreateUnit(GetTriggerPlayer(), 'h000', GetSpellTargetX(), GetSpellTargetY(), bj_UNIT_FACING ) // Esta es nuestra unidad dummy, es la unidad que dañará y provocará el ministun al target local integer HabiDummy = 'A001' // Aquí va el rawcode de su habilidad dummy local real duracion = 2.50 + ( 0.50 * level ) // La duración del spell local real initdamage = 60.00 // El daño inicial que tomará el target // Termina el seteo de Variables // Inician las acciones call UnitDamageTarget( Caster, Congelado, initdamage,false,false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL, null ) // Dañamos al target call UnitApplyTimedLife( DummyColdSnap, 'BTLF', 6.00 ) // El contador de vida de la unidad dummy call UnitAddAbility( DummyColdSnap, HabiDummy) // Agregamos la habilidad dummy call SetUnitAbilityLevel(DummyColdSnap, HabiDummy, level ) // Seteamos el nivel de la habilidad dummy call IssueTargetOrder( DummyColdSnap, "thunderbolt", Congelado ) // Ordenamos al dummy usar la habi dummy contra el target call TimerStart (Timer, duracion,false,function DetenerColdSnap) // Esta acción inicia el timer, // para que expire en el tiempo de duración marcado y llamar a la función "DetenerColdSnap call TriggerRegisterUnitEvent( ColdTrigger, Congelado, EVENT_UNIT_DAMAGED ) // Agregamos al trigger el evento " Target - Takes Damage " call TriggerAddAction( ColdTrigger, function EfectoColdSnap ) // Agregamos al trigger las acciones de la función "EfectoColdSnap" // Terminan las acciones // Guardamos variables call SetHandleHandle(ColdTrigger,"Dummy",DummyColdSnap) // Guardamos al dummy en el handle del Trigger call SetHandleHandle(Timer,"Trigger",ColdTrigger) // Guardamos al trigger en el handle del timer // Evitamos leaks set Timer = null set ColdTrigger = null set Congelado = null set DummyColdSnap = null set Caster = null endfunction
//===================================================================================================================== function InitTrig_Cold_Snap takes nothing returns nothing local trigger t = CreateTrigger( ) call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_CAST ) call TriggerAddCondition( t, Condition( function Cold_Snap_Conditions ) ) call TriggerAddAction( t, function Cold_Snap_Actions ) set t = null endfunction[/jass]
Otras diferencias son: JASS es más rápido(no notarás gran diferencia en general) JASS es mucho más flexible(tanto que un "detonador" de JASS, puede utilizar muchos detonadores, por lo tanto es más bien, una página de código) GUI es más fácil de aprender(está hecho para ser fácil de usar para el usuario) JASS utiliza variables locales principalmente(sólo se usan en la función en que la declaran, las globales se pueden usar en cualquier parte del código del mapa)
vJASS tiene unas cuantas más diferencias cJASS más zinc otras más y WurstScript otras más.
Básicamente GUI es una interfaz para que el usuario pueda usar fácilmente el código y JASS es el código escrito directamente |
|
Caballero

Barra de Salud : 
Mensajes : 288
Reputación : 31 Monedas de oro : 627 Monedas de Platino : 0 
Inventario :  
 | (#) Tema: Re: Detonadores Sáb Ene 31, 2015 5:10 pm | |
| ooooo, ya entiendo  [img]  [/img] |
|
 | (#) Tema: Re: Detonadores  | |
| |
|