Posté le: 24/01/09 14:15 Sujet du message: Saut de Rommstein en Jass
Tout est dans le titre: j'espérais arriver à convertir correctement le Saut de Rommstein en jass, et surtout, en un seul trigger.
Bien sûr, ça ne marche pas :s
Voici ma fonction:
Secret:
Jass:
function group2 takes nothing returns boolean
if ( not ( IsUnitType(GetFilterUnit(), UNIT_TYPE_STRUCTURE) == false ) ) then
return false
endif
if ( not ( IsUnitType(GetFilterUnit(), UNIT_TYPE_GROUND) == true ) ) then
return false
endif
if ( not ( IsUnitEnemy(GetFilterUnit(), GetOwningPlayer(GetTriggerUnit())) == true ) ) then
return false
endif
return true
endfunction
function Trig_Jump_Spell_Conditions takes nothing returns boolean
if ( not ( GetSpellAbilityId() == 'A003' ) ) then
return false
endif
return true
endfunction
function Trig_Jump_Spell_Actions takes nothing returns nothing
local unit u = GetTriggerUnit()
local player pl = GetOwningPlayer(u)
local location p1 = GetUnitLoc(u)
local location p2 = GetSpellTargetLoc()
local real a = AngleBetweenPoints(p1, p2)
local real dis = DistanceBetweenPoints(p1, p2)
local real r = 0.00
local real dur = 1.50
local real aoe = 250.00
local real dmg = ( ( 100.00 * I2R(GetUnitAbilityLevelSwapped('A003', u)) ) + ( 1 * I2R(GetHeroStatBJ(bj_HEROSTAT_AGI, u, true)) ) )
local string s = "Abilities\\Spells\\Orc\\WarStomp\\WarStompCaster.mdl"
local group g1
local group g2
local unit t
call UnitAddAbilityBJ( 'A000', u )
call UnitAddAbilityBJ( 'Amrf', u )
call UnitAddTypeBJ( UNIT_TYPE_PEON, u )
call TriggerSleepAction( 0.01 )
call IssueImmediateOrderBJ( u, "holdposition" )
call SetUnitTimeScalePercent( u, ( 85.00 / dur ) )
call SetUnitPathing( u, false )
call SetUnitAnimation( u, "attack slam" )
call GroupAddUnitSimple( u, g1 )
loop
set r = r + 0.01
call TriggerSleepAction(0.01)
exitwhen (r > dur + 0.01)
if ( r == dur + 0.01 ) then
call UnitRemoveTypeBJ( UNIT_TYPE_PEON, u )
call UnitRemoveAbilityBJ( 'Amrf', u )
call UnitRemoveAbilityBJ( 'A000', u )
call SetUnitPathing( u, true )
call ResetUnitAnimation( u )
call SetUnitTimeScalePercent( u, 100.00 )
call GroupRemoveUnitSimple( u, g1 )
set p1 = GetUnitLoc(u)
call AddSpecialEffectLocBJ( p1, s )
set g2 = GetUnitsInRangeOfLocMatching(aoe, p1, Condition( function group2 ))
loop
set t= FirstOfGroup(g2)
call GroupRemoveUnit(g2, t)
exitwhen( t == null)
call UnitDamageTargetBJ( u, t, dmg, ATTACK_TYPE_MELEE, DAMAGE_TYPE_NORMAL )
endloop
call DestroyGroup( g2 )
call RemoveLocation( p1 )
else
set p1 = GetUnitLoc(u)
set p2 = PolarProjectionBJ(p1, ( dis / ( dur * 100.00 ) ), a)
call SetUnitPositionLocFacingBJ( u, p2, a )
call RemoveLocation( p2 )
call RemoveLocation( p1 )
if ( not ( r <= ( dur / 2.00 ) ) ) then
call SetUnitFlyHeightBJ( u, ( GetUnitFlyHeight(u) + ( 4.50 / dur ) ), 0.00 )
else
endif
if ( not ( r > ( dur / 2.00 ) ) ) then
call SetUnitFlyHeightBJ( u, ( GetUnitFlyHeight(u) - ( 4.50 / dur ) ), 0.00 )
endif
endif
endloop
set u = null
set pl = null
call RemoveLocation(p1)
call RemoveLocation(p2)
set p1 = null
set p2 = null
set s = null
call DestroyGroup(g1)
call DestroyGroup(g2)
set g1 = null
set g2 = null
set t = null
endfunction
//===========================================================================
function InitTrig_Jump_Spell takes nothing returns nothing
set gg_trg_Jump_Spell = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Jump_Spell, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Jump_Spell, Condition( function Trig_Jump_Spell_Conditions ) )
call TriggerAddAction( gg_trg_Jump_Spell, function Trig_Jump_Spell_Actions )
endfunction
Concrètement, le sort est bien lancé, l'animation "attack slam" jouée, mais plus rien ensuite: le sort devient inutilisable (cf ne se recharge pas et décrit comme non encore prêt), et surtout, l'unité ne vole pas.
Donc si jamais quelqu'un avait déjà fait des sauts en Jass...Si il pouvait m'expliquer comment faire.
Inscrit le: 23 Aoû 2007 Messages: 4766 Sujets: 136 Spécialité en worldedit: Keskesapeutfout' Médailles: 1 (En savoir plus...)
Posté le: 24/01/09 14:22 Sujet du message:
Je ne pourrai pas t'aider (par manque d'expérience et surtout par flemme ), mais si tu réussis à entièrement le convertir ce serait bien que tu le poste dans les tutos _________________
Leçon n°1 du WorldEdit : « Le violet > Troll-Brain »
Inscrit le: 23 Aoû 2007 Messages: 7143 Sujets: 147 Spécialité en worldedit: le troll, le flood, la vulgarité, mon coeur balance Médailles: 2 (En savoir plus...)
Posté le: 29/01/09 22:23 Sujet du message:
Apocalypse a écrit:
En conclusion, le saut de Rommstein n'est pas efficient si traduit en jass.
Conclusion boiteuse, le gui en lui même n'est pas efficient, et tout aussi généralement, un code en gui est affreux à éditer, une fois celui ci convertit en jass.
Cela dit je ne dénigre pas Rommstein qui est tout à fait capable, simplement c'est juste une grosse fainéasse qui ne veut pas rejoindre le clan des jasseurs _________________
//***************************************************************************
//* *
//* Jumping Spell Template v3 *
//* ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯ **URL in the works *
//* Parabola function by Shadow1500 *
//* System by emjlr3 *
//* *
//* Requires: *
//* ¯¯¯¯¯¯¯¯¯ *
//* *
//* - A vJASS Preprocessor *
//* *
//***************************************************************************
library JST initializer InitJST
globals
// Speed at which unit's periodic movement is completed (.01-.04 recommended)
private constant real Interval = .025
// Value which represents the arc of the jump movement (1.-2.), closer to 2. for a flatter arc
private constant real Arc = 1.3
// Rawcode of the Crow Form ability in your map. This need only be changed if you have edited this ability
// in which case, create a new, unedited copy and use it here
private constant integer CrowForm = 'Amrf'
// Rawcode of peasant unit in your map. This need only be changed if you have edited this unit
// in which case, create a new, unedited copy and ise it here
private constant integer Peasant = 'hpea'
endglobals
//=====No touching past this point=====\\
globals
private real Game_MaxX
private real Game_MinX
private real Game_MaxY
private real Game_MinY
private sound S = CreateSoundFromLabel( "InterfaceError",false,false,false,10,10)
endglobals
private function Parabola takes real dist, real maxdist returns real
local real t = (dist*2)/maxdist-1
return (-t*t+1)*(maxdist/Arc)
endfunction
private function InitJST takes nothing returns nothing
set Game_MaxX = GetRectMaxX(bj_mapInitialPlayableArea)-50.
set Game_MinX = GetRectMinX(bj_mapInitialPlayableArea)+50.
set Game_MaxY = GetRectMaxY(bj_mapInitialPlayableArea)-50.
set Game_MinY = GetRectMinY(bj_mapInitialPlayableArea)+50.
endfunction
public function CheckLocPathing takes location l returns boolean
local unit u = CreateUnitAtLoc( Player(13), Peasant, l, 0. )
local real x = GetUnitX(u) - GetLocationX(l)
local real y = GetUnitY(u) - GetLocationY(l)
local boolean b = false
if x < 1. and x > -1. and y < 1. and y > -1. then
set b = true
endif
call ShowUnit(u,false)
call KillUnit(u)
call RemoveLocation(l)
set u = null
return b
endfunction
private function SafeX takes real x returns real
if x<Game_MinX then
return Game_MinX
elseif x>Game_MaxX then
return Game_MaxX
endif
return x
endfunction
private function SafeY takes real y returns real
if y<Game_MinY then
return Game_MinY
elseif y>Game_MaxY then
return Game_MaxY
endif
return y
endfunction
private struct dat
unit u
real area
real damage
real maxdist
real movedist
real cos
real sin
real diff
real start_z
string sfx
integer i = 0
endstruct
globals
private timer T = CreateTimer()
private dat array D
private integer Total = 0
endglobals
//Spell:
private function Filt takes nothing returns boolean
return IsUnitEnemy(GetFilterUnit(),bj_groupEnumOwningPlayer) and IsUnitType(GetFilterUnit(),UNIT_TYPE_FLYING)!=true
endfunction
private function Damage takes unit u, real dam, real x, real y, real area returns nothing
local group g = CreateGroup()
local unit v
set bj_groupEnumOwningPlayer = GetOwningPlayer(u)
call GroupEnumUnitsInRange(g, x, y, area, Condition(function Filt))
loop
set v = FirstOfGroup(g)
exitwhen v == null
call GroupRemoveUnit(g,v)
call UnitDamageTarget(u,v,dam,false,false,ATTACK_TYPE_NORMAL,DAMAGE_TYPE_NORMAL,null)
endloop
call DestroyGroup(g)
set g = null
endfunction
private function Movement takes nothing returns nothing
local dat d
local integer i = 1
local real dist
local real height
local real x
local real y
loop
exitwhen i>Total
set d = D[i]
set d.i = d.i + 1
set dist = d.i*d.movedist
set L = GetUnitLoc(d.u)
set height = GetLocationZ(L)
if height<d.start_z then
set height = (d.start_z-height)+Parabola(dist,d.maxdist)
elseif height>d.start_z then
if d.start_z+Parabola(dist,d.maxdist)<=height then
set height = 0.
else
set height = Parabola(dist,d.maxdist)-(height-d.start_z)
endif
else
set height = Parabola(dist,d.maxdist)
endif
call RemoveLocation(L)
if d.i == HalfRuns then
call SetUnitTimeScale(d.u, 1.)
elseif height<=1. then
call PauseUnit( d.u,false )
call SetUnitPathing( d.u, true )
call SetUnitFlyHeight(d.u,GetUnitDefaultFlyHeight(d.u),0.)
set x = GetUnitX(d.u) + d.diff * d.cos
set y = GetUnitY(d.u) + d.diff * d.sin
call DestroyEffect(AddSpecialEffect(d.sfx, x,y))
call Damage(d.u, d.area, x, y, d.damage)
call d.destroy()
set D[i] = D[Total]
set Total = Total - 1
set i = i - 1
if Total==0 then
call PauseTimer(T)
endif
endif
set i = i + 1
endloop
endfunction
//===========================================================================
public function Cast takes unit u, real damage, real area, real diff, string anim, string sfx returns boolean
local dat d
local real ux
local real uy
local location l
local real ang
local real x
local real y
if u==null or damage<0. or area<0. then
if GetLocalPlayer()==GetOwningPlayer(u) then
call ClearTextMessages()
call BJDebugMsg("|c00FF0000JST Error: Invalid inputs in function Cast.")
call StartSound(S)
endif
return false
endif
set d = dat.create()
set ux = GetUnitX(u)
set uy = GetUnitY(u)
set l = GetSpellTargetLoc()
set ang = Atan2((GetLocationY(l)-uy),(GetLocationX(l)-ux))
set x = GetLocationX(l) - diff * Cos(ang)
set y = GetLocationY(l) - diff * Sin(ang)
set d.u = u
set d.damage = damage
set d.area = area
set d.sfx = sfx
set d.maxdist = SquareRoot((ux-x)*(ux-x) + (uy-y)*(uy-y))
set d.cos = Cos(ang)
set d.sin = Sin(ang)
set d.movedist = d.maxdist/Runs
set d.diff = diff
set L = GetUnitLoc(d.u)
set d.start_z = GetLocationZ(L)
call RemoveLocation(L)
set Total = Total + 1
if Total == 1 then
call TimerStart(T,Interval,true,function Movement)
endif
set D[Total] = d
call RemoveLocation(l)
set l = null
return true
endfunction
endlibrary
Edit: salut T.B. Si tu savais le nombre de questions que je voulais poser sur l'utilité du vjass et sur les centaines de fonctions jass. Du genre quelle utilité d'avoir des fonctions BJ et pas BJ etc... _________________
Inscrit le: 13 Jan 2009 Messages: 550 Sujets: 47 Spécialité en worldedit: La partie déclencheurs sauf le GUI.
Posté le: 30/01/09 11:54 Sujet du message:
Apocalypse a écrit:
Du genre quelle utilité d'avoir des fonctions BJ et pas BJ etc...
Je vais parler d'après mon expérience du jass. Je crois bien qu'une fonction prédéfinie terminant par "BJ" est présente en GUI alors que les autres ne le sont pas.
Exemple :
SubString est utilisable en jass
SubStringBJ est utilisable aussi en GUI
Je crois que dans ce cas, la fonction SubStringBJ, qui est un peu différente de l'autre, permet une utilisation plus logique (en tout cas pour ceux qui ne savent pas exactement comment fonctionnent les chaînes de caractères), mieux adaptée que SubString pour le GUI. _________________
Page 1 sur 1 La question posée dans ce topic a été résolue !
Vous ne pouvez pas poster de nouveaux sujets dans ce forum Vous ne pouvez pas répondre aux sujets dans ce forum Vous ne pouvez pas éditer vos messages dans ce forum Vous ne pouvez pas supprimer vos messages dans ce forum Vous ne pouvez pas voter dans les sondages de ce forum