HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Problem with Flash Bang

01-25-2007, 01:31 PM#1
mikke95
Here is the trigger
-------------------

Trigger:
FlashBang
Collapse Events
Unit - A unit Finishes casting an ability
Collapse Conditions
(Ability being cast) Equal to FlashBang
((Triggering unit) has buff Blinded ) Equal to True
Collapse Actions
Player Group - Add (Triggering player) to Flashed
Collapse Player Group - Pick every player in Flashed and do (Actions)
Collapse Loop - Actions
Cinematic - Fade out over 0.10 seconds using texture White Mask and color (100.00%, 100.00%, 100.00%) with 0.00% transparency
Wait 4.00 seconds
Collapse Player Group - Pick every player in Flashed and do (Actions)
Collapse Loop - Actions
Cinematic - Fade in over 0.10 seconds using texture White Mask and color (100.00%, 100.00%, 100.00%) with 0.00% transparency
Player Group - Remove (Picked player) from Flashed

What is the problem?
It should get the owner of the units who has the buff get white screen.
01-25-2007, 02:01 PM#2
Fireeye
Triggering Player won't work, because there's no player in the event.
set a var = Target Unit and then use OwnerOfUnit(var).
01-25-2007, 02:07 PM#3
mikke95
it still won't work :(
but it laggs when i am casting it!

Trigger:
FlashBang
Collapse Events
Unit - A unit Finishes casting an ability
Collapse Conditions
(Ability being cast) Equal to FlashBang
((Triggering unit) has buff Blinded ) Equal to True
Collapse Actions
Set flash = (Triggering unit)
Player Group - Add (Owner of flash) to Flashed
Collapse Player Group - Pick every player in Flashed and do (Actions)
Collapse Loop - Actions
Cinematic - Fade out over 0.10 seconds using texture White Mask and color (100.00%, 100.00%, 100.00%) with 0.00% transparency
Wait 4.00 seconds
Collapse Player Group - Pick every player in Flashed and do (Actions)
Collapse Loop - Actions
Cinematic - Fade in over 0.10 seconds using texture White Mask and color (100.00%, 100.00%, 100.00%) with 0.00% transparency
Player Group - Remove (Picked player) from Flashed
01-25-2007, 02:10 PM#4
Fireeye
Uhm, this may work, not 100% sure don't have WE atm.
Collapse JASS:
function Trig_FlashBang_Conditions takes nothing returns boolean
return GetSpellAbilityId() == 'AUan' //Put your raw code here
endfunction

function Trig_FlashBang_Actions takes nothing returns nothing
local player p = GetOwningPlayer(GetSpellTargetUnit())
if GetLocalPlayer() == p then
call CinematicFadeBJ( bj_CINEFADETYPE_FADEOUT, 0.10, "ReplaceableTextures\\CameraMasks\\White_mask.blp", 100.00, 100.00, 100.00, 0 )
endif
call TriggerSleepAction( 4 )
if GetLocalPlayer() == p then
call CinematicFadeBJ( bj_CINEFADETYPE_FADEIN, 0.10, "ReplaceableTextures\\CameraMasks\\White_mask.blp", 100.00, 100.00, 100.00, 0 )
endif
endfunction

//===========================================================================
function InitTrig_FlashBang takes nothing returns nothing
    set gg_trg_FlashBang = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_FlashBang, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( gg_trg_FlashBang, Condition( function Trig_FlashBang_Conditions ) )
    call TriggerAddAction( gg_trg_FlashBang, function Trig_FlashBang_Actions )
endfunction
01-25-2007, 02:14 PM#5
mikke95
Can you please make me a DEMO map? I can't figure JASS or ''RAW codes'' :(
But anywhy thanks for trying to help me :)
01-25-2007, 02:22 PM#6
Fireeye
Alright, i made 1 map to check.
To view the raw code, go into the object editor and view, there you can find the option (ctrl+d if i remember correvtly).
However, if you cast chain lightning ONLY the Owner of the target unit will be affected, but i don't know if GetLocalPlayer() can cause desync.
Attached Files
File type: w3xtest.w3x (13.0 KB)
01-25-2007, 02:48 PM#7
mikke95
thank you but how to make it AOE?
01-25-2007, 03:21 PM#8
Fireeye
Give me some time to change it the needed way.
---Edit---
It's a targeted AoE right?
01-25-2007, 04:01 PM#9
mikke95
yep :)
01-25-2007, 04:04 PM#10
Fireeye
alright here's the new version, if you search the function Flashbang, you find it in the Custom Script Section.
Attached Files
File type: w3xtest.w3x (13.8 KB)
01-25-2007, 04:12 PM#11
mikke95
well thank you! I just need to overwrite the spell RAW CODE with the one in my map and copy the variables and spell to make it work right?
+rep and credits!
But how to make the radius bigger?

EDIT: nvm with the radius bigger i just found out :)
thank you very much, but now i have to get rid of ''Check who is the Host'' script.
But nvm the flashbang works 100% and is awesome!
But isn't there a way to make it activate a little bit more late?
01-25-2007, 09:41 PM#12
Mapz_Maker
Ok, that is just sad... you give but do not teach? Fireeye do you think mikke95 who cannot read JASS is going to understand how that works!?! you need to explain that if GetLocalPlayer() == (yourplayer) then is the most important thing in this whole aspect!!! and that he should never forget his endifs!! and that he can do that with most anything, he should just make sure that it does not cause a desync!!!!!!! (mikke95, you can use custom script to do that just make your trigger that you want to happen to a player and then do
Trigger:
For each integer a from 1 to 12
Collapse if player 1 is (yourplayer) then
Custom Script if GetLocalPlayer() == ConvertedPlayer(bj_forLoopAIndex) then
Cinematic - Fade //or any actions, check for desyncing though
endif //NEVER FORGET TO ENDIF World Editor WILL HAVE A FATAL ERROR IF YOU DO!
01-26-2007, 09:44 AM#13
Fireeye
Alright, alright, i'll explain here what each line make, updated the AoE Trigger, saved 2 line of script, just c'n'p all between function ... and endfunction.
Ohh, btw. Maker don't blame me i were busied, and you made an unlogical if directly after the loop.

Flashbang Mainfunction

Collapse JASS:
function Flashbang takes player p returns nothing //Line 1
    if GetLocalPlayer() == p then                 //Line 2
        call CinematicFadeBJ( bj_CINEFADETYPE_FADEOUT, 0.10, "ReplaceableTextures\\CameraMasks\\White_mask.blp", 100.00, 100.00, 100.00, 0 )
    endif                                         //Line 4
    call TriggerSleepAction( 4 )                  //Line 5
    if GetLocalPlayer() == p then                 //Line 6
        call CinematicFadeBJ( bj_CINEFADETYPE_FADEIN, 0.10, "ReplaceableTextures\\CameraMasks\\White_mask.blp", 100.00, 100.00, 100.00, 0 )
    endif                                         //Line 8
endfunction                                       //Line 9


Flashbang Mainfunction Explanation

Line 1: If you don't understand this i don't know why, well. This is the start of the entire function the name is "Flashbang" and it takes a player from another trigger so we can compare it later
Line 2: Now the nice part, you asked yourself how to show 1 multiboard to 1 player and other players don't see it? You can make it with "GetLocalPlayer()", this will do the actions inside the if statement only for 1 player, but be careful, some things can cause desync when using a GetLocalPlayer(), if i'm not wrong creating a unit with GetLocalPlayer() can cause desync. In this case we compare it with the taken player from line 1
Line 3: Here's the action we use for fading, in this case i used the GUI command, nothing spectacular
Line 4: Now i close the if statement from Line 2, all needed actions are done
Line 5: A simple wait command, but it's not that exactly on small intervalls, however this shouldn't matter in this case
Line 6: The same thing like in Line 2
Line 7: See Line 3, but this time we hide the fade
Line 8: See Line 4
Line 9; The entire function is done and we close it with "endfunction"


Flashbang Solo

Collapse JASS:
function Trig_FlashBangSolo_Actions takes nothing returns nothing //Line 1
    local player p = GetOwningPlayer(GetSpellAbilityUnit())       //Line 2
    call Flashbang(p)                                             //Line 3
    set p = null                                                  //Line 4
endfunction                                                       //Line 5


Flashbang Solo Explanation

Line 1: Declaring a function like in "Flashbang", but in this case it don't get anything from another function
Line 2: Here we declare a local variable for a player and set it to the Owner of the casting Unit
Line 3: Now we call the flashbang function with the player we declared in Line 2
Line 4: Now i nullify the player variable
Line 5: Allready everything done "endfunction"


FlashBang AoE (updated)

Collapse JASS:
function Trig_FlashBangAoE_Actions takes nothing returns nothing  //Line 1
    local player p                                                //Line 2
    local boolean array b                                         //Line 3
    local location l = GetSpellTargetLoc()                        //Line 4
    local group g = GetUnitsInRangeOfLocMatching(300.00, l,null)  //Line 5
    local unit u                                                  //Line 6
    loop                                                          //Line 7
        set u = FirstOfGroup(g)                                   //Line 8
        exitwhen u == null                                        //Line 9
        set p = GetOwningPlayer(u)                                //Line 10
        if b[GetPlayerId(p)] == false then                        //Line 11
            call Flashbang(p)                                     //Line 12
            set b[GetPlayerId(p)] = true                          //Line 13
        endif                                                     //Line 14
        call GroupRemoveUnit(g,u)                                 //Line 15
    endloop                                                       //Line 16
    call DestroyGroup(g)                                          //Line 17
    set p = null                                                  //Line 18
    set g = null                                                  //Line 19
    set u = null                                                  //Line 20
endfunction                                                       //Line 21


Flashbang AoE Explanation

Line 1: function ...
Line 2: the local player we need later to run Flashbang, i declare it later in the trigger
Line 3: A boolean array, so flashbang will run only once per player when the trigger is fired
Line 4: A local location, so you can pick all units into 1 unitgroup, could also use x and y coordinates
Line 5: A local group in which we set = all units within range of the location we declared in Line 4, and we use no conditions because we want to get ALL units.
Line 6: A local unit so we can loop through the unit group
Line 7: Now we start a loop
Line 8: at the beginning we set the local unit variable = to the first unit in the local group
Line 9: Here we make the condition when to abort the loop, in this case if the local unit is equal to no-unit
Line 10: now we set the local player = Owner of the local unit
Line 11: Now we check if the boolean array of the local player is equal to false
Line 12: When the condition is false then we call Flashbang with the player we declared at Line 10
Line 13: Now we set the local boolean array = true to prevent further runnings for the current local player
Line 14: Now we close the if statement
Line 15: Now we remove the unit from the unit group so we get a new unit at Line 8
Line 16: Now we close the loop
Line 17: Destroying the unit-group to prevent leaks
Line 18-20: Nullifying alle local variables
Line 21: endfunction

01-26-2007, 12:06 PM#14
mikke95
Thank you it really helped i am thinking that i actually can learn to make JASS by my own soon :P thanks