HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

options to replace periodic triggers

05-04-2006, 05:28 AM#1
Mystic Prophet
ok I have a couple triggers in my map that are essential to gameplay but run far too often.

This first one constantly sets a variable so that if any hero changes via metamorphasis or repicking. it'll still reference the players hero. It's a horrible trigger though, as it would be launching every time the hero is ordered around, and causes a lot of lag.

Trigger:
Set Unit Hero
Collapse Events
Unit- a unit is issued an order targeting a point
Collapse conditions
((triggering unit) is a hero) equal to true
Collapse Actions
Set Unit_Hero[(player number of (owner of (triggering unit)))]=(triggering unit)

that trigger makes gag me every time i see it, i've come up with a possible solution, but I'm worried it might cause some problems. I was thinking that instead of using a variable such as unit hero. I'd just use random unit owned by player matching condition. like this...

Trigger:
player- set the current research level of summon upgrade to((Hero level of (random unit from(units owned by (picked player) matching ((matching unit) is a hero) equal to true)))/2) for (picked player)

but that just seems sloppy and looks like it might cause even more problems even though each player only has one hero, so it's bound to select the right one.

other idea that doesn't seem very good to me (all units in playable map area matching (matching unit is a hero) and (matching unit owned by picked player)

Anyone know of a better way to reference a generic hero that isnt preplaced?
It would be much apreciated.
05-04-2006, 06:29 AM#2
illlusion
could you explain more about the situations in the game? like when and how the hero owned by certain player will change
05-04-2006, 07:15 AM#3
vile
I see no real cause for a lag when setting a variable when the hero is ordered. I do that myself on my map and it gets no lags.
05-04-2006, 09:04 AM#4
Mystic Prophet
hmm ok then maybe my problem is figuring out what's making my map lag, cause I went through and fixed (or at least I think I did) all the leaks and I thought that the lag was fixed until I tried playing it multiplayer)

would adding events to about 50 triggers every time a unit enters the map cause lag? (this would trigger every time a unit is respawned which happens 30 seconds after it dies) so I don't see much reason for this to lag either.

so that leaves my devotion aura triggers. I thought I tried it with those disabled but now that I think about it, I don't think I did. I tried to make a stat based devotion aura spell and eventually managed to come up with a crude non MUI way to do it. unfortunately it involves 4 triggers to run smoothly, 3 of which run every second.

Trigger:
Collapse Devotion Aura Buff
Collapse Events
Time - Every 1.00 seconds of game time
Collapse Conditions
(UNIT_Devotion[1] is A Hero) Equal to True
Collapse Actions
Collapse Unit Group - Pick every unit in (Units within 900.00 of (Position of UNIT_Devotion[1]) matching ((((Matching unit) belongs to an ally of Player 1 (Red)) Equal to True) and (((Custom value of (Matching unit)) Not equal to 3) and ((((Matching unit) is A structure) Equal to False) and ((Matching unit) not equal to Unit_Devotion[1])) and do (Actions)
Collapse Loop - Actions
Unit - Set the custom value of (Picked unit) to 3
Advanced - For (Picked unit) Increase defense by (((Intelligence of UNIT_Devotion[1] (Include bonuses)) / 10) x (Level of Devotion Aura for UNIT_Devotion[1]))
Collapse Devotion Aura Stop
Collapse Events
Time - Every 1.00 seconds of game time
Collapse Conditions
(UNIT_Devotion[1] is A Hero) Equal to True
Collapse Actions
Collapse Unit Group - Pick every unit in (Units in (Playable map area)(((Is (Matching unit) near UNIT_Devotion[1] and withing a range of 900.00) Equal to False) and ((Custom value of (Matching unit)) Equal to 3))) and do (Actions)
Collapse Loop - Actions
Unit - Set the custom value of (Picked unit) to 0
Advanced - For (Picked unit) Decrease defense by (((Intelligence of UNIT_Devotion[1] (Include bonuses)) / 10) x (Level of Devotion Aura for UNIT_Devotion[1]))
Collapse Devotion Aura Level
Collapse Events
Unit - A unit Learns a skill
Collapse Conditions
(Learned Hero Skill) Equal to Devotion Aura
(Triggering unit) Equal to UNIT_Devotion[1]
Collapse Actions
Collapse Unit Group - Pick every unit in (Units within 900.00 of (Position of UNIT_Devotion[1]) matching ((((Matching unit) belongs to an ally of Player 1 (Red)) Equal to True) and (((Matching unit) is A structure) Equal to False))) and do (Actions)
Collapse Loop - Actions
Advanced - For (Picked unit) Increase defense by (((Intelligence of UNIT_Devotion[1] (Include bonuses)) / 10) x (Level of Devotion Aura for UNIT_Devotion[1]))
Advanced - For (Picked unit) Decrease defense by aura[1]
Set aura[1] = (((Intelligence of UNIT_Devotion[1] (Include bonuses)) / 10) x (Level of Devotion Aura for UNIT_Devotion[1]))
Collapse Devotion Check
Collapse Events
Time - Every 1.00 seconds of game time
Collapse Conditions
(UNIT_Devotion[1] is A Hero) Equal to True
Collapse Actions
Wait until (aura[1] Less than (((Intelligence of UNIT_Devotion[1] (Include bonuses)) / 10) x (Level of Devotion Aura for UNIT_Devotion[1]))), checking every 1.00 seconds
Trigger - Run Devotion Aura Level <gen> (ignoring conditions)

I'll check it out myself as soon as I can get a tester. I know those triggers are rediculously long but if anyone else has any ideas on how to trigger devotion aura as an ability. It would be great.
05-04-2006, 09:13 AM#5
vile
Eh, yea that could cause lags, however I dont even know what the world editor unlimited exactly is doing when it changes armor. If I were you I wouldnt be using world editor unlimited. There is nothing world editor cant do that WEU can. It fucked up my map once anyways.
05-04-2006, 08:38 PM#6
Mystic Prophet
well from what I know its accessing several custom abilities with its own premade variables, and running some functions in the custom script that runs before variables are set (the one in the map name on the trigger editor).

But ya I know you can do anything on warcraft editor that WEU can, but WEU is quite helpful. And until I go about learning jass, I think I'm going to hang onto it.

thanks for your help mate.