wc3campaigns
WC3C Homepage - www.wc3c.netUser Control Panel (Requires Log-In)Engage in discussions with other users and join contests in the WC3C forums!Read one of our many tutorials, ranging in difficulty from beginner to advanced!Show off your artistic talents in the WC3C Gallery!Download quality models, textures, spells (vJASS/JASS), systems, and scripts!Download maps that have passed through our rigorous approval process!

Go Back   Wc3C.net > Warcraft III Modding > Developer's Corner > Triggers & Scripts
User Name
Password
Register Rules Get Hosted! Chat Pastebin FAQ and Rules Members List Calendar



Reply
 
Thread Tools Search this Thread
Old 10-01-2010, 05:48 PM   #1
TheTerran
User
 
Join Date: Dec 2007
Posts: 13

TheTerran has little to show at this moment (0)

Default [SOLVED] Trigger causes lag and needs a fix

I am 'attaching' 12 units to one unit that let's call 'Main Unit' by moving every 0.01 second the units to the main unit. The units have to be forming a circle around the main unit and when the Main Unit moves, the 'attached' units to remain in the same circle, so I use these triggers:

Trigger:
Test2
Events
Time - Every 0.01 seconds of game time
Conditions
Actions
Unit - Move Marine 0003 <gen> instantly to ((Position of (Random unit from (Units of type Main Unit))) offset by 320.00 towards 30.00 degrees)
Unit - Move Terran Medic 0010 <gen> instantly to ((Position of (Random unit from (Units of type Main Unit))) offset by 320.00 towards 60.00 degrees)
Unit - Move Marine 0007 <gen> instantly to ((Position of (Random unit from (Units of type Main Unit))) offset by 320.00 towards 90.00 degrees)
Unit - Move Marine 0004 <gen> instantly to ((Position of (Random unit from (Units of type Main Unit))) offset by 320.00 towards 120.00 degrees)
Unit - Move Marine 0013 <gen> instantly to ((Position of (Random unit from (Units of type Main Unit))) offset by 320.00 towards 150.00 degrees)
Unit - Move Marine 0012 <gen> instantly to ((Position of (Random unit from (Units of type Main Unit))) offset by 320.00 towards 180.00 degrees)
Unit - Move Terran Medic 0009 <gen> instantly to ((Position of (Random unit from (Units of type Main Unit))) offset by 320.00 towards 210.00 degrees)
Unit - Move Marine 0006 <gen> instantly to ((Position of (Random unit from (Units of type Main Unit))) offset by 320.00 towards 240.00 degrees)
Unit - Move Terran Medic 0011 <gen> instantly to ((Position of (Random unit from (Units of type Main Unit))) offset by 320.00 towards 270.00 degrees)
Unit - Move Marine 0008 <gen> instantly to ((Position of (Random unit from (Units of type Main Unit))) offset by 320.00 towards 300.00 degrees)
Unit - Move Terran Medic 0015 <gen> instantly to ((Position of (Random unit from (Units of type Main Unit))) offset by 320.00 towards 330.00 degrees)
Unit - Move Marine 0014 <gen> instantly to ((Position of (Random unit from (Units of type Main Unit))) offset by 320.00 towards 360.00 degrees)

I know these are shitty triggers but I decided to try it in the most simple way and the result is:

- this trigger causes lag after the 3rd minute so I need an alternative of it that isnt laggy but you get what im trying to do
- Even if I make the circle and they stand attached to the main unit like that, whenever the Main unit rotates/turns on a direction, they do not rotate because they are placed at degrees in general but I need to make the degrees towards the facing of the Main unit.

How can I do this circle and moved every 0.01 w/o lag and make them rotate as the Main Unit rotates? That is if say Marine 007 is at 90 degrees, when the Main Unit turns on some other direction, Marine 007 should also turn his 90 degrees towards the facing of the Main Unit and the same for all units to turn based on Main unit

Last edited by TheTerran : 10-02-2010 at 05:14 PM.
TheTerran is offline   Reply With Quote
Sponsored Links - Login to hide this ad!
Old 10-01-2010, 07:02 PM   #2
akolyt0r
In Flames
 
akolyt0r's Avatar
 
Join Date: Jan 2006
Posts: 1,154

Submissions (3)

akolyt0r has a spectacular aura about (120)

Default

you have like:
12*2*100*60 = 144000 memory leaks per minute
you have to call RemoveLocation, or else you will have massive point leaks

you need to replace each line of your trigger with something like:
Trigger:
Set TempUnitPoint = Position of Random Unit from Units of type Main Unit
Set TempUnitOffsetPoint = TempUnitPoint offset by 320 towards XXX degrees
Unit - Move XXX instantly to TempUnitOffsetPoint
CustomScript - call RemoveLocation(udg_TempUnitPoint)
CustomScript - call RemoveLocation(udg_TempUnitOffsetPoint)

also i would try to replace 0.01 seconds with 0.002 seconds, it will most likely still look smooth in game, but the trigger will cause 50% less performance issues
__________________

Last edited by akolyt0r : 10-01-2010 at 07:10 PM.
akolyt0r is offline   Reply With Quote
Old 10-01-2010, 09:13 PM
TheTerran
This message has been deleted by TheTerran.
Old 10-01-2010, 09:14 PM   #3
TheTerran
User
 
Join Date: Dec 2007
Posts: 13

TheTerran has little to show at this moment (0)

Default

Ay with your help this worked thanks. But this solves the lag problem, at least now it seems to be OK. Problem 2 that has to do with the degree - now that I made the circle of units around the Main Unit, whenever I move the Main Unit on the map, it turns direction and when it turns direction, the circle of 12 units doesn't turn. So how do I make these degrees based on the Main unit's facing so that when it turns, the 12 units also turn side. They should be like part of the Main unit, so the 'circle of units' should turn side along with the Main unit turning side

Trigger:
Test
Collapse Events
Time - Every 0.03 seconds of game time
Conditions
Collapse Actions
Set MainUnitPoint = (Position of (Random unit from (Units of type Domed Space Platform)))
Set MainUnitUnitPoint = (MainUnitPoint offset by 320.00 towards 30.00 degrees)
Unit - Move Marine 0003 <gen> instantly to MainUnitUnitPoint
Set MainUnitUnitPoint = (MainUnitPoint offset by 320.00 towards 60.00 degrees)
Unit - Move Marine 0004 <gen> instantly to MainUnitUnitPoint
Set MainUnitUnitPoint = (MainUnitPoint offset by 320.00 towards 90.00 degrees)
Unit - Move Marine 0006 <gen> instantly to MainUnitUnitPoint
Set MainUnitUnitPoint = (MainUnitPoint offset by 320.00 towards 120.00 degrees)
Unit - Move Marine 0007 <gen> instantly to MainUnitUnitPoint
Set MainUnitUnitPoint = (MainUnitPoint offset by 320.00 towards 150.00 degrees)
Unit - Move Marine 0008 <gen> instantly to MainUnitUnitPoint
Set MainUnitUnitPoint = (MainUnitPoint offset by 320.00 towards 180.00 degrees)
Unit - Move Marine 0012 <gen> instantly to MainUnitUnitPoint
Set MainUnitUnitPoint = (MainUnitPoint offset by 320.00 towards 210.00 degrees)
Unit - Move Marine 0013 <gen> instantly to MainUnitUnitPoint
Set MainUnitUnitPoint = (MainUnitPoint offset by 320.00 towards 240.00 degrees)
Unit - Move Marine 0014 <gen> instantly to MainUnitUnitPoint
Set MainUnitUnitPoint = (MainUnitPoint offset by 320.00 towards 270.00 degrees)
Unit - Move Terran Medic 0009 <gen> instantly to MainUnitUnitPoint
Set MainUnitUnitPoint = (MainUnitPoint offset by 320.00 towards 300.00 degrees)
Unit - Move Terran Medic 0010 <gen> instantly to MainUnitUnitPoint
Set MainUnitUnitPoint = (MainUnitPoint offset by 320.00 towards 330.00 degrees)
Unit - Move Terran Medic 0011 <gen> instantly to MainUnitUnitPoint
Set MainUnitUnitPoint = (MainUnitPoint offset by 320.00 towards 360.00 degrees)
Unit - Move Terran Medic 0015 <gen> instantly to MainUnitUnitPoint
Custom script: call RemoveLocation(udg_MainUnitPoint)
Custom script: call RemoveLocation(udg_MainUnitUnitPoint)

Last edited by TheTerran : 10-01-2010 at 09:41 PM.
TheTerran is offline   Reply With Quote
Old 10-02-2010, 12:46 PM   #4
akolyt0r
In Flames
 
akolyt0r's Avatar
 
Join Date: Jan 2006
Posts: 1,154

Submissions (3)

akolyt0r has a spectacular aura about (120)

Default

First, you need to put
Trigger:
Custom script: call RemoveLocation(udg_MainUnitUnitPoint)
after EACH "Unit - Move ..." line, or you will still have massive leaks.

Regarding your turn problem .... try something like:
Trigger:
Set MainUnitUnitPoint = (MainUnitPoint offset by 320.00 towards ( (facing of YOURMAINUNIT) + XXX) degrees)
__________________

Last edited by akolyt0r : 10-02-2010 at 12:47 PM.
akolyt0r is offline   Reply With Quote
Old 10-02-2010, 05:12 PM   #5
TheTerran
User
 
Join Date: Dec 2007
Posts: 13

TheTerran has little to show at this moment (0)

Default

yes I did it thanks +rep
TheTerran is offline   Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off


All times are GMT. The time now is 11:03 AM.


Affiliates
The Hubb The JASS Vault Clan WEnW Campaign Creations Clan CBS GamesModding Flixreel Videos

Powered by vBulletin (Copyright ©2000 - 2018, Jelsoft Enterprises Ltd).
Hosted by www.OICcam.com
IT Support and Services provided by Executive IT Services