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.
  • 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 The Helper:
    Happy Thursday!
  • Varine Varine:
    Crazy how much 3d printing has come in the last few years. Sad that it's not as easily modifiable though
  • Varine Varine:
    I bought an Ender 3 during the pandemic and tinkered with it all the time. Just bought a Sovol, not as easy. I'm trying to make it use a different nozzle because I have a fuck ton of Volcanos, and they use what is basically a modified volcano that is just a smidge longer, and almost every part on this thing needs to be redone to make it work
  • Varine Varine:
    Luckily I have a 3d printer for that, I guess. But it's ridiculous. The regular volcanos are 21mm, these Sovol versions are about 23.5mm
  • Varine Varine:
    So, 2.5mm longer. But the thing that measures the bed is about 1.5mm above the nozzle, so if I swap it with a volcano then I'm 1mm behind it. So cool, new bracket to swap that, but THEN the fan shroud to direct air at the part is ALSO going to be .5mm to low, and so I need to redo that, but by doing that it is a little bit off where it should be blowing and it's throwing it at the heating block instead of the part, and fuck man
  • Varine Varine:
    I didn't realize they designed this entire thing to NOT be modded. I would have just got a fucking Bambu if I knew that, the whole point was I could fuck with this. And no one else makes shit for Sovol so I have to go through them, and they have... interesting pricing models. So I have a new extruder altogether that I'm taking apart and going to just design a whole new one to use my nozzles. Dumb design.
  • Varine Varine:
    Can't just buy a new heatblock, you need to get a whole hotend - so block, heater cartridge, thermistor, heatbreak, and nozzle. And they put this fucking paste in there so I can't take the thermistor or cartridge out with any ease, that's 30 dollars. Or you can get the whole extrudor with the direct driver AND that heatblock for like 50, but you still can't get any of it to come apart
  • Varine Varine:
    Partsbuilt has individual parts I found but they're expensive. I think I can get bits swapped around and make this work with generic shit though

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top