HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

ordering unit to cast blizzard causes server split/desync, help please?

04-16-2004, 02:32 AM#1
azeckoski
I am using a trigger to order a unit to cast blizzard it the instant it casts the spell everyone is disconnected from the game (desync). Here is the trigger. Does anyone know why this might be happening?
Thanks
-AZ

Code:
Pirate Blizzard
    Events
    Conditions
        GameType Equal to Pirate
        (Remaining time for PartyTimer) Greater than 2.00
    Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                PartyReal Greater than 8.00
            Then - Actions
                Set PartyReal = 6.00
                Wait PartyReal seconds
                Trigger - Run Pirate Blizzard <gen> (checking conditions)
                Skip remaining actions
            Else - Actions
                Do nothing
        -------- Fake Blizzard attack --------
        Unit Group - Pick every unit in (Random 1 units from (Units in PirateRegion <gen> matching ((Unit-type of (Matching unit)) Equal to Treasure Seeker))) and do (Actions)
            Loop - Actions
                Unit - Order cineUnit to Human Archmage - Blizzard (Position of (Picked unit))
        Wait PartyReal seconds
        If (PartyReal Less than 0.10) then do (Set PartyReal = 0.10) else do (Set PartyReal = (PartyReal x 0.80))
        Trigger - Run Pirate Blizzard <gen> (checking conditions)
04-16-2004, 07:14 PM#2
ThyFlame
Hmm. It may be because you can only target one unit, not all of them.

Order blizzard on picked unit is trying to force the unit to cast multiple blizzards -- one per unit -- when it can only cast one.

Try it with pick random unit from group and see if that fixes it.
04-16-2004, 07:20 PM#3
azeckoski
I changed the post to make the code more readable but it should be choosing a single unit randomly from the group that is in the region. Is there another way to do it? I am willing to try out other methods.
-AZ
04-16-2004, 07:39 PM#4
ThyFlame
Quote:
Originally Posted by azeckoski
I changed the post to make the code more readable but it should be choosing a single unit randomly from the group that is in the region. Is there another way to do it? I am willing to try out other methods.
-AZ

It is picking every unit in that region.

To pick a random unit from the group.

Add all units in region to UnitGroupVariable1
Pick a random unit from UnitGroupVariable1


Now, I am also not so sure that is the cause of the desync. I think it has to do with another trigger or part of this trigger I havn't noticed.
04-16-2004, 09:28 PM#5
The Gearhead
Use a for loop to determine the best target to pick.

For (Each Integer A)
You can pick each unit in a region, or each unit in a radius from a point.

Or, have it do something like this:

Action list:

Code:
Set UnitIndex to 0
Set TargetUnitRadius to 0
Set TargetUnit to (No unit)
Pick every unit in radius (radius from caster... use the spell range) and do actions:
    Set UnitVariable[UnitIndex] to (picked unit)
    Set UnitVariableRadius[UnitIndex] to (Every unit in ~RANGE OF SPELL~)
    Set UnitIndex to (UnitIndex + 1)

For each integer A (0 through UnitIndex - 1)
    If/Then/Else
        Condition:
               [b]AND[/b]
                  UnitVariableRadius[Integer A] is greater than UnitVariableRadius[(Integer A - 1)
                  UnitVariableRadius[Integer A] is greater than TargetUnitRadius
        Then:
               Set TargetUnit to UnitVariable[Integer A]
               Set TargetUnitRadius to UnitVariableRadius[Integer A]

Unit - Issue order on unit (TargetUnit) to cast blizzard


It's a simple trigger which will evaluate the number of units that are within range for caster, then the number of units around each unit in range of caster. And thus determine the best, most damaging unit for the caster to target.

The code is loose so don't expect it to be precise, it's just thought of on the fly.

This will not evaluate the best point in which the caster should target. For that you'd need a more complex trigger which would probably evaluate every point with a variable distance and polar offset... pretty heavy stuff right there.

Although, if you were doing a custom spell, that would work great for a barrage skill that would be auto-targetting.


I have all sorts of great ideas when it doesn't come to my TD. *sigh* *Goes back to counterstrike*

Edit: forgot an And condition
04-16-2004, 09:59 PM#6
azeckoski
Wow Gearhead, that is pretty serious. I am trying to keep it simple until I can lock down the desync issue but I once I figure that out it would be cool to add the code you posted.

At any rate, I took out the possible loop and it still desyncs the instant the guy tries to cast blizzard (before the spell really even starts but after the animation starts). Here is the new code:

Code:
Pirate Blizzard
    Events
    Conditions
        GameType Equal to Pirate
        (Remaining time for PartyTimer) Greater than 2.00
    Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                PartyReal Greater than 8.00
            Then - Actions
                Set PartyReal = 6.00
                Wait PartyReal seconds
                Trigger - Run Pirate Blizzard <gen> (checking conditions)
                Skip remaining actions
            Else - Actions
                Do nothing
        -------- Fake Blizzard attack --------
        Set PartyGroup = (Units in PirateRegion <gen> matching ((Unit-type of (Matching unit)) Equal to Treasure Seeker))
        Unit - Order PartyUnit to Human Archmage - Blizzard (Position of (Random unit from PartyGroup))
        Unit Group - Remove all units from PartyGroup
        Wait PartyReal seconds
        If (PartyReal Less than 0.10) then do (Set PartyReal = 0.10) else do (Set PartyReal = (PartyReal x 0.80))
        Trigger - Run Pirate Blizzard <gen> (checking conditions)

Any ideas???
04-16-2004, 11:49 PM#7
The Gearhead
Ah its good you got me thinking about that whole targetting issue... because I'm going to implement that in my TD, for splash towers to target the most cluttered part of a mob.

It will allow me to lower splash tower damage, which is notorious for breaking TDs. Because unmanaged... low damage is ineffective, and when managed by the player, high damage is too effective.

That trigger, or at least, that type of trigger, will be extremely useful.
04-18-2004, 04:53 PM#8
azeckoski
Looks like the problem ended up having nothing to do with the loop or reals or any of that. It was with targetting the position of a unit. Once I put the targetpoint into a variable it fixed the server splits.

Here is the working trigger:
Code:
Pirate Blizzard
    Events
    Conditions
        GameType Equal to Pirate
        (Remaining time for PartyTimer) Greater than 2.00
    Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                PartyReal Greater than 8.00
            Then - Actions
                Set PartyReal = 6.00
                Wait PartyReal seconds
            Else - Actions
                Do nothing
        -------- Fake Blizzard attack --------
        Set PartyGroup = (Units in PirateRegion <gen> matching ((Unit-type of (Matching unit)) Equal to Treasure Seeker))
        Set targetUnit = (Random unit from PartyGroup)
        Set targetPoint = (Position of targetUnit)
        Unit - Order PartyUnit to Human Archmage - Blizzard targetPoint
        Unit Group - Remove all units from PartyGroup
        Wait PartyReal seconds
        If (PartyReal Less than 0.10) then do (Set PartyReal = 0.10) else do (Set PartyReal = (PartyReal x 0.80))
        Trigger - Run Pirate Blizzard <gen> (checking conditions)
04-18-2004, 05:52 PM#9
The Gearhead
LOL... one would think that with the ability to define how towers and AIs should target things, it would be possible to make a self-playing RPG.