• 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.

[Solved] Setting research back to 0?

Status
Not open for further replies.
Level 13
Joined
Mar 24, 2010
Messages
950
  • Player - Set the current research level of Iron Forged Swords to 0 for Player 1 (Red)
that doesnt work, once its learned that trigger cant "unlearn" the research so how do i set it back to 0 if need be?
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,258
WC3 was not made to support unresearching technologies. If you want that functionality you will have to use a game like SC2 where blizzard did decide to support unresearching technologies.

If you really must use WC3, you will have to use a script system that emulates the upgrade with bummy abilities and widgets. Eg, the research button could be a train unit and the technology effects could be applied to the appropiate units via a trigger in the form of a passive ability that is hidden (via hidden spell book). The solution is by no means neat.
 
Level 13
Joined
Mar 24, 2010
Messages
950
reason i ask this is because i was thinking this had something to do with my desync problem.. i thought maybe something freaked out when i upgraded 15 attack and defense.. it only goes nuts on that trigger and i dont even use timed events anymore it all runs off a timer now.


  • Upgrade Timer 150
    • Events
      • Time - Every 155.00 seconds of game time
    • Conditions
    • Actions
      • Set AI_Upgrade_Counter = (AI_Upgrade_Counter + 1)
      • Game - Display to Player Group - Player 1 (Red) for 2.00 seconds the text: (String(AI_Upgrade_Counter))
      • Trigger - Run AI_Upgrade_Triggers[AI_Upgrade_Counter] (checking conditions)
so anyway my first test what i did is in map initialization i had it upgrade 1-25 in a loop to all comps and then set it back to 0 (before i realized i couldn't) lol
well in game on the first test on bnet it was going fine for a little but then it went nuts and desync'ed everyone on this trigger here at the exact time this trigger goes off. (its never ever done it that early in game before i made that change)
reason it did this i think is becuz all units had 25 attack and 25 defense and i tried making it upgrade to 2


  • Upgarde 2
    • Events
    • Conditions
    • Actions
      • Player Group - Pick every player in AI_CompsGroup_NonEasy and do (Actions)
        • Loop - Actions
          • Player - Set the current research level of Iron Forged Weapons to 2 for (Picked player)
          • Player - Set the current research level of Iron Plating to 2 for (Picked player)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Player 1 (Red) controller) Equal to User
          • (Player 2 (Blue) slot status) Equal to Is unused
          • (Player 3 (Teal) slot status) Equal to Is unused
        • Then - Actions
          • Set Temp_UnitGroup2 = (Units in (Playable map area) matching ((((Owner of (Matching unit)) controller) Equal to Computer) and ((Unit-type of (Matching unit)) Equal to Scout Tower)))
          • Unit Group - Pick every unit in Temp_UnitGroup2 and do (Actions)
            • Loop - Actions
              • Set Temp_Integer = (Random integer number between 1 and 10)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • Temp_Integer Greater than 4
                • Then - Actions
                  • Unit - Order (Picked unit) to train/upgrade to a Arcane Tower
                • Else - Actions
          • Custom script: call DestroyGroup (udg_Temp_UnitGroup2)
        • Else - Actions
So what i'm thinking is.. when trying to make player upgrade to a lower tech than they are at.. Its flips out and desyncs ppl.. but i dont think i make this mistake anywhere so i still dont know why its desyncing.. -.-


*above is in reference to this: http://www.hiveworkshop.com/forums/triggers-scripts-269/desync-prob-206675/

Edit:
also a quick question, i know timers run still even if the trigger is off the whole game, if certain triggers arnt going to be used anymore after a certain amount of times should i use this to kill off triggers?
call DestroyTrigger( GetTriggeringTrigger())

also if i wanted to kill other triggers at a certain time all in one trigger would it work like this:
call DestroyTrigger( GetUpgarde 2Trigger() )
call DestroyTrigger( GetUpgarde 3Trigger() )
call DestroyTrigger( GetUpgarde 4Trigger() )
etc..?
 
Last edited:

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,258
Timers have their own destructors.
JASS:
native DestroyTimer takes timer whichTimer returns nothing
Be aware that if the timer is currently opperating you will need to pause the timer before destroying otherwise it will fire 1 more time (which can cause obscene bugs and even crashes if you do not expect it).

DestroyTrigger has its own risks. Destroying a trigger which you can definitivly predict its state is safe (such as destroying a timer event driven trigger after the timer is paused and destroyed). Triggers driven by events that can be interupted by the DestroyTrigger() call (such as Unit Takes Damage events) are not safe and can cause fatal errors.

I still think the player slot comparisions might have something to do with your desync. Try running the trigger for all players (human and AI) to see if it still occurs.

I do not understand why you are not debugging the script by disabling parts until the desync stops.
 
Level 13
Joined
Mar 24, 2010
Messages
950
I am starting to do that now, i just wanted to make sure it wasnt timing events or some weird stuff like that.. the main prob is and the reason i havent been turning off triggers till it stops is it follows upgrade 15 whatever time i move it too.. it desyncs at that time, it was moved to like 23.8mins and thats when it desynced.. also it was at 25 mins and desynced at that time, i even put a message to know 100% sure it desyncs at that time and it does.. LOL this trigger literally has nothing in it.. Its just cursed..

This is the trigger it desyncs on
  • Upgarde 15
    • Events
    • Conditions
    • Actions
      • Game - Display to Player Group - Player 1 (Red) for 10.00 seconds the text: Desync?
      • Player Group - Pick every player in AI_CompsGroup_NonEasy and do (Actions)
        • Loop - Actions
          • Player - Set the current research level of Iron Forged Weapons to 15 for (Picked player)
even got the message in there to make sure it happens at that exact trigger.. lmao can you believe it? there is 0 things wrong with that.. -.-


Oh also i wasnt talking about destroying timers i was talking about destroying triggers with timing events. like this: Time - Every 90.00 seconds of game time
that kinda thing.. those arnt safe to destroy eh?
would it be safe to destroy triggers with a repeating time event if i turned the trigger off first?
 
Last edited:

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,258
Oh also i wasnt talking about destroying timers i was talking about destroying triggers with timing events. like this: Time - Every 90.00 seconds of game time
that kinda thing.. those arnt safe to destroy eh?
Those are safe to destroy unless you destroy them from another thread that can fire randomly. As far as people have reported, the fault is with events that are in the process of firing getting destroyed by their bound trigger's destruction.
 
Level 13
Joined
Mar 24, 2010
Messages
950
ok so if i wanted to kill certain triggers at a certain time when they arnt running anymore but i want to do it from another trigger how would the jass script look?

would it be this?

call DestroyTrigger( GetTrigger ExampleNameATrigger() )
call DestroyTrigger( GetTrigger ExampleNameBTrigger() )
call DestroyTrigger( GetTrigger ExampleNameCTrigger() )
etc..
or is that wrong? or is it not possible to destroy triggers from another trigger, aka only possible to use this: call DestroyTrigger( GetTriggeringTrigger())
 
You can destroy it from another trigger, but it useless really, you won't increase performance so much or things like that. Also if you remove some functions used by other triggers you can crush game later or create bugs.

Also destroy trigger will just remove some code from your map, effects and actions created with that trigger will still remain.

My suggestion is leave it be :)
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,258
You can destroy it from another trigger, but it useless really, you won't increase performance so much or things like that. Also if you remove some functions used by other triggers you can crush game later or create bugs.

Also destroy trigger will just remove some code from your map, effects and actions created with that trigger will still remain.
I would like to point out that once a trigger has become unreachable (eg a trigger that only is able to fire once) it is classed as a memory leak.
 
Level 13
Joined
Mar 24, 2010
Messages
950
I think you're right kobas with most triggers, but things like "Time - Every 30.00 seconds of game time" run for the whole game even if the trigger is off so that can create alot of overhead in my case, because i have alot of modes to choose from in the start of the game.
and if those modes are never chosen that game some of those triggers that use timers are always running in case they are needed when turned on, but they will never be needed becuz they are inaccessible after 3 mins of game time. So i figure might as well get rid of them if it can improve performance

so i need to know how to make something like this work from other triggers for specific triggers
call DestroyTrigger( GetTriggeringTrigger())
i need help with the syntax
 
You mean this:
JASS:
//==============================================================================
//  Library creates invisible sun and moon units for all players.
//  These units are then used as tech requirements for spells.
//  If a player has a sun unit in his ownership than he can use sun spells.
//  Same goes for moon ofc.
//  Sun units are owned by players only during day time.
//  Moon units are owned by players only during night time.
//==============================================================================
library Daytime initializer Init uses Trig

globals
    private constant player NEUTRAL = Player(13)
    private unit array sun
    private unit array moon
endglobals


//==============================================================================
//  For testing purposes
//==============================================================================
public function Off takes nothing returns nothing
    local integer i = 0
    loop
        exitwhen i>=12
        call SetUnitOwner(sun[i], NEUTRAL, false)
        call SetUnitOwner(moon[i], NEUTRAL, false)
        set i = i + 1
    endloop
endfunction

//==============================================================================
private function Dawn takes nothing returns nothing
    local integer i = 0
    loop
        exitwhen i>=12
        call SetUnitOwner(sun[i], Player(i), false)
        call SetUnitOwner(moon[i], NEUTRAL, false)
        set i = i + 1
    endloop
endfunction

//==============================================================================
private function Dusk takes nothing returns nothing
    local integer i = 0
    loop
        exitwhen i>=12
        call SetUnitOwner(moon[i], Player(i), false)
        call SetUnitOwner(sun[i], NEUTRAL, false)
        set i = i + 1
    endloop
endfunction

//==============================================================================
public function isDay takes nothing returns boolean
    return (GetTimeOfDay() >= 6.00) and (GetTimeOfDay() < 18.00)
endfunction

//==============================================================================
private function Actions takes nothing returns nothing
    if isDay() then
        call Dawn()
    else
        call Dusk()
    endif
endfunction

//==============================================================================
private function Init takes nothing returns nothing
    local trigger trig
    local item it
    
    local integer i = 0
    loop
        exitwhen i>=12
        set sun[i] = CreateUnit(NEUTRAL, UID_sun, 0-i*100, 0, 0)
        set moon[i] = CreateUnit(NEUTRAL, UID_moon, 0+i*100, 0, 0)
        call PauseUnit(sun[i], true)
        call PauseUnit(moon[i], true)
        set i = i + 1
    endloop
    
    // empire sun gets all map regen aura, scourge moon gets all map regen aura
    call UnitAddAbility(sun[Players_EMPIRE], AID_sun_aura)
    call UnitAddAbility(moon[Players_SCOURGE], AID_moon_aura)
    
    call Trig_TimeOfDay(function Dawn, 6.00)
    call Trig_TimeOfDay(function Dusk, 18.00)    
    call Trig_TimerSingle(function Actions, 0.01)
endfunction

endlibrary

Sorry buddy but you are wrong.
It just add or remove REQUIREMENTS for some event created.

UPGRADES are totally different thing.
 
Level 6
Joined
Jun 16, 2007
Messages
235
Sorry buddy but you are wrong.
It just add or remove REQUIREMENTS for some event created.

UPGRADES are totally different thing.

I am not your buddy.
And Upgrades are just Requirement + Bonus.

This method has been used for years to add resettable upgrades to heroes.
One classic example is ENFO map.

PS: Just because you don't know or can't do something does not mean anyone else can't.

EDIT:
It just add or remove REQUIREMENTS for some event created.
This is false. You didn't even run the map to see how this method works did you?
 
When you RESEARCH Iron Sword upgrade for red player, all units (Knights for example) will have increased damage by some value. Also you will see number 1 as index on damage icon!

This can't be reversed!

  • Example
    • Events
      • Map initialization
    • Conditions
    • Actions
      • -------- WORK --------
      • Player - Set the current research level of Iron Forged Swords to 1 for Player 1 (Red)
      • Wait 1.00 seconds
      • -------- WORK --------
      • Player - Set the current research level of Iron Forged Swords to 2 for Player 1 (Red)
      • Wait 1.00 seconds
      • -------- WORK --------
      • Player - Set the current research level of Iron Forged Swords to 3 for Player 1 (Red)
      • Wait 1.00 seconds
      • -------- DO NOT WORK --------
      • Player - Set the current research level of Iron Forged Swords to 2 for Player 1 (Red)
      • Wait 1.00 seconds
      • -------- DO NOT WORK --------
      • Player - Set the current research level of Iron Forged Swords to 1 for Player 1 (Red)
      • Wait 1.00 seconds
      • -------- DO NOT WORK --------
      • Player - Set the current research level of Iron Forged Swords to 0 for Player 1 (Red)
If you add ability to unit that increase damage by some value, and make it that way, that ability require some unit (Town Hall for example) to be used, you will be able to create that REQUIREMENT (Town Hall unit in our example) and trigger ability ON or OFF.

Here I change Footman Defend ability requirement from UPGRADE to KNIGHT unit. (IT WORKS)
  • Example
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Unit - Create 1 Knight for Player 1 (Red) at (Center of (Playable map area)) facing Default building facing degrees
      • Wait 1.00 seconds
      • Unit - Remove (Last created unit) from the game
      • Wait 1.00 seconds
      • Unit - Create 1 Knight for Player 1 (Red) at (Center of (Playable map area)) facing Default building facing degrees
      • Wait 1.00 seconds
      • Unit - Remove (Last created unit) from the game
      • Wait 1.00 seconds
      • Unit - Create 1 Knight for Player 1 (Red) at (Center of (Playable map area)) facing Default building facing degrees
      • Wait 1.00 seconds
      • Unit - Remove (Last created unit) from the game
I know what I'm saying, you are the one who act smart!
 

Attachments

  • testmap.w3x
    16.8 KB · Views: 48
Level 6
Joined
Jun 16, 2007
Messages
235
Level 37
Joined
Mar 6, 2006
Messages
9,243
What is called a research in triggering, is called an upgrade in object editor.

  • Untitled Trigger 017
    • Events
      • Unit - A unit Finishes research
    • Conditions
      • (Researched tech-type) Equal to Iron Forged Swords
    • Actions
      • Game - Display to Player Group - Player 1 (Red) the text: finish
IFS is an upgrade. Those are what I'm talking about.

Ugrades in triggering, are units upgrading to other units. Like scout tower into a guard tower.
 
Level 6
Joined
Jun 16, 2007
Messages
235
Show us how then, triggers, script, test map, I don't care!
My whole map is open-source, and you already posted the trigger yourself.
It even has comments jeez.

I guess the problem here is that my whole map is in vJass while you people speak only in GUI language...

I don't make tutorials for GUI so I guess you will have to Upgrade your mapmaking skills by Researching my map. :ogre_hurrhurr:
 
This slowly start to go on my nerves -.-
My whole map is open-source, and you already posted the trigger yourself.
It even has comments jeez.
With my English knowledge this:
If a player has a sun unit in his ownership than he can use sun spells.
equal to my theory here:
Here I change Footman Defend ability requirement from UPGRADE to KNIGHT unit. (IT WORKS)
So you just mixed object requirements with object research/upgrades.

One more time, player option to build, train, use ability, buy item etc etc can be turned on and off with right REQUIREMENT, now this requirement can be:
Another unit, ability, item or even RESEARCH/UPGRADE.

Everything listed above as units, items etc can be created, edited or removed anytime, so you can turn that player option ON or OFF, but if you research some tech like Iron Forget Swords, or Unit Inventory or any other RESEARCH/UPGRADE you won't be able to reverse process.

I guess the problem here is that my whole map is in vJass while you people speak only in GUI language...
Your vJass is horrible, it look more like jass with some elements of vJass, like globals.
Maybe you should ask Maker, he is far more skilled than I'm in this field so I just won't bother.
Also do not question our GUI skills, I can code your vJass with GUI easily.
I don't make tutorials for GUI so I guess you will have to Upgrade your mapmaking skills by Researching my map.
Well I make, and you know what, people appreciate that, tutorials are created so people can learn, if you understand idea, code shape isn't important, GUI, jass etc.

And 1 last thing your mapping skills aren't so great, it's you who need to work on upgrading them.
To make simple review:

- Terrain is horrible, simple tiles + fail ramps (enough for rejection)
- Game Setup is horrible, no game modes, no difficulties, no special events, 1 hero only etc
- Spells are bad hero has 3 autocast spells, this is unacceptable.
- No unique systems, quests etc etc...

Please
 
Level 6
Joined
Jun 16, 2007
Messages
235
Personal attacks yay.

Btw you are commenting on my open-source minigame.
All the stuff you mentioned have no relation to the purpose of game or are that way by desing. (Btw it took me whole 15 days to make it.)

And your comments on my coding are a pure lol.

But I guess I started it being a snob towards GUI coders and all that.
I apologize to all who got offended.
(except -Kobas- of course, I just like pissing off people like him too much.)
 
Level 13
Joined
Mar 24, 2010
Messages
950
lmao i <3 you guys.. cracks me up..

but the argument over the setting units research/upgrades back is that there is no argument to be had, it cant be done :/ lol.

I see the little work around that cohadar did but that is something other than what i needed thx anyways tho
 
Status
Not open for further replies.
Top