• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.
  • The Hive's 22nd Icon Contest: Creep Abilities is now concluded, time to vote for your favourite set of icons! Click here to vote!
  • ✅ The POLL for Hive's Texturing Contest #34 is OPEN! Vote for the TOP 3 SKINS! 🔗Click here to cast your vote!
  • ✅ The POLL for Hive's Techtree Contest #20 is OPEN! Vote for the TOP 3 FACTIONS! 🔗Click here to cast your vote!

[Trigger] Triggers for Income Lagg

Status
Not open for further replies.
Level 4
Joined
Jul 22, 2012
Messages
72
Ok I have a trigger that works fine and dosn't leak but every minute when u get you income It laggs, is there anyway I can fix this? (I have about 60 points that give u gold per min, and I need them all in my map)
 
ok here ya go I have 3 triggers for each point.

Events-Map Intialization
Conditions
actions
Custom Script: set bj_wantsDestroyGroup=true
Units Group-Pick Every Unit in (Playable Map Area) Matching ((Unit Type of (Matching Unit))Equal to(Unit type ____))) And Do Actions)
Loop Actions
Trigger-Add to ____ The Event(Unit -(Picked Unit) Takes Damage)
 
Next Trigger is

Events
Unit- _______ Life becomes less then 0.00
Conditions
(Life of _______) Less Then 50.00
Actions
Units Change ownership of _____ To (Owner of damage sorce)) and Change Color
Unit-Set life of _____ to 100.00%
 
And last but not least
Event
Time=Every 60.00 seconds of game time.
Conditions
Actions
Player group- Pick player in (All player) and do (actions)
Loos Action
Custom Script: set bj_wantDestroyGroup=true
unit Group-Pick every unit in (Units in((Playable map area) Matching ((Unit type of(Matchign unit)) Equal to _____)) and do (Actions)
Loop actions
Player add 30 to (Owner of ____) Current gold
 
Post them in [TRIGGER][/TRIGGER] tags to look like this:

  • WHATEVER NAME THIS TRIGGER IS
    • Events
      • Map Initialization
    • Conditions
    • Actions
      • Custom script: set bj_wantsDestroyGroup=true
      • Unit Group - Pick Every Unit in (Playable Map Area) Matching ((Unit Type of (Matching Unit))Equal to(Unit type ____))) And Do Actions)
        • Loop - Actions
          • Trigger - Add to ____ The Event(Unit -(Picked Unit) Takes Damage)
  • YOUR NEXT TRIIGER
    • Events
      • Unit - _______ Life becomes less then 0.00
    • Conditions
      • (Life of _______) Less than 50.00
    • Actions
      • Unit - Change ownership of _____ To (Owner of damage sorce)) and Change Color
      • Unit - Set life of _____ to 100.00%
Right Click the name of the trigger in the right panel in the trigger editor then select 'Copy As Text' from the dropdown menu then CTRL+V between [TRIGGER][/TRIGGER] tags.
 
Reduce the complexity of the income system. Many people foolishly make them O(n) as they iterate through lots of units possibly even multiple times. If you keep track of the number of a unit type in a variable then you can perform an income operation with a complexity of O(1) by deferring counting to events such as unit creating and death. The counting also becomes more simple as you already know how many units existed before the event occurred.
 
Gilnease Trigger
Events
Map initialization
Conditions
Actions
Custom script: set bj_wantDestroyGroup = true
Unit Group - Pick every unit in (Units in (Playable map area) matching ((Unit-type of (Matching unit)) Equal to (Unit-type of Gilneas/30g a min 1157 <gen>))) and do (Actions)
Loop - Actions
Trigger - Add to Gilnease <gen> the event (Unit - (Picked unit) Takes damage)



Gilnease
Events
Unit - Gilneas/30g a min 1157 <gen>'s life becomes Less than 0.00
Conditions
(Life of Gilneas/30g a min 1157 <gen>) Less than 50.00
Actions
Unit - Change ownership of Gilneas/30g a min 1157 <gen> to (Owner of (Damage source)) and Change color
Unit - Set life of Gilneas/30g a min 1157 <gen> to 100.00%



Ilnease
Events
Time - Every 60.00 seconds of game time
Conditions
Actions
Player Group - Pick every player in (All players) and do (Actions)
Loop - Actions
Custom script: set bj_wantDestroyGroup = true
Unit Group - Pick every unit in (Units in (Playable map area) matching ((Unit-type of (Matching unit)) Equal to Gilneas/30g a min)) and do (Actions)
Loop - Actions
Player - Add 30 to (Owner of Gilneas/30g a min 1157 <gen>) Current gold
 
You keep track of the number of units in an integer variable. If it is per player then use an array where the index represents the player slot number. When a unit of the appropriate type enters the world you increment the variable. When a unit of the appropriate type dies you decrement the variable. You can then periodically use the variable to calculate the income from.
 
I still Don't get it, The Trigger is just for A place like, a control point, and when u take it, it gives you (Gold) per min dosn't matter about units. So If u took stormwind u get 50g a min no matter what unless a differnt team (or Player) takes it from you. So do I need to delete one of the triggers or what?
 
Last edited:
Any chance u could help me with one? I am using normal world editor, and Just want A basic income system, where u get 25g a min from that place unless taken from you, and Gets full health when u take it and becomes ur's. Guess Someone told me wrong trigger then = (
 
Last edited:
Use a global integer array to map strategy points owned to player slot number (index into array is player slot number). Every time a player gains a strategy point you increment the variable for the player by 1. Every time a player loses a strategy point you decrement the variable for the player by 1. Every 60 seconds you iterate through all players and add 25 times the number stored in the array to gold for that player.
 
Status
Not open for further replies.
Back
Top