HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Can u help me?

02-26-2007, 02:32 PM#1
lome
I'll be posting all my questions about triggers on this thread,

1. I need an action that makes some units follow my custom hero. Can someone please tell me how this i can do it.
2. I need to know how to make a trigger work only if my custom hero is a certain level.

Please answer to my questions, i need really good triggers for my campaign.
02-26-2007, 02:59 PM#2
tamisrah
Hi lome,
-> 1. If you want to make them just follow, like they would when you order them to in game u need a trigger like this:
Collapse JASS:
function Trig_Sample_Actions takes nothing returns nothing
    call IssueTargetOrderBJ( udg_YourUnit, "move", udg_Hero )
endfunction

//===========================================================================
function InitTrig_Sample takes nothing returns nothing
    set gg_trg_Sample = CreateTrigger(  )
    call TriggerRegisterTimerEventPeriodic( gg_trg_Sample, 1.00 )
    call TriggerAddAction( gg_trg_Sample, function Trig_Sample_Actions )
endfunction

If you're aiming for something like summons in other rpgs (like DiabloII) you might want to use this system: http://www.wc3campaigns.net/showthread.php?t=83384

->2. You add a integer comparison as condition to your trigger:
Collapse JASS:
function Trig_Sample_Conditions takes nothing returns boolean
    if ( not ( GetHeroLevel(udg_Hero) == udg_Level ) ) then
        return false
    endif
    return true
endfunction

function Trig_Sample_Actions takes nothing returns nothing
endfunction

//===========================================================================
function InitTrig_Sample takes nothing returns nothing
    set gg_trg_Sample = CreateTrigger(  )
    call TriggerAddCondition( gg_trg_Sample, Condition( function Trig_Sample_Conditions ) )
    call TriggerAddAction( gg_trg_Sample, function Trig_Sample_Actions )
endfunction

hope this helps

EDIT: sry i'm getting a little confused about those trigger tags


Edited by vexorian. Reason: please use [jass] tags instead of [trigger] for Jass code....
02-26-2007, 07:53 PM#3
Anopob
You just need to use [jass] tags for JASS scripts, and you GUI triggers (ctrl + c/v) in [trigger] tags. But yeah, from a quick glance, tamishrah's way does work.
02-27-2007, 01:51 AM#4
Pyrogasm
tamisrah's functions optimizied:
Collapse JASS:
function Trig_Sample_Actions takes nothing returns nothing
    call IssueTargetOrder( udg_YourUnit, "move", udg_Hero )
endfunction

//===========================================================================
function InitTrig_Sample takes nothing returns nothing
    set gg_trg_Sample = CreateTrigger(  )
    call TriggerRegisterTimerEventPeriodic( gg_trg_Sample, 1.00 )
    call TriggerAddAction( gg_trg_Sample, function Trig_Sample_Actions )
endfunction
Collapse JASS:
function Trig_Sample_Conditions takes nothing returns boolean
    return GetHeroLevel(udg_Hero) == udg_Level
endfunction

function Trig_Sample_Actions takes nothing returns nothing
//Your actions here
endfunction

//===========================================================================
function InitTrig_Sample takes nothing returns nothing
    set gg_trg_Sample = CreateTrigger(  )
    call TriggerAddCondition( gg_trg_Sample, Condition( function Trig_Sample_Conditions ) )
    call TriggerAddAction( gg_trg_Sample, function Trig_Sample_Actions )
endfunction
02-27-2007, 03:00 PM#5
The)TideHunter(
Um, why the hell are you using Jass, when its simply done in GUI.
02-27-2007, 05:04 PM#6
Rising_Dusk
Because we're jass gurus and so should everyone else! Mwaha!

Trigger:
Events -
Conditions -
Collapse Actions -
Unit - Issue unit to <Some Order> <Some Target>
Wording might be off, but the general action is there.
That'll work well for what you want.

For the other, it's an integer check.
Just check the level of the hero before running actions.
Depending on where you want it (Trig. Cond or normal if/then/else) it will look differently.

Most of the time it's --
Trigger:
Events -
Conditions -
Collapse Actions -
Collapse If (All conditions are true) then (Do actions) else (Do actions)
Hero - Level of <Some Hero> greater than or equal to <Some Number>
Collapse Then
Do stuff...
Collapse Else
Do other stuff...
That's mostly how it'll look.

If you'd prefer jass, it'd be much easier to explain.
02-27-2007, 05:42 PM#7
lome
Thank u all but the GUI is way easier to use.
I have somemore questions.

1.Is there a way to change the team all units in a certain region?
2.Is there a way to make my unit do one if its animations for a cinematic?
3.Is there a way to make lightning strike once at a certain time instead of it repeating?

GUI please

PS. I know this doesn't have anything to do with the trigger editor but, in my campaign will my hero keep his level for all the missions
03-01-2007, 07:54 PM#8
lome
I have somemore questions.
1. is there a way to make a unit build something and then use a trigger to stop him from saying "Jobs Done" or something?
2. Is there a way to make so you havr to do all the events in a trigger before it starts?
03-01-2007, 08:41 PM#9
tamisrah
->1.1
Trigger:
change team
Events
Conditions
Collapse Actions
Collapse Unit Group - Pick every unit in (Units in (Playable map area)) and do (Actions)
Collapse Loop - Actions
Unit - Change ownership of (Picked unit) to Player 1 (Red) and Change color

->1.2
Trigger:
play animation
Events
Conditions
Collapse Actions
Animation - Play Unit's attack animation

->1.3
When you destroy an effect immediately after creating it will finish its animation before being destroyed.

->2.1
Could you explain that again? I don't really get what you want to do.

->2.2 No, there isn't, but you should be able to achieve what you want by using conditions.

@Anopob: ctrl+c doesn't work, at least not for me. I had to use 'copy as text' by right clicking the trigger
03-01-2007, 11:12 PM#10
Anopob
Er, that's what I meant. My bad.