• 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.
  • 💡 We're thrilled to announce that our upcoming texturing contest is in the works, and we're eager to hear your suggestions! Please take this opportunity to share your ideas in this theme discussion thread for the Texturing Contest #34!
  • 🏆 Hive's 7th HD Modeling Contest: Icecrown Creature is now open! The frozen wastes of Icecrown are home to some of Azeroth’s most terrifying and resilient creatures. For this contest, your challenge is to design and model a HD 3D monster that embodies the cold, undead, and sinister essence of Icecrown! 📅 Submissions close on April 13, 2025. Don't miss this opportunity to let your creativity shine! Enter now and show us your frozen masterpiece! 🔗 Click here to enter!

Sliding too fast online with others, but fine alone...

Status
Not open for further replies.
Level 4
Joined
Apr 16, 2018
Messages
47
Could I get some help please? I am trying to make my character slide at a consistent nice speed for a maze map, and it does do perfectly when I am testing on my own. The problem is that when I host the game online and test it with a friend, the slide speed become ridiculously faster. Does not matter if i host with slow normal or fast chosen, it is fine unless I have another person with me... How do I fix this? I have no idea what is causing the difference between alone or online with friend...

Trigger that starts the timer on initialization.
  • Initialization
    • Events
      • Map initialization
    • Conditions
    • Actions
      • -------- Start Slide_Timer --------
      • Countdown Timer - Start Slide_Timer as a Repeating timer that will expire in 0.01 seconds

The trigger for timer that activate all periodic triggers to avoid having multiple timers.
  • Timer
    • Events
      • Time - Slide_Timer expires
    • Conditions
    • Actions
      • Trigger - Run Normal Slide <gen> (checking conditions)
      • Trigger - Run DeathOnTouchTerrain <gen> (checking conditions)

The slide trigger that actually makes the unit slide.
  • Normal Slide
    • Events
    • Conditions
    • Actions
      • Player Group - Pick every player in (All players) and do (Actions)
        • Loop - Actions
          • Unit Group - Pick every unit in (Units in (Playable map area) matching (((Picked player) controller) Equal to User)) and do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Terrain type at (Position of (Picked unit))) Equal to NormalSlideTerrain
                • Then - Actions
                  • Unit - Move (Picked unit) instantly to ((Position of (Picked unit)) offset by (IceSpeed / 3.00) towards (Facing of (Picked unit)) degrees.)
                • Else - Actions
 
Level 24
Joined
Feb 27, 2019
Messages
806
Its (Owner of unit(Matching unit)).
Player controller status is better used as a condition in an if then else statement or pick every player in all players matching condition.

Every 0.01 seconds seems like overkill. I am sure every 0.03 seconds looks just as good and is much more efficient.

There is also a bunch of leaks being created in your trigger. Point leaks and unit group leaks. Since your player group and unit group are constant id rather only have a single unit group and add units into there as they enter the map. Then use two temppoints, one for position of unit and another for that point ofset by icespeed, then remove these points.
 
Level 4
Joined
Apr 16, 2018
Messages
47
Thank you.

I think I got it working with this slide script, also made it .03 and it is indeed doing fine. Still need to work on the temps and leak prevention stuff, not really experienced with that though. Been trying to do it on some things, I think i may have succeeded on my turning trigger but not 100% sure.

Here is how I changed the slide script. Wanted to do it without the pick all group stuff and this seemed to do the charm and only do it for the units specifically added to the unit group variable.
  • Actions
    • For each (Integer A) from 1 to 8, do (Actions)
      • Loop - Actions
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • Or - Any (Conditions) are true
              • Conditions
                • (Terrain type at (Position of Chosen_Sliders[(Integer A)])) Equal to NormalSlideTerrain
                • (Terrain type at (Position of Chosen_Sliders[(Integer A)])) Equal to NoTurnSlideTerrain
            • (Chosen_Sliders[(Integer A)] is alive) Equal to True
          • Then - Actions
            • Unit - Move Chosen_Sliders[(Integer A)] instantly to ((Position of Chosen_Sliders[(Integer A)]) offset by IceSpeed towards (Facing of Chosen_Sliders[(Integer A)]) degrees.)
          • Else - Actions
 
Level 24
Joined
Feb 27, 2019
Messages
806
Id say it looks pretty good.

A point leak is created because a point is created but not removed afterwards. This is how the function (Terrain type at (Position of Unit) equal to X looks like in code.

JASS:
function Trig_Untitled_Trigger_001_Conditions takes nothing returns boolean
    if ( not ( GetTerrainTypeBJ(GetUnitLoc(gg_unit_Hpal_0000)) == 'Ldrt' ) ) then
        return false
    endif
    return true
endfunction

As you can see it gets the unitlocation but it never removes the location and there is no way for us to remove that location now since we cant reference it.

So we want to add something before the function being Set Loc[0] = (GetUnitLoc(gg_unit_Hpal_0000)
and when we are done using that location do call RemoveLocation(udg_Loc[0]) so it would look something like this instead

JASS:
Set Loc[0] = (GetUnitLoc(gg_unit_Hpal_0000)
function Trig_Untitled_Trigger_001_Conditions takes nothing returns boolean
    if ( not ( GetTerrainTypeBJ(udg_Loc[0]) == 'Ldrt' ) ) then
        return false
    endif
    return true
endfunction
call RemoveLocation(udg_Loc[0])   <---- Custom script action
 
Status
Not open for further replies.
Top