wc3campaigns
WC3C Homepage - www.wc3c.netUser Control Panel (Requires Log-In)Engage in discussions with other users and join contests in the WC3C forums!Read one of our many tutorials, ranging in difficulty from beginner to advanced!Show off your artistic talents in the WC3C Gallery!Download quality models, textures, spells (vJASS/JASS), systems, and scripts!Download maps that have passed through our rigorous approval process!

Go Back   Wc3C.net > Warcraft III Modding > Developer's Corner > Triggers & Scripts
User Name
Password
Register Rules Get Hosted! Chat Pastebin FAQ and Rules Members List Calendar



Reply
 
Thread Tools Search this Thread
Old 12-16-2016, 07:56 PM   #1
DenisHellman
User
 
Join Date: Dec 2016
Posts: 2

DenisHellman has little to show at this moment (0)

Question vJass Code Issue.

Hello everybody.

Move my topic to the correct thread, if I posted it wrong.

I'm super-new to vJASS. I decided to stop use GUI and now learning for code.

And I have 2 questions.

1. How to attach the effect to the hero that was just revieved after death and what native is best in my case. (code will be below the message)
2. How to simplify my code:

call TriggerRegisterPlayerUnitEventSimple( t, Player(0), EVENT_PLAYER_UNIT_DEATH )

As you can see, I'm just spam this 12 times for all players on the map, if there is any possible way to somehow make it more simple?

Explain and send me the finished fixed version, if possiblee.....

Collapse JASS:
scope GlobalRespawn initializer Init

private function Conditions takes nothing returns boolean
    return IsUnitType(GetTriggerUnit(), UNIT_TYPE_HERO) == true
endfunction

private function Actions takes nothing returns nothing
    local unit u = GetTriggerUnit()
    call TriggerSleepAction( 10.00 )
    call ReviveHeroLoc( u, GetRandomLocInRect(GetPlayableMapRect()), true )
    call SetUnitManaPercent( u, 100 )
    call PanCameraToTimedLocForPlayer( GetOwningPlayer(u), GetUnitLoc(u), 0 )
    call AddSpecialEffectTarget( "Abilities\\Spells\\Human\\MassTeleport\\MassTeleportCaster.mdl", "origin", GetUnitX(u), GetUnitY(u) )
    call ClearSelectionForPlayer( GetOwningPlayer(u) )
    call SelectUnitForPlayerSingle( u, GetOwningPlayer(u)) )
endfunction

//===========================================================================
private function Init takes nothing returns nothing
    local trigget t = CreateTrigger()
    call TriggerRegisterPlayerUnitEventSimple( t, Player(0), EVENT_PLAYER_UNIT_DEATH )
    call TriggerRegisterPlayerUnitEventSimple( t, Player(1), EVENT_PLAYER_UNIT_DEATH )
    call TriggerRegisterPlayerUnitEventSimple( t, Player(2), EVENT_PLAYER_UNIT_DEATH )
    call TriggerRegisterPlayerUnitEventSimple( t, Player(3), EVENT_PLAYER_UNIT_DEATH )
    call TriggerRegisterPlayerUnitEventSimple( t, Player(4), EVENT_PLAYER_UNIT_DEATH )
    call TriggerRegisterPlayerUnitEventSimple( t, Player(5), EVENT_PLAYER_UNIT_DEATH )
    call TriggerRegisterPlayerUnitEventSimple( t, Player(6), EVENT_PLAYER_UNIT_DEATH )
    call TriggerRegisterPlayerUnitEventSimple( t, Player(7), EVENT_PLAYER_UNIT_DEATH )
    call TriggerRegisterPlayerUnitEventSimple( t, Player(8), EVENT_PLAYER_UNIT_DEATH )
    call TriggerRegisterPlayerUnitEventSimple( t, Player(9), EVENT_PLAYER_UNIT_DEATH )
    call TriggerRegisterPlayerUnitEventSimple( t, Player(10), EVENT_PLAYER_UNIT_DEATH )
    call TriggerRegisterPlayerUnitEventSimple( t, Player(11), EVENT_PLAYER_UNIT_DEATH )
    call TriggerAddCondition( t, Condition( function Conditions ) )
    call TriggerAddAction( t, function Actions )
endfunction

endscope

Thank you all!
DenisHellman is offline   Reply With Quote
Sponsored Links - Login to hide this ad!
Old 01-06-2017, 07:18 PM   #2
Anitarf
Procrastination Incarnate


Development Director
 
Join Date: Feb 2004
Posts: 8,190

Submissions (19)

Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)

2008 Spell olympics - Fire - SilverApproved Map: Old School Alliance TacticsHero Contest #2 - 3rd PlaceSpell making session 2 winner

Default

1. You could simply give the hero an ability that attaches an effect.
2. call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_DEATH )
__________________
Anitarf is offline   Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off


All times are GMT. The time now is 02:31 PM.


Affiliates
The Hubb The JASS Vault Clan WEnW Campaign Creations Clan CBS GamesModding Flixreel Videos

Powered by vBulletin (Copyright ©2000 - 2019, Jelsoft Enterprises Ltd).
Hosted by www.OICcam.com
IT Support and Services provided by Executive IT Services