Need some help with few triggers

Omnizohar

New Member
Reaction score
0
1. I have a Priest Hero controlled by a default Computer AI and I made his role is to heal wounded friendly units if they're within 900 range of him. I'm really bad with triggers so I'm asking for help if someone may help me with this trigger.

2. How do I make Neutral Hostile creeps start wondering within the wilderness when they're spawned like in RPG's and maybe some AoS, and start attacking units/buildings if they're like 600 range away from the creep.

3. Last one, is it possible to exceed the 5 Hero Ability limit? Kinda stupid but I just want to know.

I'll appreciate all the help I will get, thank you.
 

LightChaosma

New Member
Reaction score
60
3 - you could use spellbooks, and trigger the ability learn system

1


Code:
e
every 1 second of the game
c
a
set point = position of priest
set tempunitgroup = pick every unit withing 900 of point
set tempunitgroup = pick 1 random unit from tempunitgroup
pick every unit in tempunitgroup and do multiple actions:
    - unit - order targeting a unit - order priest to human priest - heal picked unit

custom script : call removelocation(udg_point)
custom script : call removegroup(udg_tempunitgroup)

handwritten
 

Exide

I am amazingly focused right now!
Reaction score
448
1. Not sure what ability your priest uses, but I assume it's holy light.
Here's a simple trigger:
Code:
Healing
    Events
        Time - Every 2.00 seconds of game time
    Conditions
    Actions
        Set healerloc = (Position of Healer)
        Set healgroup = (Units within 600.00 of healerloc matching (((Owner of (Matching unit)) is an ally of (Owner of Healer)) Equal to True))
        Unit Group - Pick every unit in healgroup and do (Actions)
            Loop - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        (Life of (Picked unit)) Less than or equal to 500.00
                    Then - Actions
                        Unit - Order Healer to Human Paladin - Holy Light (Picked unit)
                    Else - Actions
        Custom script:   call RemoveLocation(udg_healerloc)
        Custom script:   call DestroyGroup(udg_healgroup)
This trigger will check all allies near the healer if they have less than 500hp, if they do the healer will heal them.
It's not a very good trigger, but it should work most of the times. :p


2. Add the Wander ability to them, or use this trigger:
Code:
Wander
    Events
        Time - Every 2.00 seconds of game time
    Conditions
    Actions
        Set wandergroup = (Units in (Playable map area) owned by Neutral Hostile)
        Unit Group - Pick every unit in wandergroup and do (Actions)
            Loop - Actions
                Set wanderloc = (Random point in (Playable map area))
                Unit - Order (Picked unit) to Attack-Move To wanderloc
                Custom script:   call RemoveLocation(udg_wanderloc)
        Custom script:   call DestroyGroup(udg_wandergroup)


3. Use a spellbook.
Search the forums and you'll find plenty of Tutorials.
 

Accname

2D-Graphics enthusiast
Reaction score
1,464
Code:
e
every 1 second of the game
c
a
set point = position of priest
set tempunitgroup = pick every unit withing 900 of point
[B]set tempunitgroup = pick 1 random unit from tempunitgroup[/B]
pick every unit in tempunitgroup and do multiple actions:
    - unit - order targeting a unit - order priest to human priest - heal picked unit

custom script : call removelocation(udg_point)
custom script : call [B]removegroup[/B](udg_tempunitgroup)

the bold parts are wrong.
1) Oo you set a unit group to 1 unit? why?
2) it got to be DestroyGroup instead of RemoveGroup
 

LightChaosma

New Member
Reaction score
60
@ accame
1
a unit can only heal one unit while using heal, this way it will heal all a random one every second

2
i'm used to copy these custom scripts, dont have WE open atm ;) i told it was handwritten right?
 

Accname

2D-Graphics enthusiast
Reaction score
1,464
however if you order the priest to just heal all units in the group it will heal one of them anyways.
and using your group variable twice like you did will leak.

and i just wanted to say that the custom script line is wrong for anybody who doesnt know how to remove leaks.
 

Renendaru

(Evol)ution is nothing without love.
Reaction score
309
If the priest is on auto-heal doesn't he always heal? I've seen some neutral passives do this all the time.
 

LightChaosma

New Member
Reaction score
60
hmm, yea you're right, that leaks if i use it like that.. didnt think of that..

i would rewrite it, but i have to go...
 

Exide

I am amazingly focused right now!
Reaction score
448
hmm, yea you're right, that leaks if i use it like that.. didnt think of that..

i would rewrite it, but i have to go...

Besides, my trigger is enough. :rolleyes:
 

Accname

2D-Graphics enthusiast
Reaction score
1,464
Code:
Healing
    Events
        Time - Every 2.00 seconds of game time
    Conditions
    Actions
        Set healerloc = (Position of Healer)
        Set healgroup = (Units within 600.00 of healerloc matching (((Owner of (Matching unit)) is an ally of (Owner of Healer)) Equal to True)) and (Life of (Picked unit)) Less than (Max.Life of (Picked unit))
        Unit Group - Pick every unit in healgroup and do (Actions)
            Loop - Actions
                Unit - Order Healer to Human Paladin - Holy Light (Picked unit)
        Custom script:   call RemoveLocation(udg_healerloc)
        Custom script:   call DestroyGroup(udg_healgroup)
Code:
Wander
    Events
        Time - Every 2.00 seconds of game time
    Conditions
    Actions
        Set wandergroup = (Units in (Playable map area) owned by Neutral Hostile)
        Unit Group - Pick every unit in wandergroup and do (Actions)
            Loop - Actions
                Set wanderloc = (Random point in [B](Playable map area)[/B])
                Unit - Order (Picked unit) to Attack-Move To wanderloc
                Custom script:   call RemoveLocation(udg_wanderloc)
        Custom script:   call DestroyGroup(udg_wandergroup)
@ i optimized the first trigger a little bit because your priest would only heal the unit if it got less then 500 lifepoints, now it will heal every unit which is damaged. (unit with 300 life points max would have been healed by the priest!)

for the wander effect, Tornado(wanderer) is an option, you can set the area where the creep will walk around and the creep will attack an enemy if it comes too close. The bad side is, the collision of the creep will be set off if it got this ability. (the creep will be able to walk through units/trees/cliffs/etc...)

Neutral Wander is another option but as far as i remember your creep wont stop moving around even in battle, and that could make them much weaker if they start running around all 3 seconds...

Well triggering is another way, use the trigger of Exide but change the area a little bit or your creeps will run around the whole map.
 

Exide

I am amazingly focused right now!
Reaction score
448
Your, so called, optimized trigger will make the healer heal units that has anywhere between 1 and (max hp -1) current hp.
-Which means it will, most likely, waste mana of the healer by healing units that have 950 / 1000 hp, and then have no mana to heal the second unit that has 450 / 1000 hp.
But whatever. :p
 

Accname

2D-Graphics enthusiast
Reaction score
1,464
its a passive priest, i assume it got infinite mana points, but if you want i could create a trigger which forces the priest to heal the unit which is damaged most.
 

LightChaosma

New Member
Reaction score
60
looking at what exide said, this should be the "perfect" trigger:
Code:
thehelperskillmaketrigger
    Events
        Time - Every 1.00 seconds of game time
    Conditions
    Actions
        Set temp_point[1] = (Position of (priest))
        Set temp_unitG[1] = (Units within 900.00 of temp_point[1] matching (((Owner of (Matching unit)) is an ally of (Owner of (priest))) Equal to True))
        Set temp_int[1] = (Number of units in temp_unitG[1])
        Set temp_real[2] = 1000000000.00
        For each (Integer A) from 1 to temp_int[1], do (Actions)
            Loop - Actions
                Set temp_unitG[2] = (Random 1 units from temp_unitG[1])
                Unit Group - Pick every unit in temp_unitG[2] and do (Actions)
                    Loop - Actions
                        Set temp_unit[1] = (Picked unit)
                        Unit Group - Remove temp_unit[1] from temp_unitG[1]
                Custom script:   call DestroyGroup (udg_temp_unitG[2])
                Set temp_real[1] = (Life of temp_unit[1])
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        temp_real[1] Less than temp_real[2]
                    Then - Actions
                        Set temp_real[2] = temp_real[1]
                        Set temp_unit[2] = temp_unit[1]
                    Else - Actions
        Unit - Order (priest) to Human Priest - Heal temp_unit[2]
        Custom script:   call DestroyGroup (udg_temp_unitG[1])
        Custom script:   call RemoveLocation(udg_temp_point[1])

1 question, does the remove unit from unitgroup make a leak?
 

Exide

I am amazingly focused right now!
Reaction score
448
I have no idea what you've done with that trigger. :p

-Your trigger will probably malfunction and might leak.
-There is no (Triggering Unit) in this trigger, so it won't work at all.

Just use my trigger and save yourself the trouble. :p
 

LightChaosma

New Member
Reaction score
60
triggering unit needs t o be replaced with that priest, was too lame to make a priest:p

EDIT:
changed that

-- why would it malfunction?
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top