• 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.

[Trigger] (HELP) Suspect lagging trigger

Status
Not open for further replies.
Level 7
Joined
Jan 1, 2005
Messages
133
ive started some beta testing of my sc maps and ive come accross some very bad lag issues when playing a protoss and i think its due to the new shield trigger ive new added.

Now ive done a leak check and its come up with 0 leaks but i think the trigger is creating lag by other means not due to leaks. If anyone knows what i need to do please let me know asap.

heres the trigger as it is.
  • Self Shield
    • Events
      • Time - Elapsed game time is 2.00 seconds
      • Unit - A unit enters (Playable map area)
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of (Entering unit)) Equal to Protoss Nexus (1)
        • Then - Actions
          • Set guy = (Entering unit)
          • Custom script: call CreateShieldEx(udg_guy,750,-1,0,0.44,0,"|cFF3232FF",true)
        • Else - Actions
          • Do nothing
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of (Entering unit)) Equal to Protoss Nexus (2)
        • Then - Actions
          • Wait 120.00 seconds
          • Set guy = (Entering unit)
          • Custom script: call CreateShieldEx(udg_guy,750,-1,0,0.44,0,"|cFF3232FF",true)
        • Else - Actions
          • Do nothing
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of (Entering unit)) Equal to Protoss Pylon
        • Then - Actions
          • Wait 30.00 seconds
          • Set guy = (Entering unit)
          • Custom script: call CreateShieldEx(udg_guy,200,-1,0,0.44,0,"|cFF3232FF",true)
        • Else - Actions
          • Do nothing
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of (Entering unit)) Equal to Protoss Assimilator
        • Then - Actions
          • Wait 40.00 seconds
          • Set guy = (Entering unit)
          • Custom script: call CreateShieldEx(udg_guy,250,-1,0,0.44,0,"|cFF3232FF",true)
        • Else - Actions
          • Do nothing
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of (Entering unit)) Equal to Protoss Gateway
        • Then - Actions
          • Wait 60.00 seconds
          • Set guy = (Entering unit)
          • Custom script: call CreateShieldEx(udg_guy,500,-1,0,0.44,0,"|cFF3232FF",true)
        • Else - Actions
          • Do nothing
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of (Entering unit)) Equal to Protoss Cybernetics Core
        • Then - Actions
          • Wait 60.00 seconds
          • Set guy = (Entering unit)
          • Custom script: call CreateShieldEx(udg_guy,550,-1,0,0.44,0,"|cFF3232FF",true)
        • Else - Actions
          • Do nothing
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of (Entering unit)) Equal to Protoss Forge
        • Then - Actions
          • Wait 40.00 seconds
          • Set guy = (Entering unit)
          • Custom script: call CreateShieldEx(udg_guy,550,-1,0,0.44,0,"|cFF3232FF",true)
        • Else - Actions
          • Do nothing
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of (Entering unit)) Equal to Protoss Photon Cannon
        • Then - Actions
          • Wait 50.00 seconds
          • Set guy = (Entering unit)
          • Custom script: call CreateShieldEx(udg_guy,125,-1,0,1,0,"|cFF3232FF",true)
        • Else - Actions
          • Do nothing
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of (Entering unit)) Equal to Protoss Citadel of Adun
        • Then - Actions
          • Wait 60.00 seconds
          • Set guy = (Entering unit)
          • Custom script: call CreateShieldEx(udg_guy,450,-1,0,0.44,0,"|cFF3232FF",true)
        • Else - Actions
          • Do nothing
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of (Entering unit)) Equal to Protoss Stargate
        • Then - Actions
          • Wait 70.00 seconds
          • Set guy = (Entering unit)
          • Custom script: call CreateShieldEx(udg_guy,600,-1,0,0.44,0,"|cFF3232FF",true)
        • Else - Actions
          • Do nothing
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of (Entering unit)) Equal to Protoss Robotics Facility
        • Then - Actions
          • Wait 80.00 seconds
          • Set guy = (Entering unit)
          • Custom script: call CreateShieldEx(udg_guy,450,-1,0,0.44,0,"|cFF3232FF",true)
        • Else - Actions
          • Do nothing
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of (Entering unit)) Equal to Protoss Probe
        • Then - Actions
          • Set guy = (Entering unit)
          • Custom script: call CreateShieldEx(udg_guy,20,-1,0,0.44,0,"|cFF3232FF",true)
        • Else - Actions
          • Do nothing
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of (Entering unit)) Equal to Protoss Carrier
        • Then - Actions
          • Set guy = (Entering unit)
          • Custom script: call CreateShieldEx(udg_guy,150,-1,0,0.44,0,"|cFF3232FF",true)
        • Else - Actions
          • Do nothing
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of (Entering unit)) Equal to Protoss Observer
        • Then - Actions
          • Set guy = (Entering unit)
          • Custom script: call CreateShieldEx(udg_guy,40,-1,0,0.44,0,"|cFF3232FF",true)
        • Else - Actions
          • Do nothing
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of (Entering unit)) Equal to Protoss Vindiccator
        • Then - Actions
          • Set guy = (Entering unit)
          • Custom script: call CreateShieldEx(udg_guy,90,-1,0,0.44,0,"|cFF3232FF",true)
        • Else - Actions
          • Do nothing
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of (Entering unit)) Equal to Protoss Scout
        • Then - Actions
          • Set guy = (Entering unit)
          • Custom script: call CreateShieldEx(udg_guy,100,-1,0,0.44,0,"|cFF3232FF",true)
        • Else - Actions
          • Do nothing
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of (Entering unit)) Equal to Protoss Dark Templar
        • Then - Actions
          • Set guy = (Entering unit)
          • Custom script: call CreateShieldEx(udg_guy,80,-1,0,0.44,0,"|cFF3232FF",true)
        • Else - Actions
          • Do nothing
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of (Entering unit)) Equal to Protoss Zealot
        • Then - Actions
          • Set guy = (Entering unit)
          • Custom script: call CreateShieldEx(udg_guy,60,-1,0,0.44,0,"|cFF3232FF",true)
        • Else - Actions
          • Do nothing
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of (Entering unit)) Equal to Protoss Dragoon
        • Then - Actions
          • Set guy = (Entering unit)
          • Custom script: call CreateShieldEx(udg_guy,80,-1,0,0.44,0,"|cFF3232FF",true)
        • Else - Actions
          • Do nothing
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of (Entering unit)) Equal to Protoss Shuttle
        • Then - Actions
          • Set guy = (Entering unit)
          • Custom script: call CreateShieldEx(udg_guy,60,-1,0,0.44,0,"|cFF3232FF",true)
        • Else - Actions
          • Do nothing
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of (Entering unit)) Equal to Protoss Reaver
        • Then - Actions
          • Set guy = (Entering unit)
          • Custom script: call CreateShieldEx(udg_guy,80,-1,0,0.44,0,"|cFF3232FF",true)
        • Else - Actions
          • Do nothing
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of (Entering unit)) Equal to Protoss Interceptor
        • Then - Actions
          • Set guy = (Entering unit)
          • Custom script: call CreateShieldEx(udg_guy,40,-1,0,0.44,0,"|cFF3232FF",true)
        • Else - Actions
          • Do nothing
      • -------- CreateShieldEx takes unit target, real shieldhp, real duration, integer buffId, real regenerate, real armor, string color, boolean dmgspill --------
      • -------- Target = Guy --------
      • -------- Shield Hitpoints = 300 --------
      • -------- Duration = -1 (Indestructable) --------
      • -------- Buff = None (not using buff cuz shield is indestructable) --------
      • -------- Regeneration = 3 HP per second --------
      • -------- Armor = 0 (reduce 0% dmg taken) --------
      • -------- Color = |cFF3232FF (Blue) --------
      • -------- Damage Spill = Yes --------
 
Last edited:
Level 29
Joined
Jul 29, 2007
Messages
5,174
Please put trigger tags !

[trig.ger]Your Trigger[/trig.ger] - without the dots.


I didn't really get the point of this trigger but what is the function your custom script calls to ? - ok saw it.

[Tip] a more useful way to create triggers such as this are loops with arrayed variables, if you don't know how to make those - ask and ill help.

I don't think a trigger like this can be the source of lag.
It isn't efficient but it can't lag your game, you need a much bigger thing to lag it.
 
Level 7
Joined
Jan 1, 2005
Messages
133
Please put trigger tags !

[trig.ger]Your Trigger[/trig.ger] - without the dots.


I didn't really get the point of this trigger but what is the function your custom script calls to ? - ok saw it.

[Tip] a more useful way to create triggers such as this are loops with arrayed variables, if you don't know how to make those - ask and ill help.

I don't think a trigger like this can be the source of lag.
It isn't efficient but it can't lag your game, you need a much bigger thing to lag it.

Thanx for answering my thread ghostwolf, yeh ive fixed the trigger coding, didnt know how to do it sry about that. Ok then mayb its something else in the maps.:( ive got around 76 triggers in the map but its only openable by WE unlimited due to a very large advance trigger which needs the advance trigger functions of that editor. Would u be able to check all the triggers for me if u have time to ghost??
 
Level 29
Joined
Jul 29, 2007
Messages
5,174
Here's a key word for you - advanced.

Most (I don't know if all, I don't use WEU) of the "Advanced" actions leak and are inefficient by what I heard from other people.
Thats most likely the cause of your lag.

If I would be able to open it I wouldn't care to look at it, but, as I said, I don't use WEU :/
 
Level 19
Joined
Aug 24, 2007
Messages
2,888
he still cant type [trigger][/trigger]
anyway

Make two different triggers you are ruining the game
remove do nothings
anyway it wont work properly with GUI (you are using Waits)
 
Level 21
Joined
Aug 21, 2005
Messages
3,699
Also, you might want to put the other if/then/else actions in the else action of the previous action.
This way, if the entering unit was one of the "earlier" units, it won't run all the other actions.

If you decide to do this, make sure you put the frequently built units on top (e.g. Zealot) and the less frequent units on the bottom.
 
Level 7
Joined
Jan 1, 2005
Messages
133
ah cheers for the advice guys. Ill get onto the changes suggested right away.

This is how the trigger looks now (hopefully this is what you guys wanted me to do;

  • Self Shield
    • Events
      • Time - Elapsed game time is 2.00 seconds
      • Unit - A unit enters (Playable map area)
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of (Entering unit)) Equal to Protoss Probe
        • Then - Actions
          • Set guy = (Entering unit)
          • Custom script: call CreateShieldEx(udg_guy,20,-1,0,0.44,0,"|cFF3232FF",true)
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Unit-type of (Entering unit)) Equal to Protoss Pylon
            • Then - Actions
              • Wait 60.00 seconds
              • Set guy = (Entering unit)
              • Custom script: call CreateShieldEx(udg_guy,200,-1,0,0.44,0,"|cFF3232FF",true)
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Unit-type of (Entering unit)) Equal to Protoss Zealot
                • Then - Actions
                  • Set guy = (Entering unit)
                  • Custom script: call CreateShieldEx(udg_guy,60,-1,0,0.44,0,"|cFF3232FF",true)
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Unit-type of (Entering unit)) Equal to Protoss Photon Cannon
                    • Then - Actions
                      • Wait 35.00 seconds
                      • Set guy = (Entering unit)
                      • Custom script: call CreateShieldEx(udg_guy,125,-1,0,1,0,"|cFF3232FF",true)
                    • Else - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • (Unit-type of (Entering unit)) Equal to Protoss Dragoon
                        • Then - Actions
                          • Set guy = (Entering unit)
                          • Custom script: call CreateShieldEx(udg_guy,80,-1,0,0.44,0,"|cFF3232FF",true)
                        • Else - Actions
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • (Unit-type of (Entering unit)) Equal to Protoss Carrier
                            • Then - Actions
                              • Set guy = (Entering unit)
                              • Custom script: call CreateShieldEx(udg_guy,150,-1,0,0.44,0,"|cFF3232FF",true)
                            • Else - Actions
                              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                • If - Conditions
                                  • (Unit-type of (Entering unit)) Equal to Protoss Interceptor
                                • Then - Actions
                                  • Set guy = (Entering unit)
                                  • Custom script: call CreateShieldEx(udg_guy,40,-1,0,0.44,0,"|cFF3232FF",true)
                                • Else - Actions
                                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                    • If - Conditions
                                      • (Unit-type of (Entering unit)) Equal to Protoss Gateway
                                    • Then - Actions
                                      • Wait 33.00 seconds
                                      • Set guy = (Entering unit)
                                      • Custom script: call CreateShieldEx(udg_guy,500,-1,0,0.44,0,"|cFF3232FF",true)
                                    • Else - Actions
                                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                        • If - Conditions
                                          • (Unit-type of (Entering unit)) Equal to Protoss Stargate
                                        • Then - Actions
                                          • Wait 60.00 seconds
                                          • Set guy = (Entering unit)
                                          • Custom script: call CreateShieldEx(udg_guy,600,-1,0,0.44,0,"|cFF3232FF",true)
                                        • Else - Actions
                                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                            • If - Conditions
                                              • (Unit-type of (Entering unit)) Equal to Protoss Scout
                                            • Then - Actions
                                              • Set guy = (Entering unit)
                                              • Custom script: call CreateShieldEx(udg_guy,100,-1,0,0.44,0,"|cFF3232FF",true)
                                            • Else - Actions
                                              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                                • If - Conditions
                                                  • (Unit-type of (Entering unit)) Equal to Protoss Vindiccator
                                                • Then - Actions
                                                  • Set guy = (Entering unit)
                                                  • Custom script: call CreateShieldEx(udg_guy,90,-1,0,0.44,0,"|cFF3232FF",true)
                                                • Else - Actions
                                                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                                    • If - Conditions
                                                      • (Unit-type of (Entering unit)) Equal to Protoss Dark Templar
                                                    • Then - Actions
                                                      • Set guy = (Entering unit)
                                                      • Custom script: call CreateShieldEx(udg_guy,80,-1,0,0.44,0,"|cFF3232FF",true)
                                                    • Else - Actions
                                                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                                        • If - Conditions
                                                          • (Unit-type of (Entering unit)) Equal to Protoss Observer
                                                        • Then - Actions
                                                          • Set guy = (Entering unit)
                                                          • Custom script: call CreateShieldEx(udg_guy,40,-1,0,0.44,0,"|cFF3232FF",true)
                                                        • Else - Actions
                                                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                                            • If - Conditions
                                                              • (Unit-type of (Entering unit)) Equal to Protoss Shuttle
                                                            • Then - Actions
                                                              • Set guy = (Entering unit)
                                                              • Custom script: call CreateShieldEx(udg_guy,60,-1,0,0.44,0,"|cFF3232FF",true)
                                                            • Else - Actions
                                                              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                                                • If - Conditions
                                                                  • (Unit-type of (Entering unit)) Equal to Protoss Reaver
                                                                • Then - Actions
                                                                  • Set guy = (Entering unit)
                                                                  • Custom script: call CreateShieldEx(udg_guy,80,-1,0,0.44,0,"|cFF3232FF",true)
                                                                • Else - Actions
                                                                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                                                    • If - Conditions
                                                                      • (Unit-type of (Entering unit)) Equal to Protoss Robotics Facility
                                                                    • Then - Actions
                                                                      • Wait 60.00 seconds
                                                                      • Set guy = (Entering unit)
                                                                      • Custom script: call CreateShieldEx(udg_guy,450,-1,0,0.44,0,"|cFF3232FF",true)
                                                                    • Else - Actions
                                                                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                                                        • If - Conditions
                                                                          • (Unit-type of (Entering unit)) Equal to Protoss Nexus (1)
                                                                        • Then - Actions
                                                                          • Set guy = (Entering unit)
                                                                          • Custom script: call CreateShieldEx(udg_guy,750,-1,0,0.44,0,"|cFF3232FF",true)
                                                                        • Else - Actions
                                                                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                                                            • If - Conditions
                                                                              • (Unit-type of (Entering unit)) Equal to Protoss Nexus (2)
                                                                            • Then - Actions
                                                                              • Wait 100.00 seconds
                                                                              • Set guy = (Entering unit)
                                                                              • Custom script: call CreateShieldEx(udg_guy,750,-1,0,0.44,0,"|cFF3232FF",true)
                                                                            • Else - Actions
                                                                              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                                                                • If - Conditions
                                                                                  • (Unit-type of (Entering unit)) Equal to Protoss Assimilator
                                                                                • Then - Actions
                                                                                  • Wait 33.00 seconds
                                                                                  • Set guy = (Entering unit)
                                                                                  • Custom script: call CreateShieldEx(udg_guy,250,-1,0,0.44,0,"|cFF3232FF",true)
                                                                                • Else - Actions
                                                                                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                                                                    • If - Conditions
                                                                                      • (Unit-type of (Entering unit)) Equal to Protoss Cybernetics Core
                                                                                    • Then - Actions
                                                                                      • Wait 50.00 seconds
                                                                                      • Set guy = (Entering unit)
                                                                                      • Custom script: call CreateShieldEx(udg_guy,550,-1,0,0.44,0,"|cFF3232FF",true)
                                                                                    • Else - Actions
                                                                                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                                                                        • If - Conditions
                                                                                          • (Unit-type of (Entering unit)) Equal to Protoss Forge
                                                                                        • Then - Actions
                                                                                          • Wait 33.00 seconds
                                                                                          • Set guy = (Entering unit)
                                                                                          • Custom script: call CreateShieldEx(udg_guy,550,-1,0,0.44,0,"|cFF3232FF",true)
                                                                                        • Else - Actions
                                                                                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                                                                            • If - Conditions
                                                                                              • (Unit-type of (Entering unit)) Equal to Protoss Citadel of Adun
                                                                                            • Then - Actions
                                                                                              • Wait 60.00 seconds
                                                                                              • Set guy = (Entering unit)
                                                                                              • Custom script: call CreateShieldEx(udg_guy,450,-1,0,0.44,0,"|cFF3232FF",true)
                                                                                            • Else - Actions
      • -------- CreateShieldEx takes unit target, real shieldhp, real duration, integer buffId, real regenerate, real armor, string color, boolean dmgspill --------
      • -------- Target = Guy --------
      • -------- Shield Hitpoints = 300 --------
      • -------- Duration = -1 (Indestructable) --------
      • -------- Buff = None (not using buff cuz shield is indestructable) --------
      • -------- Regeneration = 3 HP per second --------
      • -------- Armor = 0 (reduce 0% dmg taken) --------
      • -------- Color = |cFF3232FF (Blue) --------
      • -------- Damage Spill = Yes --------
 
Level 7
Joined
Jan 1, 2005
Messages
133
Update

OK i finally got a chance to beta test the new map with the improved Shield trigger and the lag still occured but not as quickly and not as baddly as before but any lag is a problem. I also had problem with the probe unit not recieving the shield effect at all and im not sure if its cuz its the first unit in the trigger.

I also had a look at another trigger i made and found a whole bunch of 'Do Nothing' actions so ive removed them now as well. Any ideas guys??
 
Level 29
Joined
Jul 29, 2007
Messages
5,174
First of all, can you please give us your shield code ?

Now about units not getting the shield, of course they won't.
If you for example create a "Protoss Pylon", you will now need to wait 60 seconds untill his shield is activated, now a "Photon Cannon" is suddenly created, you will remove the order from the Pylon to the Cannon and wait 35 seconds untill the Cannon gets it.
If yet another unit is now created, it will remove the order yet again but now from the Cannon to the next unit.

That is why you shouldn't use globals for this, you need locals which requires JASS.
If you know JASS, its a pretty easy trigger.
If not, I can make it for you, but still please post your shield code.
 
Level 7
Joined
Jan 1, 2005
Messages
133
ok i feel like an idiot ghost. I realised the reason the Probe wasnt getting the shield was becuase its based off an undead unit (so it creates the correct protoss build style) and as u asked me to add the condition is a race = NightElf. thats why it wasnt getting the shield. Also Eleandor yes the wait times are set so that the shield wont activate until the building is fully built.

Also i did some checking of all my triggers in the map and found a couple of 'Do Nothing' Actions so ive removed them but i dout it will make much difference.

Ghost i would greatly appreciate you making a Jass trigger for me of this trigger and if you do you'll be added to the credits list accordlying.

here is the Handle Varible coding the shield trigger uses in my maps. Not sure if there is any more coding for this but if u need the full custom script coding let me know. (sry dfont know how to post JASS trigger coding)

  • // Shield System
  • // By Shadow1500
  • // HandleVars by KaTTaNa
  • // configuration
  • constant function BarColor takes nothing returns string
    • return "|cFF8000FF"
  • endfunction
  • constant function BarChar takes nothing returns string
    • return "'"
  • endfunction
  • constant function BarLength takes nothing returns integer
    • return 20
  • endfunction
  • constant function BarSize takes nothing returns real
    • return 12.50
  • endfunction
  • constant function BarOffset takes nothing returns real
    • return -32.00
  • endfunction
  • constant function BarOffsetY takes nothing returns real
    • return -42.00
  • endfunction
  • constant function DeadFixerAbility takes nothing returns integer
    • return 'A00Z'
  • endfunction
  • constant function AllowDamageSpill takes nothing returns boolean
    • return true
  • endfunction //if true then when the shield breaks it will only block some of the damage done depending on its HP
  • // end configuration
  • function DamageModify_Child takes nothing returns nothing
    • local timer t = GetExpiredTimer()
    • local unit u = GetHandleUnit(t,"u")
    • if GetHandleBoolean(t,"fix") then
      • call UnitRemoveAbility( u, DeadFixerAbility() )
    • endif
    • call SetUnitState(u ,UNIT_STATE_LIFE, GetHandleReal(t,"finalhp") )
    • set u = null
    • call FlushHandleLocals(t)
    • call DestroyTimer(t)
    • set t = null
  • endfunction
  • // This function will "block" a certain amount of damage done to the unit
  • // Needs to be used in the EVENT_UNIT_DAMAGED event.
  • function DamageModify takes unit whichUnit, real dmg, real dmgnew returns nothing
    • local timer t = CreateTimer()
    • local real life = GetUnitState(whichUnit, UNIT_STATE_LIFE)
    • local real maxlife = GetUnitState(whichUnit, UNIT_STATE_MAX_LIFE)
    • local boolean usetimer = false
    • local real dmgback = dmg-dmgnew
    • local real finalhp = life-dmgnew
    • if dmgnew>dmg then
      • return
    • endif
    • if dmg > maxlife then
      • call UnitAddAbility( whichUnit,DeadFixerAbility())
      • call SetHandleBoolean(t, "fix", true)
      • set maxlife = 1000+maxlife
      • set usetimer = true
    • endif
    • if ( life+dmgback > maxlife ) then
      • call SetUnitState(whichUnit ,UNIT_STATE_LIFE, maxlife )
      • set usetimer = true
    • else
      • call SetUnitState(whichUnit ,UNIT_STATE_LIFE, life+dmgback )
    • endif
    • if usetimer then
      • call SetHandleHandle(t,"u",whichUnit)
      • call SetHandleReal(t,"finalhp",finalhp)
      • call TimerStart(t, 0, false, function DamageModify_Child)
    • else
      • call DestroyTimer(t)
    • endif
    • set t = null
  • endfunction
  • function UpdateBar takes unit whichUnit returns nothing
    • local string bar = GetHandleString(whichUnit,"scolor")
    • local integer y = 0
    • local real slife = GetHandleReal(whichUnit,"slife")
    • local real maxslife = GetHandleReal(whichUnit,"maxslife")
    • local boolean endc = false
    • loop
      • exitwhen y==BarLength()
      • if (not endc) and (slife < (y * (maxslife/BarLength()))+1) then
        • set endc = true
        • set bar = bar+"|r|cFF000000"
      • else
        • set bar = bar+BarChar()
      • endif
      • set y = y + 1
    • endloop
    • set bar = bar+"|r"
    • call SetTextTagTextBJ(GetHandleTextTag(whichUnit,"lifebar"),bar,BarSize())
  • endfunction
  • function DestroyShield takes unit whichUnit returns nothing
    • local texttag tag = GetHandleTextTag(whichUnit,"lifebar")
    • local trigger trig = GetHandleTrigger(whichUnit,"shielddmg")
    • local timer t = GetHandleTimer(whichUnit,"shieldtimer")
    • call SetHandleBoolean(whichUnit,"sd",false)
    • // destroy shield
    • call UnitRemoveAbility(whichUnit,GetHandleInt(t,"buff"))
    • call SetHandleReal(whichUnit,"slife",0)
    • call SetHandleReal(whichUnit,"maxslife",0)
    • call SetHandleReal(whichUnit,"reg",0)
    • call SetHandleReal(whichUnit,"sarmor",0)
    • call SetHandleString(whichUnit,"scolor",null)
    • // destroy tag
    • call DestroyTextTag(tag)
    • call SetHandleHandle( whichUnit, "lifebar", null )
    • set tag = null
    • // destoy trigger
    • call SetHandleHandle(whichUnit,"shielddmg",null)
    • call TriggerRemoveAction(trig,GetHandleTriggerAction(trig,"action"))
    • call FlushHandleLocals(trig)
    • call DestroyTrigger(trig)
    • set trig = null
    • // destroy timer
    • call SetHandleHandle(whichUnit,"shieldtimer",null)
    • call PauseTimer(t)
    • call FlushHandleLocals(t)
    • call DestroyTimer(t)
    • set t = null
  • endfunction
  • function ShieldDamage takes nothing returns nothing
    • local unit u = GetTriggerUnit()
    • local real dmg = GetEventDamage()
    • local real slife = GetHandleReal(u,"slife")
    • local real take = 1-GetHandleReal(u,"sarmor")
    • if GetTriggerEventId() == EVENT_UNIT_DEATH then
      • call DestroyShield(u)
      • set u = null
      • return
    • endif
    • if (slife<(dmg*take)) then
      • if GetHandleBoolean(u,"sd") then
        • call DestroyShield(u)
      • else
        • call SetHandleReal(u,"slife",0)
      • endif
      • if AllowDamageSpill() then
        • call DamageModify(u,dmg,dmg-(slife*(1/take))) // use the remaining power of the shield to block some of the damage
      • else
        • call DamageModify(u,dmg,0)
      • endif
    • else
      • call DamageModify(u,dmg,0) // block all damage
      • call SetHandleReal(u,"slife",slife-(dmg*take))
      • call UpdateBar(u)
    • endif
    • set u = null
  • endfunction
  • function CreateShield_Child takes nothing returns nothing
    • local timer t = GetExpiredTimer()
    • local unit whichUnit = GetHandleUnit(t,"u")
    • local texttag tag = GetHandleTextTag(whichUnit,"lifebar")
    • local real x = GetUnitX(whichUnit)+BarOffset()
    • local real y = GetUnitY(whichUnit)+BarOffsetY()
    • local integer pulse = GetHandleInt(t,"pulse")
    • local real upcheck = GetHandleReal(t,"check")
    • local real reg = GetHandleReal(whichUnit,"reg")
    • local real slife = GetHandleReal(whichUnit,"slife")
    • local real maxslife = GetHandleReal(whichUnit,"maxslife")
    • local integer buffId = GetHandleInt(t,"buff")
    • if (GetHandleBoolean(whichUnit,"sd") and pulse==0) or ((GetUnitAbilityLevel(whichUnit,buffId)==0) and buffId!=0) then
      • call DestroyShield(whichUnit)
      • set t = null
      • return
    • endif
    • if reg!=0 then
      • if (slife+reg)>=maxslife then
        • call SetHandleReal(whichUnit,"slife",maxslife)
      • else
        • call SetHandleReal(whichUnit,"slife",slife+reg)
      • endif
      • call UpdateBar(whichUnit)
    • elseif upcheck!=GetHandleReal(whichUnit,"slife") then
      • call SetHandleReal(t,"check",GetHandleReal(whichUnit,"slife"))
      • call UpdateBar(whichUnit)
    • endif
    • // countdown on how many times did timer ran
    • if pulse>0 then
      • call SetHandleInt(t,"pulse",pulse-1)
    • endif
    • call SetTextTagPos(tag,x,y,140)
    • call SetTextTagVisibility(tag,IsUnitVisible(whichUnit,GetLocalPlayer()))
    • set whichUnit = null
    • set tag = null
    • set t = null
  • endfunction
  • function CreateShieldEx takes unit target, real shieldhp, real duration, integer buffId, real regenerate, real armor, string color, boolean dmgspill returns nothing
    • // duration of -1 = shield remains on unit when depleted
    • // duration of 0 = shield stays on unit until depleted
    • // duration of 1 or higher = shield stays until depleted or until duration ends
    • // buffId is optional
    • // regenerate is the amount of points regenerated every second
    • // armor must be between 0 and 1, with 1 making the shield take no damage
    • // color must in blizzard's color code format
    • // when dmgspill is off the shield will block all damage when depleted
    • local texttag tag = GetHandleTextTag( target, "lifebar")
    • local trigger whenDamaged = GetHandleTrigger(target,"shielddmg")
    • local timer t = GetHandleTimer(target,"shieldtimer")
    • local boolean useOld = false
    • local real x = GetUnitX(target)+BarOffset()
    • local real y = GetUnitY(target)+BarOffsetY()
    • if GetHandleReal(target,"slife")!=0 then
      • if GetHandleInt(t,"buff")!=buffId then
        • call UnitRemoveAbility(target,GetHandleInt(t,"buff"))
      • endif
      • call PauseTimer(t)
      • call SetHandleReal(target,"reg",0)
      • call SetHandleReal(target,"sarmor",0)
      • call SetHandleString( target, "scolor", null)
      • call DestroyTextTag(tag)
      • set useOld = true
    • else
      • set t = CreateTimer()
      • set whenDamaged = CreateTrigger()
    • endif
    • set tag = CreateTextTag()
    • call SetHandleReal( target, "slife", shieldhp)
    • call SetHandleReal( target, "maxslife", shieldhp)
    • call SetHandleString( target, "scolor", color)
    • // take care of the texttag
    • call SetTextTagTextBJ(tag,"tag",BarSize())
    • call SetTextTagPos(tag,x,y,140)
    • call SetTextTagPermanent(tag,true)
    • call SetTextTagColor(tag,255,255,255,255)
    • call SetTextTagVisibility(tag,IsUnitVisible(target,GetLocalPlayer()))
    • call SetHandleHandle( target, "lifebar", tag )
    • call UpdateBar(target)
    • // take care of the trigger
    • if not useOld then
      • call TriggerRegisterUnitEvent(whenDamaged,target,EVENT_UNIT_DAMAGED)
      • call TriggerRegisterUnitEvent(whenDamaged,target,EVENT_UNIT_DEATH)
      • call SetHandleHandle(whenDamaged,"action",TriggerAddAction(whenDamaged,function ShieldDamage))
      • call SetHandleHandle(target,"shielddmg",whenDamaged)
    • endif
    • call SetHandleBoolean( whenDamaged, "dmgspill", dmgspill)
    • // take care of the timer
    • call SetHandleHandle( target, "shieldtimer", t)
    • call SetHandleHandle( t,"u",target)
    • call SetHandleReal( t, "check", shieldhp)
    • if regenerate!=0 then
      • call SetHandleReal(target,"reg",(regenerate)/(1/0.04))
    • endif
    • if armor!=0 then
      • call SetHandleReal(target,"sarmor",armor)
    • endif
    • call SetHandleInt(t,"pulse",-1)
    • if duration>=0 then
      • call SetHandleBoolean( target, "sd", true)
      • if duration>0 then
        • call SetHandleInt(t,"pulse",R2I(duration/0.04))
      • endif
    • endif
    • call SetHandleInt(t,"buff",buffId)
    • call TimerStart(t,0.04,true,function CreateShield_Child)
    • set whenDamaged = null
    • set t = null
    • set tag = null
  • endfunction
  • function CreateShield takes unit target, real shieldhp, real duration, integer buffId, real regenerate, real armor returns nothing
    • call CreateShieldEx( target, shieldhp, duration, buffId, regenerate, armor, BarColor(), AllowDamageSpill())
  • endfunction
  • function CreateShieldSimple takes unit target, real shieldhp, real duration, integer buffId returns nothing
    • call CreateShieldEx( target, shieldhp, duration, buffId, 0, 0, BarColor(), AllowDamageSpill())
  • endfunction
 
Level 7
Joined
Jan 1, 2005
Messages
133
Thats not your shield, its your trigger converted to custom script.

First of all, instead of Trigger tags put JASS tags (
JASS:
).

Now, you see that "call CreateShieldEx", that CreateShieldEx is the shield.

Show that function.

JASS:
function CreateShieldEx takes unit target, real shieldhp, real duration, integer buffId, real regenerate, real armor, string color, boolean dmgspill returns nothing
    // duration of -1 = shield remains on unit when depleted
    // duration of 0 = shield stays on unit until depleted
    // duration of 1 or higher = shield stays until depleted or until duration ends
    // buffId is optional
    // regenerate is the amount of points regenerated every second
    // armor must be between 0 and 1, with 1 making the shield take no damage
    // color must in blizzard's color code format
    // when dmgspill is off the shield will block all damage when depleted
    local texttag tag = GetHandleTextTag( target, "lifebar")
    local trigger whenDamaged = GetHandleTrigger(target,"shielddmg")
    local timer t = GetHandleTimer(target,"shieldtimer")
    local boolean useOld = false    
    local real x = GetUnitX(target)+BarOffset()
    local real y = GetUnitY(target)+BarOffsetY()

    if GetHandleReal(target,"slife")!=0 then
        if GetHandleInt(t,"buff")!=buffId then
            call UnitRemoveAbility(target,GetHandleInt(t,"buff"))
        endif
        call PauseTimer(t)
        call SetHandleReal(target,"reg",0)
        call SetHandleReal(target,"sarmor",0)
        call SetHandleString( target, "scolor", null)
        call DestroyTextTag(tag)
        set useOld = true
    else
        set t = CreateTimer()
        set whenDamaged = CreateTrigger()
    endif
    set tag = CreateTextTag()
    call SetHandleReal( target, "slife", shieldhp)
    call SetHandleReal( target, "maxslife", shieldhp)
    
    call SetHandleString( target, "scolor", color)
    
    // take care of the texttag
    call SetTextTagTextBJ(tag,"tag",BarSize())
    call SetTextTagPos(tag,x,y,140)
    call SetTextTagPermanent(tag,true)
    call SetTextTagColor(tag,255,255,255,255)
    call SetTextTagVisibility(tag,IsUnitVisible(target,GetLocalPlayer()))
    call SetHandleHandle( target, "lifebar", tag )
    call UpdateBar(target)
    
    // take care of the trigger
    if not useOld then
        call TriggerRegisterUnitEvent(whenDamaged,target,EVENT_UNIT_DAMAGED)
        call TriggerRegisterUnitEvent(whenDamaged,target,EVENT_UNIT_DEATH)
        call SetHandleHandle(whenDamaged,"action",TriggerAddAction(whenDamaged,function ShieldDamage))
        call SetHandleHandle(target,"shielddmg",whenDamaged)
    endif
    call SetHandleBoolean( whenDamaged, "dmgspill", dmgspill)

    // take care of the timer
    call SetHandleHandle( target, "shieldtimer", t)
    call SetHandleHandle( t,"u",target)
    call SetHandleReal( t, "check", shieldhp)
    if regenerate!=0 then
        call SetHandleReal(target,"reg",(regenerate)/(1/0.04))
    endif
    if armor!=0 then
        call SetHandleReal(target,"sarmor",armor)
    endif
    call SetHandleInt(t,"pulse",-1)
    if duration>=0 then
        call SetHandleBoolean( target, "sd", true)
        if duration>0 then
            call SetHandleInt(t,"pulse",R2I(duration/0.04)) 
        endif
    endif
    call SetHandleInt(t,"buff",buffId)
    
    call TimerStart(t,0.04,true,function CreateShield_Child)

    set whenDamaged = null
    set t = null
    set tag = null
endfunction
function CreateShield takes unit target, real shieldhp, real duration, integer buffId, real regenerate, real armor returns nothing
    call CreateShieldEx( target, shieldhp, duration, buffId, regenerate, armor, BarColor(), AllowDamageSpill())
endfunction
function CreateShieldSimple takes unit target, real shieldhp, real duration, integer buffId returns nothing
    call CreateShieldEx( target, shieldhp, duration, buffId, 0, 0, BarColor(), AllowDamageSpill())
endfunction

thats gotta be it, other then that i dont know what else your talking about. If you need my Handle Varible coding this is it.

JASS:
//*********************************************************************************************
//*
//*  Handle Variables
//*
//*********************************************************************************************

//=============================================================================================
//  Return Bug Exploiters
//=============================================================================================
function HandleVars_GetInt takes handle h returns integer
    return h
    return 0
endfunction

//=============================================================================================
function LocalVars takes nothing returns gamecache
     return udg_gamecache
endfunction

function SetHandleHandle takes handle subject, string name, handle value returns nothing
    if value==null then
        call FlushStoredInteger(LocalVars(),I2S(HandleVars_GetInt(subject)),name)
    else
        call StoreInteger(LocalVars(), I2S(HandleVars_GetInt(subject)), name, HandleVars_GetInt(value) )
    endif
endfunction

function SetHandleInt takes handle subject, string name, integer value returns nothing
    if value==0 then
        call FlushStoredInteger(LocalVars(),I2S(HandleVars_GetInt(subject)),name)
    else
        call StoreInteger(LocalVars(), I2S(HandleVars_GetInt(subject)), name, value)
    endif
endfunction

function SetHandleReal takes handle subject, string name, real value returns nothing
    if value==0 then
        call FlushStoredReal(LocalVars(), I2S(HandleVars_GetInt(subject)), name)
    else
        call StoreReal(LocalVars(), I2S(HandleVars_GetInt(subject)), name, value)
    endif
endfunction

function SetHandleString takes handle subject, string name, string value returns nothing
    if value==null then
        call FlushStoredString(LocalVars(), I2S(HandleVars_GetInt(subject)), name)
    else
        call StoreString(LocalVars(), I2S(HandleVars_GetInt(subject)), name, value)
    endif
endfunction
function SetHandleBoolean takes handle subject, string name, boolean value returns nothing
    if value==false then
        call FlushStoredBoolean(LocalVars(), I2S(HandleVars_GetInt(subject)), name)
    else
        call StoreBoolean(LocalVars(), I2S(HandleVars_GetInt(subject)), name, true )
    endif
endfunction

function GetHandleBoolean takes handle subject, string name returns boolean
    return GetStoredBoolean(LocalVars(), I2S(HandleVars_GetInt(subject)), name)
endfunction

function GetHandleHandle takes handle subject, string name returns handle
    return GetStoredInteger(LocalVars(), I2S(HandleVars_GetInt(subject)), name)
    return null
endfunction

function GetHandleInt takes handle subject, string name returns integer
    return GetStoredInteger(LocalVars(), I2S(HandleVars_GetInt(subject)), name)
endfunction

function GetHandleDestructable takes handle subject,string name returns destructable
    return GetHandleHandle(subject,name)
endfunction

function GetHandleLoc takes handle subject,string name returns location
    return GetHandleHandle(subject,name)
endfunction

function GetHandleReal takes handle subject, string name returns real
    return GetStoredReal(LocalVars(), I2S(HandleVars_GetInt(subject)), name)
endfunction

function GetHandleString takes handle subject, string name returns string
    return GetStoredString(LocalVars(), I2S(HandleVars_GetInt(subject)), name)
endfunction

function GetHandleUnit takes handle subject,string name returns unit
    return GetStoredInteger(LocalVars(), I2S(HandleVars_GetInt(subject)), name)
    return null
endfunction

function GetHandleTrigger takes handle subject,string name returns trigger
    return GetStoredInteger(LocalVars(), I2S(HandleVars_GetInt(subject)), name)
    return null
endfunction

function GetHandleTimer takes handle subject, string name returns timer
    return GetStoredInteger(LocalVars(), I2S(HandleVars_GetInt(subject)), name)
    return null
endfunction

function GetHandleEffect takes handle subject, string name returns  effect
    return GetStoredInteger(LocalVars(), I2S(HandleVars_GetInt(subject)), name)
    return null
endfunction

function GetHandleTextTag takes handle subject, string name returns  texttag
    return GetStoredInteger(LocalVars(), I2S(HandleVars_GetInt(subject)), name)
    return null
endfunction

function GetHandleTriggerAction takes handle subject, string name returns triggeraction
    return GetStoredInteger(LocalVars(), I2S(HandleVars_GetInt(subject)), name)
    return null
endfunction

function FlushHandleLocals takes handle subject returns nothing
    call FlushStoredMission(LocalVars(), I2S(HandleVars_GetInt(subject)) )
endfunction

function PylonCondition takes nothing returns boolean
    return ( GetUnitTypeId(GetFilterUnit()) == 'e007' )
endfunction
 
Level 29
Joined
Jul 29, 2007
Messages
5,174
Who put this there
Code:
function PylonCondition takes nothing returns boolean
    return ( GetUnitTypeId(GetFilterUnit()) == 'e007' )
endfunction


Whats the point of that standing there ?

Anyway, couldn't find anything but I don't know whats Texttags so... :/

Do you use "Advanced Actions" in your map ?

Oh and sorry, I just looked at your previous post and it is the shield, damd I feel like a idiot fooling you lol.
By the way, instead of making your trigger into JASS (not that its bad), you do know there is this event ?
  • Unit - A unit Finishes construction

And again by the way, can you tell me how you want the shield to work ? (I.E, will it be shown, will it have a certain color that can be changed, other things).
Not that you need it, but I wanna try and make one :)
 
Level 21
Joined
Aug 21, 2005
Messages
3,699
Anyway, couldn't find anything but I don't know whats Texttags so... :/
Floating texts.

you do know there is this event ?
I told him already

And again by the way, can you tell me how you want the shield to work ? (I.E, will it be shown, will it have a certain color that can be changed, other things).
I found out the system is downloadable in the spellssection, just search for "shield" and take the one made by that shadowguy. Either way, have you never played SC?

By testing the spell, I don't seem to have any lag. Does it still occur? Do you mind sharing the map without all models / non-related triggers / non-related unit data?
 
Level 7
Joined
Jan 1, 2005
Messages
133
Who put this there
Code:
function PylonCondition takes nothing returns boolean
    return ( GetUnitTypeId(GetFilterUnit()) == 'e007' )
endfunction


Whats the point of that standing there ?

Thats part of the Plyon field trigger system that uses the advance editor actions i was talking about. This particalur trigger i was able to get from another map so i have nbo clue how it works. Yes I think i had shadow modify the shield system for me so it work for construsted units. The original spell was for a unit ingame. Atm i havent had time to test another beta map with the Do Nothing actions removed. Its possible there is another trigger causing the lag but i cant be sure. Ive never had this kind of lag problem before myself in any of the previous versions but since the last version ive added alot of new mateiral so its hard to pin point what could cause the lag. I think an edited openable map might make things easier for you guys. I really want some to check all the coding but it seems the fact i use WE unlimited no1 is interested in helping me.

Ghost if you make a Jass style trigger will be better then the current GUI trigger, and i mean will it run better and not create any glitches??? If it will work much better then i want it exactly the same as what i have atm. This shield system was implenement so i didnt need to use mana shield ability to create a shield effect.
 
Level 7
Joined
Jan 1, 2005
Messages
133
if i make a openable map and post it on here will some1 be able to check all the trigger cosding for me??? The map will only be openable via WE Unlimited cuz of the 'Advanced - Initialize advanced triggers' in the map initialisation trigger. Whoever does check and touch up my trigger coding will be credited for his/her work.
 
Level 7
Joined
Jan 1, 2005
Messages
133
ok i did some testing just before and ther map still has game lag and im getting worried as i dont know how to stop it from happening and theres no point releasing a map if the maps lags after 10 mins of play.

Here is the map file without all the models and skins etc. Please help me guys i really need this fixed ive also put a normal World editor version in as well just incase no1 is interested in the advance trigger error.
 

Attachments

  • (4)Neo Lost Temple v2.2(NoFiles).w3x
    409.4 KB · Views: 34
  • (4)Neo Lost Temple v2.2(NoAdvanceTrigger+NoFiles).w3x
    409.3 KB · Views: 70
Level 21
Joined
Aug 21, 2005
Messages
3,699
Ouch

Over 10 000 lines of script ONLY in the map header :p

Just a question: Did you make all the jass? Cause I fail to understand the neccesity of functions like
JASS:
function returnboolean takes boolean a returns boolean
return a
endfunction
A complete overhaul of all the functions might be welcome I think :)

I'm testing the map now. But I personally don't think there's any problems with the actual shieldfunction... Have you tried the map without the shieldfunction and did it lag less or not?

Hmm.. I tested it for about 5 minutes and I didn't notice any lag...
 
Level 7
Joined
Jan 1, 2005
Messages
133
Ouch

Over 10 000 lines of script ONLY in the map header :p

Just a question: Did you make all the jass? Cause I fail to understand the neccesity of functions like
JASS:
function returnboolean takes boolean a returns boolean
return a
endfunction
A complete overhaul of all the functions might be welcome I think :)

I'm testing the map now. But I personally don't think there's any problems with the actual shieldfunction... Have you tried the map without the shieldfunction and did it lag less or not?

Hmm.. I tested it for about 5 minutes and I didn't notice any lag...

Yeh its terrible isnt it. I dont have a clue what all that custom script coding is. That only appear when i activated the advance trigger function of the WE Unlimited which i needed to do for the plyon field trigger system. I have thought about deleting all that coding but i dunno what that would do to the map. Anyways i appreicate you looking at the map coding for me Eleandor. Ive got a feeling you wont find any lag in a single player enivroment as ive been testing by myself and also experience no lag. I think its only when i play the map online and when i have other people play i get lag issues. I havent tried taking it out yet but it might be on the cards for testing purposes.

Eleandor Did u notice any other triggers that needed fixing or could be causing the lag??
 
Level 21
Joined
Aug 21, 2005
Messages
3,699
Well, as my exams aren't completelly over yet, I didn't feel like fighting myself through that jungle of 10k lines of script that were written by a complete stranger, so I have no clue yet what the other functions do...

Though I'm still of the opinion that a massive rewriting of the scripts would be suggested... Perhaps I'll do a few of them just for training my humilliating jassskills. But I'll probably need a list of (urgent) things needed, before I consider trying out a few...

As for the shielding script, it seems to be ok. Perhaps the easiest way to see whether the system is the main cause of lag is downloading the map again from the spellssection and making a test-multiplayer version of it with 2 or more players...
Then I might consider alternating the system for protoss-use... Again, if I feel like doing so :)
 
Level 7
Joined
Jan 1, 2005
Messages
133
Well, as my exams aren't completelly over yet, I didn't feel like fighting myself through that jungle of 10k lines of script that were written by a complete stranger, so I have no clue yet what the other functions do...

Though I'm still of the opinion that a massive rewriting of the scripts would be suggested... Perhaps I'll do a few of them just for training my humilliating jassskills. But I'll probably need a list of (urgent) things needed, before I consider trying out a few...

As for the shielding script, it seems to be ok. Perhaps the easiest way to see whether the system is the main cause of lag is downloading the map again from the spellssection and making a test-multiplayer version of it with 2 or more players...
Then I might consider alternating the system for protoss-use... Again, if I feel like doing so :)

Absolutely fine with me Eleandor, I understand you completely and will appreicate any work you do for me that will help my project through this. My triggering skills are minimal at best and thats why ive cried for help about this problem but i understand who ever does help me cant just drop everything for me, so i do know patience and im able to wait until that some1 has got the free time to work on it.
 
Level 29
Joined
Jul 29, 2007
Messages
5,174
Wait, all those codes (beside the shield) are from the advanced actions ? if so... I guess I see why they are retarded.

I didn't check for leaks, but I saw they are inefficient.

Anyway, I don't see any reason why any map would need 10k lines in the header... although probably 2k of them could be deleted, or maybe its more like 5k ? :p
 
Level 7
Joined
Jan 1, 2005
Messages
133
cheers ghost for look at my maps for me. What parts are inefficient?? are you talking about the header coding or the triggers i have in the maps?? Umm ive been doing some testing on bnet and found the lag occurs randomly as ive played some times and the lag as gone really bad after say 15 mins and other times no lag at all after 20 mins. I just finsihed a beta test before and i played a game for about 35 mins and i had no lag until the protoss player attacked me. Im now considering going back to my old shield mana system and seeing what happens, as well as removing the custom script coding that u guys think doesnt need to be there.
 
Level 29
Joined
Jul 29, 2007
Messages
5,174
Well for example the blizzard conditions, look at the header, now you see that

Code:
function Function_Name takes nothing returns boolean
 If ( not ( someCondition)) then
     return false
else
    return true
endfunction


Don't remember all of it, anyway thats inefficient.
Instead of that you could type

Code:
function Function_Name takes nothing returns boolean
      return someCondition
endfunction


When you have a few it doesn't matter probably, but I saw more then 100 I think.

I bet I would find more stuff like that + leaks if i'd search, not gonna look through all that code though x.X
I also bet you need about 1/50 of that long code for your map...
 
Level 7
Joined
Jan 1, 2005
Messages
133
Well for example the blizzard conditions, look at the header, now you see that

Code:
function Function_Name takes nothing returns boolean
 If ( not ( someCondition)) then
     return false
else
    return true
endfunction


Don't remember all of it, anyway thats inefficient.
Instead of that you could type

Code:
function Function_Name takes nothing returns boolean
      return someCondition
endfunction


When you have a few it doesn't matter probably, but I saw more then 100 I think.

I bet I would find more stuff like that + leaks if i'd search, not gonna look through all that code though x.X
I also bet you need about 1/50 of that long code for your map...

Oh god damn it would be quite a bit of work then to check and edit the coding. I wouldnt be able to do it myself. I dout even you ghost would be willing to go through the entire 10k lins and edit them all. What are my options???
 
Level 19
Joined
Aug 24, 2007
Messages
2,888
hey Ghostwolf

A thread ends when it encounters with return command (just keep in mind)

[jass="Not Jass"]function something takes nothing returns boolean
if not someconditions // no need for ")"'s or "("'s here
return false
endif
return true[/code]
 
Level 21
Joined
Aug 21, 2005
Messages
3,699
I think I more or less know the problem with the script: If there are many protoss in a battle, a trigger for each shielded unit will be fired every time a unit takes damage. Seeing as how the system also uses gamecache, the time a trigger needs to run only increases. If the shield would be a spell cast by perhaps 20 units in the game, wc3 would probably be able to handle it lagless. As every protoss unit actually has the shield (permanently), it will become too much of a burden.

Honestly, I don't think there's any way this could be avoided.
My suggestion: use mana shield (that is automatically activated and hidden in a spellbook or something); and instead, make the protoss energy a third additional energysource. The difference is that this energysource will be used activelly and thus won't be a huge burden. The shield however would be used passivelly every time a protoss unit is attacked...
Oh yeah and the energy system would either be used by all casters or only protosscasters, that would be up to you... So mana could still be used as energy for other races...
 
Level 7
Joined
Jan 1, 2005
Messages
133
Well there you go. As this is my first instance using this trigger was unaware it would cause this kind of lag problems. Its differently settled. Ill go back to the original passive mana shield system i had. Eleandor if you can create a 3rd energy source that would allow for protoss spell casters that would be excellent, if you can trigger it for me that is. Other wise the original trigger will be enough for now as i dont have any protoss spell caster atm but will eventually. If you need the original JASS spell trigger i can post that or pm you the coding.

Thanx for allk the input and advice guys. You guys have been outstanding helping my out with this problem and ill credit those who provided help and offered their time to help me. Thanx guys

night_wolveX
SC 1.5 Project Creator
 
Status
Not open for further replies.
Top