Triger Leak?

D359

Member
Reaction score
1
Hy I just made a trigered spell for a hero of mine called Style Change.The spell was desinged to add 3 weapon skills to a unit.The spell itself is based of Robo Goblin,so that the player can change the 3 skills gained from my triger with 3 diferent skills.I have 2,posibly 3 problems with this triger.First of all I can't seem to add in the Then section(triger uses If/Then/Else clause)more skills,my second problem is that it lags and it may even cause crashes,I made several more trigers,but I have a feeling that this guy is the problem,and I need your help to confirm it.....I am going to show you the triger now.

Code:
Event:Unit Learns

Condition:(Learned Hero Skill) Equal To Style Change

Action:If (Level of Style Change for (Triggering unit Equal to 1) then do (Unit - Add Basic Spellbook of Two Handed Weapon Style to Triggering unit)) else If (Level of Style Change for (Triggering unit not equal to Equal to 1) then do (Unit - Remove Basic Spellbook of Two Handed Weapon Style to Triggering unit)) else Do Nothing

If (Level of Style Change for (Triggering unit Equal to 2) then do (Unit - Add Advanced Spellbook of Two Handed Weapon Style to Triggering unit)) else If (Level of Style Change for (Triggering unit not equal to Equal to 2) then do (Unit - Remove Advanced Spellbook of Two Handed Weapon Style to Triggering unit)) else Do Nothing

**same thing for level 3

Things you might want to know to understand this spell:

*it is designed for a warrior that uses 2 diferent sets of weapons:two one handed swords and a two handed sword(yeah the elf has exactly 3 swords,and he is quite easy to find on hive)

*I chose robo goblin so that he can change spell books=>that he can change the skills he gains from triger,at will.

*The skills gained via this triger are weapon skills(skills for 2 handed weapon combat and dual wield combat to be precise)

*I don't want this guy to use spell books thats why I want to make this triger add 2 or more skills at once to the trigering unit
 

D359

Member
Reaction score
1
If the triger is good and it dosen't leak could someone at least say so.....so I could try something else to fis my map other than tampering with that thing?
 

jnZ

I
Reaction score
64
Event:Unit Learns

Condition:(Learned Hero Skill) Equal To Style Change

Action
----If (Level of Style Change for (Triggering unit Equal to 1) then
--------do (Unit - Add Basic Spellbook of Two Handed Weapon Style to Triggering unit))
----else
--------If (Level of Style Change for (Triggering unit not equal to Equal to 1)
useless condition check because the else already makes sure that the level is not 1 then
------------do (Unit - Remove Basic Spellbook of Two Handed Weapon Style to Triggering unit))
--------else
------------Do Nothing
----If (Level of Style Change for (Triggering unit Equal to 2) then
--------do (Unit - Add Advanced Spellbook of Two Handed Weapon Style to Triggering unit))
----else
--------If (Level of Style Change for (Triggering unit not equal to Equal to 2)
again useless check just paste the action then
------------do (Unit - Remove Advanced Spellbook of Two Handed Weapon Style to Triggering unit))
--------else
------------Do Nothing

**same thing for level 3

Problem with the trigger:
If the level of the ability is level 2, the way you build your trigger, it firsts removes the level 1 Spellbook and than adds the level 2 spellbook. But i guess at level 2 the hero won't have the level 1 spellbook anyway so maybe you should build your trigger like that:

If ability level 1 then
----add spellbook 1
else
----remove spellbook 1
----if ability level 2 then
--------add spellbok 2
----endif
endif

and so on.
Other than that there is nothing that should be a problem.

The thing is i still don't really get the idea of your trigger and what it is supposed to do. You said something about not wanting to usespellbooks yet your are adding some via this trigger.
It might be easier for me to just paste you a working trigger for a "Style Change" ability that adds certain abilities.
 

D359

Member
Reaction score
1
Let me show you the unit for whom I made this ability this will make things clearer:

http://www.hiveworkshop.com/forums/...word-master-140755/?prev=d=list&r=20&c=10&t=2

The problem with my triger is that it needs spellbooks,because I can't add more than one spell with it,and that ticks me off quite a bit.I was however thinking of making a dumy spell called Skills-with no pics.That way if the main triger of this Style Change adds the Skills <level 1> dummy spell for instance,my second will triger will add the skills,so basicaly mi side triger will look like this.

Code:
Events:Unit Learns a skill

Condition:Ability Learned equal to Skills <level 1 version>

Actions://in this section I will add as many <add spells>actions as I want,problem is that I have no ideea atm how to clean the unit of his skills once the dummy spell that added the skills is removed.

Furthermore I think that an already made triger might help me,but as stated above I am trying to make this triger work without the use of spellbooks,I used the spell book in that code because,as leaky as it was my first code was the most functional Style Change triger I had.

sidenot:Style Change is the short version of Combat Style Change,or Weapon Change
 

jnZ

I
Reaction score
64
i will just make an example here hoping that it hints you into the right direction.

create an ability named "Stance Change" (dummy ability, in this example with 3 levels)
create a global variable named "udg_StanceStatus" as boolean array
create the following triggers

trigger 1 (hero learns "Stance Change")
Code:
Events: 
____hero Learns ability

Conditions: 
____ability learned == "Stance Change"

Actions:
____if (level of "Stance Change" for TriggeringUnit == 1) then [I][COLOR="#66FF66"](the ability was learned for the first time so we add the toggled off abilities)[/COLOR][/I]
________add ability 1 (level 1) OFF
________add ability 2 (level 1) OFF
________add ability 3 (level 1) OFF
____else 
________if (level of Stance Change" for TriggeringUnit == 2) then [I][COLOR="#66FF66"](the ability was already learned (level 1) so we have to check if it was toggled on or off)[/COLOR][/I]
____________if (udg_StanceStatus[PlayerId(OwnerOfUnit(TriggeringUnit))] == false) then [I][COLOR="#66FF66"](ability was toggled off)[/COLOR][/I]
________________remove ability 1 (level 1) OFF
________________remove ability 2 (level 1) OFF
________________remove ability 3 (level 1) OFF
________________add ability 1 (level 2) OFF
________________add ability 2 (level 2) OFF
________________add ability 3 (level 2) OFF
____________else [I][COLOR="#66FF66"](ability was toggled on)[/COLOR][/I]
________________remove ability 1 (level 1) ON
________________remove ability 2 (level 1) ON
________________remove ability 3 (level 1) ON
________________add ability 1 (level 2) ON
________________add ability 2 (level 2) ON
________________add ability 3 (level 2) ON
________else [I][COLOR="#66FF66"](the ability was already learned (level 2) so we have to check if it was toggled on or off)[/COLOR][/I]
____________if (udg_StanceStatus[PlayerId(OwnerOfUnit(TriggeringUnit))] == false) then [I][COLOR="#66FF66"](ability was toggled off)[/COLOR][/I]
________________remove ability 1 (level 2) OFF
________________remove ability 2 (level 2) OFF
________________remove ability 3 (level 2) OFF
________________add ability 1 (level 3) OFF
________________add ability 2 (level 3) OFF
________________add ability 3 (level 3) OFF
____________else [I][COLOR="#66FF66"](ability was toggled on)[/COLOR][/I]
________________remove ability 1 (level 2) ON
________________remove ability 2 (level 2) ON
________________remove ability 3 (level 2) ON
________________add ability 1 (level 3) ON
________________add ability 2 (level 3) ON
________________add ability 3 (level 3) ON

trigger 2 (hero used "Stance Change")
Code:
Events: 
____unit casts an ability

Conditions: 
____ability cast == "Stance Change"

Actions:
____if (udg_StanceStatus[PlayerId(OwnerOfUnit(TriggeringUnit))] == false) then [I][COLOR="#66FF66"](the ability was toggled off)[/COLOR][/I]
________set udg_StanceStatus[PlayerId(OwnerOfUnit(TriggeringUnit))] = true
________if (level of Stance Change" for TriggeringUnit == 1) [I][COLOR="#66FF66"](level 1)[/COLOR][/I]
____________remove ability 1 (level 1) OFF
____________remove ability 2 (level 1) OFF
____________remove ability 3 (level 1) OFF
____________add ability 1 (level 1) ON
____________add ability 2 (level 1) ON
____________add ability 3 (level 1) ON
________else 
____________if (level of Stance Change" for TriggeringUnit == 2) [I][COLOR="#66FF66"](level 2)[/COLOR][/I]
________________remove ability 1 (level 2) OFF
________________remove ability 2 (level 2) OFF
________________remove ability 3 (level 2) OFF
________________add ability 1 (level 2) ON
________________add ability 2 (level 2) ON
________________add ability 3 (level 2) ON
____________else [I][COLOR="#66FF66"](level 3)[/COLOR][/I]
________________remove ability 1 (level 3) ON
________________remove ability 2 (level 3) ON
________________remove ability 3 (level 3) ON
________________add ability 1 (level 3) OFF
________________add ability 2 (level 3) OFF
________________add ability 3 (level 3) OFF
____else [I][COLOR="#66FF66"](the ability was already toggled on)[/COLOR][/I]
________set udg_StanceStatus[PlayerId(OwnerOfUnit(TriggeringUnit))] = false
________if (level of Stance Change" for TriggeringUnit == 1) [I][COLOR="#66FF66"](level 1)[/COLOR][/I]
____________remove ability 1 (level 1) ON
____________remove ability 2 (level 1) ON
____________remove ability 3 (level 1) ON
____________add ability 1 (level 1) OFF
____________add ability 2 (level 1) OFF
____________add ability 3 (level 1) OFF
________else 
____________if (level of Stance Change" for TriggeringUnit == 2) [I][COLOR="#66FF66"](level 2)[/COLOR][/I]
________________remove ability 1 (level 2) ON
________________remove ability 2 (level 2) ON
________________remove ability 3 (level 2) ON
________________add ability 1 (level 2) OFF
________________add ability 2 (level 2) OFF
________________add ability 3 (level 2) OFF
____________else [I][COLOR="#66FF66"](level 3)[/COLOR][/I]
________________remove ability 1 (level 3) ON
________________remove ability 2 (level 3) ON
________________remove ability 3 (level 3) ON
________________add ability 1 (level 3) OFF
________________add ability 2 (level 3) OFF
________________add ability 3 (level 3) OFF

this is how i would create such an ability. i came up with this in some minutes without an world editor so tell me if there are any other problems or if something is unclear but i hope this helps.
 

D359

Member
Reaction score
1
hmm so this skill is for a togleable ability like Immolation,right?Hmm I was using Robo-Goblin,the ultimate of Thinker because its a permanent Methamorphosis,meaning all I had to do was add via triger only the abilities needed for the heros curent model(which is the elf on the right)then when the robo goblin based spell was activated the unit skills would have changed automatic.I will try this code because it may help me with the ultimate for another hero of mine.You have been of great help+ rep as soon as I can for ya mate.If I have any problems with the triger I will PM you for help.
 

jnZ

I
Reaction score
64
it doesnt matter what ability you use. a toggleable like immolation, a regular one, or a shapeshifting one like metamorphosis. the "toggled" states are handled by the global variable anyway. but you might have to change the event condition if you use metamorphosis. i'am not sure if it triggers when you deactivate it the way i posted the trigger.

EDIT: another trigger you might need is one that handles the abilities and sets the global variable if your hero dies/revives. since i don't know the nature of your map i didn't post that one but i am sure if the above posted work for you and you understand them, you will be able to come up with the rest yourself

furthermore i didn't know what kind of spells you wanted to add and how those change if the Stance ability increases in level.
in my example from level 1 - 3 the ability uses 9 different spells. if thats not the case for you and it should just change the level of those abilities you would have to adjust the trigger
 

D359

Member
Reaction score
1
Umm the spell belive or not is exactly what I need,diference is mone uses 6 diferent spells(2 per rank of style change)+the map is similar to dota,as far as the terain and the goal goes,however I find this map with one level above dota due to the more complex item recepe sistem(based on 2 subsistems,curently working on the 3rd)...still something puzzles me about your triger,first thing dose the value of the variable has to be false.And here is my second question,if this map were used in a map similar to dota,what other trigers would I need or better yet why would I need another trigger that handles the abilities and sets the global variable if my hero dies/revives.

New question,just added it via edit:How can I add to the then clause more then one ability?
 

jnZ

I
Reaction score
64
important about the global variable is that it's initially false but thats always the case when you create one and don't change the default value.
other than that the variable translates to "Toggled ON (1 sword Mode?)" and "Toggled OFF (2 sword mode?)"
The toggled off abilties will be added to the hero when he first learns the "Stance Change" ability for the first time, thats why the variable has to be initially false.

After that whenever the hero uses "Stance Change" when the ability was toggled off (variable was false), the abilities change and the variable will be set to true and contrary when it was toggled on (variable was true), the abilities change and the variable will be set to false.
Those lines are:
set udg_StanceStatus[PlayerId(OwnerOfUnit(TriggeringUnit))] = true
and
set udg_StanceStatus[PlayerId(OwnerOfUnit(TriggeringUnit))] = false
so as you can see the variable changes in value to determine if the ability is toggled on or off.
oh and as a sidenote: the variable is an array in order to make the ability usable by more than one player. thats necessary in a DOTA-like map.

the only trigger thats missing for a DOTA-like map, or at least the only one i can currently think of, is the revive/death one.
it would depend how you want to handle the hero revive when the hero died with Stance Change" ability toggled on or off.
if he should always respawn with an toggled-off "Stance Change" you would have to add the correct toggled-off abilitys (depending on skill level) upon revive and set the variable for the owning player to false.
and if you want him to respawn with the stance-status he died with, just check if the variable is true or false when he revives and add the matching abilities (depending on skill level)

you are using the GUI to create your triggers right? just add more conditions the way you added the first one. you dont have to use the "and" condition in the conditions context menu.
 

D359

Member
Reaction score
1
Hmm,I don't think I started working on my respawn triger yet....so acording to your triger,without another triger to control it,if my hero dies in two handed sword mode/1 sword mode and then he revies in 2 sword mode/dualwielding sword mode (both names are good feel free to use whichever you like when you reply),he will have the skills from one sword mode?!Can't I build my way around a control triger by makeing the dumy spell,actualy do something like,say Methamorphose my hero from one sword mode to two sword mode to avoid this,thus,I could make the triger smaller by removing the lines which the abilities from 2 sword mode(1 sword mode being the default mode)and when he dies he revives in one sword mode.The reason why I want to go around this is because,my trigering skill level as a triger maker is somewhere around rock botom and below the rock.If you could help me by teaching me how to make such a triger,then my problems are solved.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top