| 04-10-2009, 05:46 AM | #1 |
JASS:scope Submerge initializer Init globals private constant string BUBBLE = "Objects\\Spawnmodels\\Other\\IllidanFootprint\\IllidanWaterSpawnFootPrint.mdl" private constant integer SUBMERGE = 'A00P' private constant integer SURFACE = 'A00Q' endglobals private function CinematicFilterGenericForPlayer takes player whichPlayer, real duration, blendmode bmode, string tex, real red0, real green0, real blue0, real trans0, real red1, real green1, real blue1, real trans1 returns nothing if ( GetLocalPlayer() == whichPlayer ) then call SetCineFilterTexture(tex) call SetCineFilterBlendMode(bmode) call SetCineFilterTexMapFlags(TEXMAP_FLAG_NONE) call SetCineFilterStartUV(0, 0, 1, 1) call SetCineFilterEndUV(0, 0, 1, 1) call SetCineFilterStartColor(PercentTo255(red0), PercentTo255(green0), PercentTo255(blue0), PercentTo255(100-trans0)) call SetCineFilterEndColor(PercentTo255(red1), PercentTo255(green1), PercentTo255(blue1), PercentTo255(100-trans1)) call SetCineFilterDuration(duration) call DisplayCineFilter(true) endif endfunction private function Actions takes nothing returns nothing local unit u = GetTriggerUnit() local real x = GetUnitX(u) local real y = GetUnitY(u) local real ax = GetRectCenterX(gg_rct_AbovewaterSurface) local real ay = GetRectCenterY(gg_rct_AbovewaterSurface) local real sx = GetRectCenterX(gg_rct_UnderwaterSurface) local real sy = GetRectCenterY(gg_rct_UnderwaterSurface) local unit d local integer i = 0 local real angle = Atan2(sy-y,sx-x) local real dx = x-ax local real dy = y-ay local real dist = SquareRoot(dx*dx+dy*dy) local real mx = sx+dist*Cos(angle) local real my = sy+dist*Sin(angle) if IsTerrainPathable(x,y,PATHING_TYPE_WALKABILITY) == true and GetSpellAbilityId() == SUBMERGE then set d = CreateUnit(GetOwningPlayer(u),'h005',x,y,GetUnitFacing(u)) call UnitApplyTimedLife(d,'BTLF',3) call SetUnitPosition(u,mx,my) //call SetUnitPositionLoc( GetTriggerUnit(), PolarProjectionBJ(subbelow, DistanceBetweenPoints(subabove, t), AngleBetweenPoints(subabove, t)) ) if GetLocalPlayer() == GetOwningPlayer(u) then call PanCameraToTimed(mx,my,0) endif // call SetCameraBoundsToRectForPlayerBJ(GetOwningPlayer(GetTriggerUnit()),gg_rct_UnderwaterSurface) loop exitwhen i > 5 call DestroyEffect(AddSpecialEffect(BUBBLE,x+GetRandomReal(-100,100),y+GetRandomReal(-100,100))) set i = i + 1 endloop if GetLocalPlayer() == GetOwningPlayer(u) then // call StopSoundBJ(udg_sound[1],true) // call StopSoundBJ(udg_sound[2],true) // call StopSoundBJ(udg_sound[3],true) // call StopSoundBJ(udg_sound[9],true) // call PlaySoundBJ(udg_sound[6]) // call PlaySoundBJ(udg_sound[7]) // call PlaySoundBJ(udg_sound[8]) endif else call SimError(GetOwningPlayer(u),"Unable to surface there") endif if GetSpellAbilityId() == SURFACE then loop exitwhen i > 5 call DestroyEffect(AddSpecialEffect(BUBBLE,x+GetRandomReal(-100,100),y+GetRandomReal(-100,100))) set i = i + 1 endloop call PanCameraToTimed(mx,my,0) // call SetCameraBoundsToRectForPlayerBJ( GetOwningPlayer(GetTriggerUnit()), gg_rct_AbovewaterSurface ) call SetUnitPosition(u,mx,my) call DisplayCineFilterBJ(false) //if GetLocalPlayer() == GetOwningPlayer(GetTriggerUnit()) then // call PlaySoundBJ(udg_sound[1]) // call PlaySoundBJ(udg_sound[2]) // call PlaySoundBJ(udg_sound[3]) // call PlaySoundBJ(udg_sound[9]) // call StopSoundBJ(udg_sound[6],true) // call StopSoundBJ(udg_sound[7],true) // call StopSoundBJ(udg_sound[8],true) // endif else call SimError(GetOwningPlayer(u),"Unable to submerge there") endif set u = null set d = null endfunction //=========================================================================== private function Init takes nothing returns nothing local trigger t = CreateTrigger() call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_SPELL_EFFECT ) call TriggerAddAction( t, function Actions ) endfunction endscope In my map spirit of vengeance, there was a old poopy trigger that was in GUI, It took me 40 minutes to port it to vJASS and I am wondering why this does not work. All the part works well except the movement part. I changed the PolarProjectionBJ to some natives. ax,ay is the top right corner of the above region and sx,sy for the top right corner of the below region. |
| 04-10-2009, 10:00 AM | #2 |
You should populate your code with call BJDebugMsg(). Example:call BJDebugMsg("Checking...") if IsTerrainPathable(x,y,PATHING_TYPE_WALKABILITY) == true and GetSpellAbilityId() == SUBMERGE then call BJDebugMsg("Valid!") set d = CreateUnit(GetOwningPlayer(u),'h005',x,y,GetUnitFacing(u)) call BJDebugMsg("Name: "+GetUnitName(u)) call UnitApplyTimedLife(d,'BTLF',3) call SetUnitPosition(u,mx,my) call BJDebugMsg("x: "+R2S(mx)+" ; y:"+R2S(my)) //call SetUnitPositionLoc( GetTriggerUnit(), PolarProjectionBJ(subbelow, DistanceBetweenPoints(subabove, t), AngleBetweenPoints(subabove, t)) ) if GetLocalPlayer() == GetOwningPlayer(u) then call PanCameraToTimed(mx,my,0) endif PS. I think IsTerrainPathable(x,y,PATHING_TYPE_WALKABILITY) returns the opposite value or somthing. |
| 04-10-2009, 10:37 AM | #3 |
Sorry, it was fixed but + REP for trying to help. |
