HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Loopin problemz

07-09-2008, 04:35 AM#1
Gorman
So, i made some attatchment system code, but it runs realy realy slowly.
Am i messing up my loops or sumthing, or does these actions run slow?

Basicly the first trigger is the attatch weapons to the character depending on what weapon they had in that slot. Then it makes the weapon battle ready, so you can shoot with them.

The second one removes the weapons and puts the 'saftey' back on.
ApplyAttatchments

Trigger:
ApplyAttatchments
Collapse Events
Player - Player 1 (Red) types a chat message containing -Duel as An exact match
Conditions
Collapse Actions
Collapse Player Group - Pick every player in (All players controlled by a User player) and do (Actions)
Collapse Loop - Actions
Set DuelingHero = (Random unit from (Units in (Entire map) matching (((((Matching unit) is A Hero) Equal to True) and (((Matching unit) is alive) Equal to True)) and ((Owner of (Matching unit)) Equal to (Picked player)))))
Collapse For each (Integer B) from 1 to 6, do (Actions)
Collapse Loop - Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
(Item-type of (Item carried by DuelingHero in slot (Integer B))) Equal to Pistol (Saftey on)
Collapse Then - Actions
Item - Remove (Item carried by DuelingHero in slot (Integer B))
Hero - Create Pistol (Battle-ready) and give it to DuelingHero
Special Effect - Create a special effect attached to the Attatchment[(Integer B)] of DuelingHero using war3mapImported\Colt.mdx
Set SpecialEffect[((Integer B) + (((Player number of (Owner of DuelingHero)) - 1) x 6))] = (Last created special effect)
Collapse Else - Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
(Item-type of (Item carried by DuelingHero in slot (Integer B))) Equal to Shotgun (Saftey on)
Collapse Then - Actions
Item - Remove (Item carried by DuelingHero in slot (Integer B))
Hero - Create Shotgun (Battle-ready) and give it to DuelingHero
Special Effect - Create a special effect attached to the Attatchment[(Integer B)] of DuelingHero using war3mapImported\Shotgun.mdx
Set SpecialEffect[((Integer B) + (((Player number of (Owner of DuelingHero)) - 1) x 6))] = (Last created special effect)
Collapse Else - Actions
Do nothing



Unattatch

Trigger:
Unattatch
Collapse Events
Player - Player 1 (Red) types a chat message containing -Unduel as An exact match
Conditions
Collapse Actions
Collapse Player Group - Pick every player in (All players controlled by a User player) and do (Actions)
Collapse Loop - Actions
Set DuelingHero = (Random unit from (Units in (Entire map) matching (((((Matching unit) is A Hero) Equal to True) and (((Matching unit) is alive) Equal to True)) and ((Owner of (Matching unit)) Equal to (Picked player)))))
Collapse For each (Integer B) from 1 to 6, do (Actions)
Collapse Loop - Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
(Item-type of (Item carried by DuelingHero in slot (Integer B))) Equal to Pistol (Battle-ready)
Collapse Then - Actions
Item - Remove (Item carried by DuelingHero in slot (Integer B))
Hero - Create Pistol (Saftey on) and give it to DuelingHero
Collapse Else - Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
(Item-type of (Item carried by DuelingHero in slot (Integer B))) Equal to Shotgun (Battle-ready)
Collapse Then - Actions
Item - Remove (Item carried by DuelingHero in slot (Integer B))
Hero - Create Shotgun (Saftey on) and give it to DuelingHero
Collapse Else - Actions
Do nothing
Special Effect - Destroy SpecialEffect[(Integer B)]
Custom script: set udg_SpecialEffect[GetForLoopIndexB()] = null



Also, can i improve it?
07-09-2008, 04:50 AM#2
Feroc1ty
Anything that is GUI, you can improve 110%.
07-09-2008, 04:58 AM#3
chobibo
Remove DoNothing, I'm not familiar with GUI that's all I can think of.
Quote:
Anything that is GUI, you can improve 110%.
refrain from posting smart ass comments.
07-09-2008, 05:17 AM#4
Anopob
I can't see much now, but is there a specific reason you're using B loops instead of A's? Also yeah, remove Do Nothing's.
07-09-2008, 05:44 AM#5
Feroc1ty
Quote:
Originally Posted by chobibo
Remove DoNothing, I'm not familiar with GUI that's all I can think of.

refrain from posting smart ass comments.

How was that smart ass, it's totally true.
07-09-2008, 06:12 AM#6
chobibo
Didn't help the thread starter, anyways why not show him how to do so, Gorman would really appreciate it.
07-09-2008, 07:12 AM#7
the-thingy
Quote:
but it runs realy realy slowly.

What ability are you using for the effect attachment? I can't see why the code would be a problem

Quote:
Also, can i improve it?

How many heroes do you have per player? If it's only one, just store it in an array, and use (Player number of (Picked Player)) rather than random unit from group (which is leaking BTW)
07-09-2008, 08:01 AM#8
Gorman
Quote:
Originally Posted by Feroc1ty
Anything that is GUI, you can improve 110%.
I realise, but i cant be bothered.

Quote:
Originally Posted by Anopob
I can't see much now, but is there a specific reason you're using B loops instead of A's? Also yeah, remove Do Nothing's.
I used to have A's in there, but doesnt matter

Do Nothings are taken out now!

Quote:
Originally Posted by the-thingy
What ability are you using for the effect attachment? I can't see why the code would be a problem

How many heroes do you have per player? If it's only one, just store it in an array, and use (Player number of (Picked Player)) rather than random unit from group (which is leaking BTW)
What ability? its just special effect attatchments =\

1 hero per player, but yeah its just temp for the testing.
07-09-2008, 08:04 AM#9
the-thingy
Quote:
What ability? its just special effect attatchments =\

I don't see where you are adding a special effect in those triggers, so I assume that it is done using some item ability associated with those items
07-09-2008, 11:48 AM#10
Gorman
Ah, i get you. They are attatched using special effects

Trigger:
Special Effect - Create a special effect attached to the Attatchment[(Integer B)] of DuelingHero using war3mapImported\Colt.mdx

But dw, they are saved into variables and stuff so they are ok to manage

EDIT: i think ive found the source of the problem, the special effect takes a while to get removed. Is it possible that its the stand animation playing out before being removed or sumthing?
07-10-2008, 09:48 AM#11
Evernite.
Quote:
the special effect takes a while to get removed. Is it possible that its the stand animation playing out before being removed or sumthing?

Yep, most models that have no death animation whatsoever will just stand there for a few seconds before disappearing entirely. You should maybe try removing the special effect a couple seconds before taking the shotgun or whatever off the unit.
07-10-2008, 10:20 AM#12
Gorman
Yeah, ill just use a lil coverup method, maybe a little "closing battle cinematic" would be good for this.

Ty people!