• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

Custom Value

Status
Not open for further replies.
Level 7
Joined
Jun 16, 2008
Messages
253
I'm using a system on my map that changes the custom value of units in order to tell triggers considering them for use that they are either busy or idle, etc...

But if I put Set Custom Value to 1 at beginning of actions, and then Set Custom Value to 0 at the end. But only the first value sticks and he stays 1.

It seems I can change back and forth between 0 and 1 with some chat triggers, but I really need to be able to do it within one trigger.

Is this not possible?
 
Level 17
Joined
Apr 13, 2008
Messages
1,597
I'm using a system on my map that changes the custom value of units in order to tell triggers considering them for use that they are either busy or idle, etc...
Why? Why don't you simply ask their current order and if it's other than 'idle' they are busy.
Custom unit value is too valuable (no pun intended) to waste it on such thing. Well your map, your call.

But if I put Set Custom Value to 1 at beginning of actions, and then Set Custom Value to 0 at the end. But only the first value sticks and he stays 1.

It seems I can change back and forth between 0 and 1 with some chat triggers, but I really need to be able to do it within one trigger.

Is this not possible?
You are doing something wrong. Your triggers are bad. You can change the custom value as many times as you want, there isn't any limitation to it, really.
 
Level 7
Joined
Jun 16, 2008
Messages
253
Because being busy will entail a large number of things. It may be that the current order of the unit is stop, as you can see in the trigger below. I need to be able to exclude any units that currently are being used in a trigger, and custom value is the best way to do it because it avoids unnecessary arrays.
That's valuable enough in my opinion as it is essential to the game.


  • Event- A unit starts channeling Work
  • (Seperate set of If/then/else here.)
  • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • (Ability being cast) Equal to (==) Work
      • (Custom value of (Triggering unit)) Equal to (==) 0
    • Then - Actions
      • Unit - Set the custom value of (Triggering unit) to 1
      • Unit Group - Remove (Triggering unit) from IdleUnitGroup
      • Unit Group - Add (Triggering unit) to BusyUnitGroup
      • Animation - Queue (Casting unit)'s Animation - Stand Work animation
      • Wait until (((Casting unit) is in (Units within 70.00 of (Target point of ability being cast))) Equal to (==) True), checking every 0.10 seconds
      • Unit - Order (Casting unit) to Hold Position
      • Animation - Play (Casting unit)'s Animation - Stand Work animation
      • Wait 5.00 seconds
      • Animation - Reset (Casting unit)'s animation
      • Unit - Order (Casting unit) to Move To (Position of home[(Player number of (Owner of (Casting unit)))])
      • Wait until ((Distance between (Position of (Casting unit)) and (Position of home[(Player number of (Owner of (Casting unit)))])) Less than or equal to (<=) 70.00), checking every 0.10 seconds
      • Unit - Order (Casting unit) to Stop
      • Unit - Set the custom value of (Triggering unit) to 0
    • Else - Actions
The custom value does not change back to 0, I've checked that with other triggers. If you can see why please let me know because nothing I've tried seems to work. Is it a JassNewGen thing?
I can't see how the quality of a trigger would affect the set custom values anyway, trigger looks fine to me otherwise.
 
Level 23
Joined
Nov 29, 2006
Messages
2,482
I believe the reason could be the fact that you are using "casting unit" sometimes, and "triggering unit" some... While Casting unit is a referal to triggering unit (or is it the other way around...nvm), Casting unit is a global unit. This means that whenever a trigger is registring a unit event used by starts/stops/channels/finish an ability, casting unit will be overwritten.
Therefor, as a conclusion: Use Only triggering unit to a unit event like this, since casting unit == triggering unit but triggering unit will stay through the whole trigger til it has ran all the codes.

I dont know at the moment weather TargetPointofAbilityBeing cast will work in the same dumb way as "casting unit".

Anyway the casting unit could be the reason since the unit is overwritten and therefor will not execute the "wait until..." actions...

Hope you got something clear from this... Im so tired I could sleep at any minute...Zzz
/Regards
 
Level 7
Joined
Jun 16, 2008
Messages
253
Well that clears up some other issues I've had in the past with the whole casting thing, but that shouldn't be the problem with this one. It's just a one shot trigger, and I switched everything over to trigger to test it.
Also, even directly selecting the unit via the trigger has no effect, in the famous words of that dude on Starcraft "once started, there is no going back!"
:(
I be confusticated.
 
Level 7
Joined
Jun 16, 2008
Messages
253
Problem solved. Lol. The latter part of the trigger is a wait till unit is within 70 range of home structure, but the collision size of that structure was 72 lol. So that was the only problem.
 
Status
Not open for further replies.
Top