Question about Threat System and using Custom Scripts

tommerbob

Minecraft. :D
Reaction score
110
Question about using custom scripts:

I am using Zwiebelchen's Threat System. He has a function included that lets me check the combat state of a unit. Here's the specific part of the system that is concerned:

JASS:

//      call ZTS_GetCombatState(unit PU) returns boolean:
//
//          Returns the combat state of a player unit.
//          Returns true, if the unit is registered and in combat.
//          Returns false, if the unit is not registered or out of combat.


But I'm noob at Jass, so I'm wondering if anyone can tell me the custom script lines I need to use to check for that boolean in GUI. Thanks in advance.
 

DioD

New Member
Reaction score
57
set udg_boolean_for_gui = ZTS_GetCombatState(unit PU)

then use this boolean global in checks, conditions, events or whatever.
 

tommerbob

Minecraft. :D
Reaction score
110
Hmm, maybe I'm doing it wrong. This is what I have:

I tried this first:

Trigger:
  • GetCombatState
    • Events
      • Player - Player 1 (Red) types a chat message containing -combat as An exact match
    • Conditions
    • Actions
      • Custom script: set udg_ZTS_InCombat[GetConvertedPlayerId(GetTriggerPlayer())] = ZTS_GetCombatState(udg_Hero[GetConvertedPlayerId(GetTriggerPlayer())])
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ZTS_InCombat[(Player number of (Triggering player))] Equal to True
        • Then - Actions
          • Game - Display to (All players) the text: Hero is in combat
        • Else - Actions
          • Game - Display to (All players) the text: Hero is NOT in combat


But that didn't work. So I tried this, not knowing what I'm doing:

Trigger:
  • GetCombatState
    • Events
      • Player - Player 1 (Red) types a chat message containing -combat as An exact match
    • Conditions
    • Actions
      • Custom script: call ZTS_GetCombatState(udg_Hero[GetConvertedPlayerId(GetTriggerPlayer())])
      • Custom script: set udg_ZTS_InCombat[GetConvertedPlayerId(GetTriggerPlayer())] = ZTS_GetCombatState(udg_Hero[GetConvertedPlayerId(GetTriggerPlayer())])
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ZTS_InCombat[(Player number of (Triggering player))] Equal to True
        • Then - Actions
          • Game - Display to (All players) the text: Hero is in combat
        • Else - Actions
          • Game - Display to (All players) the text: Hero is NOT in combat


But that doesn't work either. No game message shows up. What am I doing wrong?
 

LoveTD's

New Member
Reaction score
34
Custom script: set udg_ZTS_InCombat[GetConvertedPlayerId(GetTriggerPlayer())] = ZTS_GetCombatState(udg_Hero[GetConvertedPlayerId(GetTriggerPlayer())])

shouldn't this be:

Custom script: set udg_ZTS_InCombat[GetConvertedPlayerId(GetTriggerPlayer())] = call ZTS_GetCombatState(udg_Hero[GetConvertedPlayerId(GetTriggerPlayer())])

I'm surprised it's not giving a compiling error 0.o
you have to call the function in order to return the boolean right?
 

Bribe

vJass errors are legion
Reaction score
67
local unit u = GetTriggerUnit()

no "call" keyword is necessary unless it's at the start of the line. Having it anywhere else will cause a syntax error.
 

tommerbob

Minecraft. :D
Reaction score
110
no "call" keyword is necessary unless it's at the start of the line. Having it anywhere else will cause a syntax error.

Yeah I tried that, got a syntax error.

local unit u = GetTriggerUnit()

What does this have to do with anything? I'm not using a local because I want to reference this boolean in several different triggers. And there is no Triggering unit.

Still confused....
 

Bribe

vJass errors are legion
Reaction score
67
What does this have to do with anything?

I was illustrating a common example to demonstrate that the "call" keyword is nowhere to be found so that he could get an idea.

No game message is showing up at all? You need to show where udg_Hero is set because that is probably where the error is.
 

tommerbob

Minecraft. :D
Reaction score
110
I was illustrating a common example to demonstrate that the "call" keyword is nowhere to be found so that he could get an idea.

Ahh okay.

No game message is showing up at all? You need to show where udg_Hero is set because that is probably where the error is.

Here is the trigger where I set the udg_Hero variable: (I know that it works because I reference udg_Hero in several different triggers and they run perfectly fine.)

Trigger:
  • choose hero beta
    • Events
      • Game - GDC_Event becomes Equal to 1.00
    • Conditions
      • (Hero pick <gen> contains (Triggering unit)) Equal to True
    • Actions
      • Unit - Remove Hero[(Player number of (Triggering player))] from the game
      • Unit - Move (Triggering unit) instantly to Hero_Start
      • Unit - Change ownership of (Triggering unit) to (Triggering player) and Retain color
      • Selection - Select (Triggering unit) for (Triggering player)
      • -------- CAMERA SETUP --------
      • Camera - Pan camera for (Triggering player) to Hero_Start over 0.00 seconds
      • -------- STARTING ABILITIES --------
      • Unit - Add Starting Magic Resist to (Triggering unit)
      • Unit - Add Magic Resist to (Triggering unit)
      • ------------------
      • Set Hero[(Player number of (Triggering player))] = (Triggering unit)
      • ------------------
      • Visibility - Create an initially Enabled visibility modifier for (Triggering player) emitting Visibility across (Playable map area)
      • -------- ADD HERO TO THREAT SYSTEM --------
      • Custom script: call ZTS_AddPlayerUnit(GetTriggerUnit())
      • -------- SETUP MULTIBOARD --------
      • Trigger - Turn on One second periodic <gen>
      • Trigger - Run Multiboard Setup <gen> (ignoring conditions)


(The event is from tooltiperror's Double-click system.)

EDIT: Okay now this is stupid. I made a test map, and everything works fine. But all the triggers dealing with the Threat System are the exact same in both maps. Sigh.... :banghead:

here's the test map:
 

Attachments

  • Threat system test.w3x
    40.5 KB · Views: 228

tommerbob

Minecraft. :D
Reaction score
110
Since no message was displayed at all, I thought maybe the trigger was not even running. So I changed it to this:

Trigger:
  • Testing
    • Events
      • Player - Player 1 (Red) types a chat message containing -hello as An exact match
    • Conditions
    • Actions
      • Game - Display to (All players) the text: hello!


And guess what? It doesn't run. I have no idea why. I have several chat message triggers that all run perfect, except this one. Why?

Help would be greatly appreciated.

EDIT: I've done some testing. I created a simple trigger exactly like the one above in a blank map. I tested the map. The trigger runs just fine. I then copied the exact trigger to my map, tested it, it will NOT run. sigh.... So then I created several different types of triggers, periodic triggers, spell casting triggers, etc. NONE OF THEM will work.

All original triggers in my map work flawlessly as expected. Any NEW trigger I create WILL NOT WORK.

Again, anyone have any clue why?
 

tommerbob

Minecraft. :D
Reaction score
110
Problem solved!

I did some more testing. I put several actions in a row, to see if any of them would run. Some did, some did not. The actions that did not run were "Game - Display to (All Players) the message:". But all of the others DID run. I thought that was strange, so I changed (All Players) to (Player Group - Player 1) and GUESS WHAT, the actions ran just fine. So I did a quick search here on the site for "all players bug" and I learned something new: Destroying All Players force is a no no! I went back through my triggers and realized that I was destroying the (All Players) Force in my Initialization trigger. Aha!! :p :) :) :)

Edit: Sorry double post.
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • 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!
    +1
  • 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
  • Ghan Ghan:
    Heard Houston got hit pretty bad by storms last night. Hope all is well with TH.
  • The Helper The Helper:
    Power back on finally - all is good here no damage
    +2
  • V-SNES V-SNES:
    Happy Friday!
    +1
  • The Helper The Helper:
    New recipe is another summer dessert Berry and Peach Cheesecake - https://www.thehelper.net/threads/recipe-berry-and-peach-cheesecake.194169/

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top