Disabling 'chatter' for 6 seconds?

Danis[h]

New Member
Reaction score
19
So basically I want my non-important units to speak idle gossip through floating text tags when you right-click them and stand near them, but I only want it to be possible for them to 'chatter' once every 6th seconds (since that's the duration of the floating text) so the text tags wont overlap..

Also, I think I've been able to make it so that it will only display for the player who clicks the unit, however I'm not sure if it will work?

Trigger:
  • Show Chatter
    • Events
      • Unit - A unit Is issued an order targeting an object
    • Conditions
      • ((Owner of (Target unit of issued order)) Equal to Player 10 (Light Blue)) and ((Target unit of issued order) Not equal to (Random unit from ImportantUnits))
      • (Issued order) Equal to (Order(smart))
    • Actions
      • Custom script: local string Message = ""
      • Set Point = (Position of (Ordered unit))
      • Set Point2 = (Position of (Target unit of issued order))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Distance between Point and Point2) Less than or equal to 200.00
        • Then - Actions
          • Set Die[0] = (Random integer number between 1 and 6)
          • Custom script: if GetLocalPlayer() == GetOwningPlayer(GetOrderedUnit()) then
          • Custom script: set Message = udg_AravilleChatter[udg_Die[0]]
          • Custom script: endif
          • Custom script: call CreateTextTagLocBJ( Message, udg_Point2, 0, 10, 100, 100, 100, 0 )
          • Floating Text - Change (Last created floating text): Disable permanence
          • Floating Text - Change the lifespan of (Last created floating text) to 6.00 seconds
          • Floating Text - Change the fading age of (Last created floating text) to 4.00 seconds
          • Custom script: set Message = null
        • Else - Actions
          • Do nothing
      • Custom script: call RemoveLocation(udg_Point)
      • Custom script: call RemoveLocation(udg_Point2)


edit

In case you were wondering about the string im referring to in the trigger 'AravilleChatter' then here it is set up.
Trigger:
  • Araville Chatter Setup
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set AravilleChatter[1] = Lovely Weather
      • Set AravilleChatter[2] = There's nothing like a good bit of fresh air, don't you think?
      • Set AravilleChatter[3] = Welcome, stranger!
      • Set AravilleChatter[4] = You're not from around here, are you?
      • Set AravilleChatter[5] = Stop Bothering Me
      • Set AravilleChatter[6] = We don't want no trouble here. Araville is a nice town
 

WastedSavior

A day without sunshine is like, well, night.
Reaction score
217
You could set the custom value of the unit to 1, then wait 6 seconds and set it back to 0.

Then add an "if" to check if it is 1 or 0?

As for the displaying to the triggering player, floating text initially displays to everyone, but you can


Code:
Floating Text - Hide (Last created floating text) for (All players)
Floating Text - Show (Last created floating text) for (Player group((Triggering player)))
 

Danis[h]

New Member
Reaction score
19
You could set the custom value of the unit to 1, then wait 6 seconds and set it back to 0.

Then add an "if" to check if it is 1 or 0?

As for the displaying to the triggering player, floating text initially displays to everyone, but you can


Code:
Floating Text - Hide (Last created floating text) for (All players)
Floating Text - Show (Last created floating text) for (Player group((Triggering player)))

I've tested it on b.net and the floating text only displays to the player clicking because to everyone else it's just an empty string.

Although, I can't use unit custom value for a couple of reasons.

1. Custom value of units is already being used by my respawn trigger to respawn npc's and monsters at their initial locations (where they started out)

2. It's supposed to be able to be used by two players at the same time.

e.g. Player 1 clicks it and is shown some message, then 2.5 seconds later player 2 clicks and is also displayed a message. However neither player 1 nor player 2 can click that unit again within the next 6 seconds from the time of the click.
 

WastedSavior

A day without sunshine is like, well, night.
Reaction score
217
I've tested it on b.net and the floating text only displays to the player clicking because to everyone else it's just an empty string.
I would suggest using my method, messing with local player is unnecessary and could have undesired affects.

Although, I can't use unit custom value for a couple of reasons.

1. Custom value of units is already being used by my respawn trigger to respawn npc's and monsters at their initial locations (where they started out)

2. It's supposed to be able to be used by two players at the same time.

e.g. Player 1 clicks it and is shown some message, then 2.5 seconds later player 2 clicks and is also displayed a message. However neither player 1 nor player 2 can click that unit again within the next 6 seconds from the time of the click.

Hmm, I will have to think about that.

I assume all of your units are accounted for by the respawn trigger? (1/2/3/4/5/etc) each one is given a number as a custom value?
 

Danis[h]

New Member
Reaction score
19
I would suggest using my method, messing with local player is unnecessary and could have undesired affects.



Hmm, I will have to think about that.

I assume all of your units are accounted for by the respawn trigger? (1/2/3/4/5/etc) each one is given a number as a custom value?

yes. Every unit on the map (except heroes) are being picked in a unit group loop and assigned their custom values and corresponding points.
Like this
 

WastedSavior

A day without sunshine is like, well, night.
Reaction score
217
So is it possible to create an array boolean for each player?

and each unit clicked, corresponds to it's number in the array

It sets it to true for that player for 6 seconds, which prevents that player from clicking it again, but allows other players to do so?
 

Danis[h]

New Member
Reaction score
19
So is it possible to create an array boolean for each player?

and each unit clicked, corresponds to it's number in the array

It sets it to true for that player for 6 seconds, which prevents that player from clicking it again, but allows other players to do so?

Inspired by this, i used a UnitGroup Array. Simply enough. If the unit is in the player's currently spoken to unitgroup then the trigger wont run.

This is what I ended out with.. I'm a bit worried whether it could cause problems with leaks ect on battle.net.
Trigger:
  • Show Chatter1
    • Events
      • Unit - A unit Is issued an order targeting an object
    • Conditions
      • ((Owner of (Target unit of issued order)) Equal to Player 10 (Light Blue)) and ((Target unit of issued order) Not equal to (Random unit from ImportantUnits))
      • (Issued order) Equal to (Order(smart))
      • (Target unit of issued order) Not equal to (Random unit from ChatterQuarenteen[(Player number of (Owner of (Ordered unit)))])
    • Actions
      • Custom script: local unit Chatterbox = GetOrderTargetUnit()
      • Custom script: local unit OrderUnit = GetOrderedUnit()
      • Custom script: local string Message = ""
      • Set Point = (Position of (Ordered unit))
      • Set Point2 = (Position of (Target unit of issued order))
      • If ((Target unit of issued order) Not equal to (Random unit from ChatterQuarenteen[(Player number of (Owner of (Ordered unit)))])) then do (Unit Group - Add (Target unit of issued order) to ChatterQuarenteen[(Player number of (Owner of (Ordered unit)))]) else do (Do nothing)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Distance between Point and Point2) Less than or equal to 200.00
        • Then - Actions
          • Set Die[0] = (Random integer number between 1 and 6)
          • Custom script: if GetLocalPlayer() == GetOwningPlayer(GetOrderedUnit()) then
          • Custom script: set Message = udg_AravilleChatter[udg_Die[0]]
          • Custom script: endif
          • Custom script: call CreateTextTagLocBJ( Message, udg_Point2, 0, 10, 100, 100, 100, 0 )
          • Floating Text - Change (Last created floating text): Disable permanence
          • Floating Text - Change the lifespan of (Last created floating text) to 6.00 seconds
          • Floating Text - Change the fading age of (Last created floating text) to 4.00 seconds
          • Custom script: set Message = null
        • Else - Actions
          • Do nothing
      • Custom script: call RemoveLocation(udg_Point)
      • Custom script: call RemoveLocation(udg_Point2)
      • Wait 6.00 seconds
      • Custom script: call GroupRemoveUnitSimple( Chatterbox, udg_ChatterQuarenteen[GetConvertedPlayerId(GetOwningPlayer(OrderUnit))] )
      • Custom script: set Chatterbox = null
      • Custom script: set OrderUnit = null


So I guess the remaining question is: Would it mess up on b.net?

Also there is the issue that a random unit from unit group might return false if there's more than one unit in the unit group. any way of changing this?
 

WilliamPa

Active Member
Reaction score
51
I tell you a simple way, which has no chance to mess up(unless u mess it up), turn off the trigger, and after the 6s wait turn it back on.

Code:
Trigger - Turn On
Trigger - Turn Off
 

elmstfreddie

The Finglonger
Reaction score
203
I tell you a simple way, which has no chance to mess up(unless u mess it up), turn off the trigger, and after the 6s wait turn it back on.

Code:
Trigger - Turn On
Trigger - Turn Off

He's using GetLocalPlayer(); turning off the trigger would turn it off for everyone, and I believe it'd cause a desync if he GetLocalPlayer()ed that too.. worth a try I suppose, though.
 

Danis[h]

New Member
Reaction score
19
He's using GetLocalPlayer(); turning off the trigger would turn it off for everyone, and I believe it'd cause a desync if he GetLocalPlayer()ed that too.. worth a try I suppose, though.

this is correct. I cannot simply turn off the trigger since I want it to work for every player, and they may not click a unit at the same time, but they might click one each within a timeframe of 6 seconds.
 

WastedSavior

A day without sunshine is like, well, night.
Reaction score
217
Code:
(Target unit of issued order) Not equal to (Random unit from ChatterQuarenteen[(Player number of (Owner of (Ordered unit)))])


Change this condition to the boolean "Unit - Unit in Unit Group"

Code:
((Target unit of issued order) is in Chatterquarantine) Equal to False
 

Danis[h]

New Member
Reaction score
19
Code:
(Target unit of issued order) Not equal to (Random unit from ChatterQuarenteen[(Player number of (Owner of (Ordered unit)))])


Change this condition to the boolean "Unit - Unit in Unit Group"

Code:
((Target unit of issued order) is in Chatterquarantine) Equal to False

I feel like I've totally missed the obvious here, thanks! Now it works as intended.. Now the trigger looks like this.
Trigger:
  • Show Chatter1
    • Events
      • Unit - A unit Is issued an order targeting an object
    • Conditions
      • ((Owner of (Target unit of issued order)) Equal to Player 10 (Light Blue)) and ((Target unit of issued order) Not equal to (Random unit from ImportantUnits))
      • (Issued order) Equal to (Order(smart))
      • ((Target unit of issued order) is in ChatterQuarenteen[(Player number of (Owner of (Ordered unit)))]) Equal to False
    • Actions
      • Custom script: local unit Chatterbox = GetOrderTargetUnit()
      • Custom script: local unit OrderUnit = GetOrderedUnit()
      • Custom script: local string Message = ""
      • Set Point = (Position of (Ordered unit))
      • Set Point2 = (Position of (Target unit of issued order))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Distance between Point and Point2) Less than or equal to 200.00
        • Then - Actions
          • Unit Group - Add (Target unit of issued order) to ChatterQuarenteen[(Player number of (Owner of (Ordered unit)))]
          • Set Die[0] = (Random integer number between 1 and 6)
          • Custom script: if GetLocalPlayer() == GetOwningPlayer(GetOrderedUnit()) then
          • Custom script: set Message = udg_AravilleChatter[udg_Die[0]]
          • Custom script: endif
          • Custom script: call CreateTextTagLocBJ( Message, udg_Point2, 0, 10, 100, 100, 100, 0 )
          • Floating Text - Change (Last created floating text): Disable permanence
          • Floating Text - Change the lifespan of (Last created floating text) to 6.00 seconds
          • Floating Text - Change the fading age of (Last created floating text) to 4.00 seconds
          • Custom script: set Message = null
        • Else - Actions
          • Do nothing
      • Custom script: call RemoveLocation(udg_Point)
      • Custom script: call RemoveLocation(udg_Point2)
      • Wait 6.00 seconds
      • Custom script: call GroupRemoveUnitSimple( Chatterbox, udg_ChatterQuarenteen[GetConvertedPlayerId(GetOwningPlayer(OrderUnit))] )
      • Custom script: set Chatterbox = null
      • Custom script: set OrderUnit = null


The only question remaining is whether the GetLocalPlayer could cause any problems? So far it hasn't caused any issues on Battle.net when I've tested it. However it might if it runs multiple times or something?
 

WastedSavior

A day without sunshine is like, well, night.
Reaction score
217
If your concerned about local player, do it the normal way.

Code:
Custom script: if GetLocalPlayer() == GetOwningPlayer(GetOrderedUnit()) then
Custom script: set Message = udg_AravilleChatter[udg_Die[0]]
Custom script: endif
Custom script: call CreateTextTagLocBJ( Message, udg_Point2, 0, 10, 100, 100, 100, 0 )

I'd suggest deleting all this, it is absolutely unnecessary.

Create your floating text normally and then add these two lines after
Code:
Floating Text - Hide (Last created floating text) for (All players)
Floating Text - Show (Last created floating text) for (Player group((Triggering player)))

Code:
Do nothing
// Is also unnecessary
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • WildTurkey WildTurkey:
    is there a stephen green in the house?
    +1
  • The Helper The Helper:
    What is up WildTurkey?
  • The Helper The Helper:
    Looks like Google fixed whatever mistake that made the recipes on the site go crazy and we are no longer trending towards a recipe site lol - I don't care though because it motivated me to spend alot of time on the site improving it and at least now the content people are looking at is not stupid and embarrassing like it was when I first got back into this like 5 years ago.
  • The Helper The Helper:
    Plus - I have a pretty bad ass recipe collection now! That section of the site is 10 thousand times better than it was before
  • The Helper The Helper:
    We now have a web designer at my job. A legit talented professional! I am going to get him to redesign the site theme. It is time.
  • Varine Varine:
    I got one more day of community service and then I'm free from this nonsense! I polished a cop car today for a funeral or something I guess
  • Varine Varine:
    They also were digging threw old shit at the sheriff's office and I tried to get them to give me the old electronic stuff, but they said no. They can't give it to people because they might use it to impersonate a cop or break into their network or some shit? idk but it was a shame to see them take a whole bunch of radios and shit to get shredded and landfilled
  • The Helper The Helper:
    whatever at least you are free
  • Monovertex Monovertex:
    How are you all? :D
    +1
  • Ghan Ghan:
    Howdy
  • Ghan Ghan:
    Still lurking
    +3
  • The Helper The Helper:
    I am great and it is fantastic to see you my friend!
    +1
  • The Helper The Helper:
    If you are new to the site please check out the Recipe and Food Forum https://www.thehelper.net/forums/recipes-and-food.220/
  • Monovertex Monovertex:
    How come you're so into recipes lately? Never saw this much interest in this topic in the old days of TH.net
  • Monovertex Monovertex:
    Hmm, how do I change my signature?
  • tom_mai78101 tom_mai78101:
    Signatures can be edit in your account profile. As for the old stuffs, I'm thinking it's because Blizzard is now under Microsoft, and because of Microsoft Xbox going the way it is, it's dreadful.
  • The Helper The Helper:
    I am not big on the recipes I am just promoting them - I use the site as a practice place promoting stuff
    +2
  • Monovertex Monovertex:
    @tom_mai78101 I must be blind. If I go on my profile I don't see any area to edit the signature; If I go to account details (settings) I don't see any signature area either.
  • The Helper The Helper:
    You can get there if you click the bell icon (alerts) and choose preferences from the bottom, signature will be in the menu on the left there https://www.thehelper.net/account/preferences
  • The Helper The Helper:
    I think I need to split the Sci/Tech news forum into 2 one for Science and one for Tech but I am hating all the moving of posts I would have to do
  • The Helper The Helper:
    What is up Old Mountain Shadow?

      The Helper Discord

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top