- Joined
- Oct 18, 2008
- Messages
- 1,591
I use this code for a socket system-the problem is, the first time when I run this trigger for a type of SocketGem it makes a 1 second lagg. After that if I use that type of gem it runs smoothly, but for the first time it's not good... Why does it do it? (I know that the mana and HP part doesn't work and I'll work on that problem )
-
For each (Integer A) from 1 to GemTypesNumber, do (Actions)
-
Loop - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- (Item-type of (Item being manipulated)) Equal to GemTypes[(Integer A)]
-
Then - Actions
-
For each (Integer B) from 1 to SocketedItemTypesNumber, do (Actions)
-
Loop - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- (Item-type of UsedGem) Equal to SockedtedItemTypes[(Integer B)]
-
Then - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- (Load 1 of UsedGemID from CurrentSocketsUsed) Less than SocketsMax[(Integer B)]
-
Then - Actions
- Hashtable - Save ((Load 1 of UsedGemID from CurrentSocketsUsed) + 1) as 1 of UsedGemID in CurrentSocketsUsed
- Hashtable - Save (Integer A) as (Load 1 of UsedGemID from CurrentSocketsUsed) of UsedGemID in SocketedGems
- Item - Remove (Item being manipulated)
-
For each (Integer X) from 1 to TotalBonusTypes, do (Actions)
-
Loop - Actions
- Set Bonuses[X] = 0
-
Loop - Actions
-
For each (Integer X) from 1 to 6, do (Actions)
-
Loop - Actions
-
For each (Integer Y) from 1 to (Load 1 of (Key (Item carried by (Triggering unit) in slot X)) from CurrentSocketsUsed), do (Actions)
-
Loop - Actions
-
For each (Integer C) from 1 to GemTypesNumber, do (Actions)
-
Loop - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- (Load Y of (Key (Item carried by (Triggering unit) in slot X)) from SocketedGems) Equal to C
-
Then - Actions
-
For each (Integer Z) from 1 to TotalBonusTypes, do (Actions)
-
Loop - Actions
- Set Bonuses[Z] = (Bonuses[Z] + (Load Z of C from SocketGemBonuses))
-
Loop - Actions
-
For each (Integer Z) from 1 to TotalBonusTypes, do (Actions)
- Else - Actions
-
If - Conditions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
Loop - Actions
-
For each (Integer C) from 1 to GemTypesNumber, do (Actions)
-
Loop - Actions
-
For each (Integer Y) from 1 to (Load 1 of (Key (Item carried by (Triggering unit) in slot X)) from CurrentSocketsUsed), do (Actions)
-
Loop - Actions
- Wait 0.10 seconds -- Tried using this to reduce lagg without a succes...
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- Bonuses[1] Greater than 0
-
Then - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- (Level of Strength Bonus for (Triggering unit)) Equal to 0
-
Then - Actions
- Unit - Add Strength Bonus to (Triggering unit)
- Else - Actions
-
If - Conditions
- Unit - Set level of Strength Bonus for (Triggering unit) to Bonuses[1]
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
Else - Actions
- Unit - Remove Strength Bonus from (Triggering unit)
-
If - Conditions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- Bonuses[2] Greater than 0
-
Then - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- (Level of Agility Bonus for (Triggering unit)) Equal to 0
- Then - Actions
-
Else - Actions
- Unit - Add Agility Bonus to (Triggering unit)
-
If - Conditions
- Unit - Set level of Agility Bonus for (Triggering unit) to Bonuses[2]
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
Else - Actions
- Unit - Remove Agility Bonus from (Triggering unit)
-
If - Conditions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- Bonuses[3] Greater than 0
-
Then - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- (Level of Intelligence Bonus for (Triggering unit)) Equal to 0
-
Then - Actions
- Unit - Add Intelligence Bonus to (Triggering unit)
- Else - Actions
-
If - Conditions
- Unit - Set level of Intelligence Bonus for (Triggering unit) to Bonuses[3]
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
Else - Actions
- Unit - Remove Intelligence Bonus from (Triggering unit)
-
If - Conditions
- Set SocketTempInt = ((Bonuses[4] - 50) / 100)
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- SocketTempInt Greater than 0
-
Then - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- (Level of Life Bonus (100) for (Triggering unit)) Equal to 0
-
Then - Actions
- Unit - Add Life Bonus (100) to (Triggering unit)
- Else - Actions
-
If - Conditions
- Unit - Set level of Life Bonus (100) for (Triggering unit) to SocketTempInt
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
Else - Actions
- Unit - Remove Life Bonus (100) from (Triggering unit)
-
If - Conditions
- Set SocketTempInt = (Bonuses[4] mod 100)
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- SocketTempInt Greater than 0
-
Then - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- (Level of Mana Bonus (1) for (Triggering unit)) Equal to 0
-
Then - Actions
- Unit - Add Life Bonus (1) to (Triggering unit)
- Else - Actions
-
If - Conditions
- Unit - Set level of Life Bonus (1) for (Triggering unit) to SocketTempInt
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
Else - Actions
- Unit - Remove Life Bonus (1) from (Triggering unit)
-
If - Conditions
- Set SocketTempInt = ((Bonuses[5] - 49) / 100)
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- SocketTempInt Greater than 0
-
Then - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- (Level of Mana Bonus (100) for (Triggering unit)) Equal to 0
-
Then - Actions
- Unit - Add Mana Bonus (100) to (Triggering unit)
- Else - Actions
-
If - Conditions
- Unit - Set level of Mana Bonus (100) for (Triggering unit) to SocketTempInt
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
Else - Actions
- Unit - Remove Mana Bonus (100) from (Triggering unit)
-
If - Conditions
- Set SocketTempInt = (Bonuses[5] mod 100)
- Game - Display to (All players) the text: (String(SocketTempInt))
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- SocketTempInt Greater than 0
-
Then - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- (Level of Mana Bonus (1) for (Triggering unit)) Equal to 0
-
Then - Actions
- Unit - Add Mana Bonus (1) to (Triggering unit)
- Else - Actions
-
If - Conditions
- Unit - Set level of Mana Bonus (1) for (Triggering unit) to SocketTempInt
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
Else - Actions
- Unit - Remove Mana Bonus (1) from (Triggering unit)
-
If - Conditions
- Unit - Remove Movement Speed Bonus from (Triggering unit)
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- Bonuses[6] Greater than 0
-
Then - Actions
- Unit - Add Movement Speed Bonus to (Triggering unit)
- Unit - Set level of Movement Speed Bonus for (Triggering unit) to Bonuses[6]
- Else - Actions
-
If - Conditions
-
Else - Actions
- Game - Display to (Player group((Owner of (Triggering unit)))) the text: You can't put more ...
-
If - Conditions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
- Else - Actions
-
If - Conditions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
Loop - Actions
-
For each (Integer B) from 1 to SocketedItemTypesNumber, do (Actions)
- Else - Actions
-
If - Conditions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
Loop - Actions