User Tools

Site Tools


toggleable_skills

Toggleable Skills

By: Wolpak

Notes from Gytfunke

Follow the link to read the discussion as OedipusTex provides some example skill/affix text that will help you wrap your head around this. If you want GUTS files to use as a template, unpak the Wildling or Emberblade custom classes (I'm sure others have used this, too).


Wolpak's Original post: http://forums.runicgames.com/viewtopic.php?f=57&t=57887

October 2013 in GUTS Community Help

I haven't seen this anywhere else, so, if I am repeating something, then laugh and poke at me. If not, then I am glad I figured something out that can really assist in skill creation.

While messing around with sustainable skills, I figured out how to make a toggle. Click the spell once, it turns on, click it again, it turns off. That, coupled with a sustained mana, will allow you to have Dragon Age style sustained skills that use a set amount of mana until you turn them off. In fact, you can even make some skills dependent on other skills. You have flame aura up? Now you cannot cast ice aura until flame aura is turned off.

This is done through stat flags and statwatcher. Now, I am nowhere near as learned in the system here as some of the more avid posters who help, so, I basically trialed and errored my way through this until I got ice shield to go on, and then go off.

First thing is to make a local stat called (toggle) whatever you want. This will let the skill know if you have toggled the skill's variable in the skill. I call it local, because you need to set it back to zero every time you are finished running the skill. Second, make a stat toggle called something like Ice_Shield_Toggle. This will let the skill know if you have Ice Shield on or off. Here is my snippet and I'll try to explain as best as I can.

First, affixes:

Toggle_On

Simply add to your stat.

[AFFIX]
	<STRING>NAME:TOGGLED_ON
	<INTEGER>RANK:0
	<INTEGER>MIN_SPAWN_RANGE:0
	<INTEGER>MAX_SPAWN_RANGE:100
	<FLOAT>DURATION:0
	<INTEGER>WEIGHT:0
	<INTEGER>SLOTS_OCCUPY:0
	[EFFECT]
		<STRING>NAME:Toggled
		<STRING>ACTIVATION:DYNAMIC
		<STRING>TYPE:ADD STAT
		<FLOAT>MIN:1
		<FLOAT>MAX:1
		<FLOAT>CHANCE:100
	[/EFFECT]
[/AFFIX]

Toggle_Off

Simply subtract from your stat.

[AFFIX]
	<STRING>NAME:TOGGLED_OFF
	<INTEGER>RANK:0
	<INTEGER>MIN_SPAWN_RANGE:0
	<INTEGER>MAX_SPAWN_RANGE:100
	<FLOAT>DURATION:0
	<INTEGER>WEIGHT:0
	<INTEGER>SLOTS_OCCUPY:0
	[EFFECT]
		<STRING>NAME:Toggled
		<STRING>ACTIVATION:DYNAMIC
		<STRING>TYPE:ADD STAT
		<FLOAT>MIN:-1
		<FLOAT>MAX:-1
		<FLOAT>CHANCE:100
	[/EFFECT]
[/AFFIX]

Ice_Shield_On

Same.

[AFFIX]
	<STRING>NAME:BERSERKER_ICE_SHIELD_ON
	<INTEGER>RANK:0
	<INTEGER>MIN_SPAWN_RANGE:0
	<INTEGER>MAX_SPAWN_RANGE:100
	<FLOAT>DURATION:0
	<INTEGER>WEIGHT:0
	<INTEGER>SLOTS_OCCUPY:0
	[EFFECT]
		<STRING>NAME:Berserker_Ice_Shield_Toggle
		<STRING>ACTIVATION:DYNAMIC
		<STRING>TYPE:ADD STAT
		<FLOAT>MIN:1
		<FLOAT>MAX:1
		<FLOAT>CHANCE:100
	[/EFFECT]
[/AFFIX]

Ice_Shield_Off

[AFFIX]
	<STRING>NAME:BERSERKER_ICE_SHIELD_OFF
	<INTEGER>RANK:0
	<INTEGER>MIN_SPAWN_RANGE:0
	<INTEGER>MAX_SPAWN_RANGE:100
	<FLOAT>DURATION:0
	<INTEGER>WEIGHT:0
	<INTEGER>SLOTS_OCCUPY:0
	[EFFECT]
		<STRING>NAME:Berserker_Ice_Shield_Toggle
		<STRING>ACTIVATION:DYNAMIC
		<STRING>TYPE:ADD STAT
		<FLOAT>MIN:-1
		<FLOAT>MAX:-1
		<FLOAT>CHANCE:100
	[/EFFECT]
[/AFFIX]

Now comes the hard part. The skill. The premise of how this works is to use the logic that statwatchers gives us. It allows us to determine if code is run based on a variable.

I'll try to break it into pieces, but if you put it all together, it would be the entire code.

[LEVEL1]
	<TRANSLATE>DESCRIPTION:20% chance to generate |c00ff9933Charge|u when struck
	<FLOAT>RANDOMRANGE:0
	[EVENT_TRIGGER]
		<STRING>FILE:media/skills/berserker/iceshield/iceshield.layout
		<BOOL>STATSHIDDEN:1
		[AFFIXES]
			<INTEGER>AFFIXLEVEL:1
			<STRING>TARGET:SELF
			<STRING>AFFIX:BERSERKER_ICE_SHIELD_OFF
			<STRING>AFFIX:TOGGLED_ON 
			<STRING>AFFIX:BERSERKER_ICESHIELD 
			<STRING>AFFIX:SUSTAINED_MANA_ICESHIELD_1 
		[/AFFIXES]
		[STATWATCHER]
			<STRING>STAT:Berserker_Ice_Shield_Toggle
			<STRING>PRIMARY_TARGET_TYPE:SELF
			<STRING>SECONDARY_TARGET_TYPE:VALUE
			<STRING>WATCH_TYPE:EQUAL TO
			<FLOAT>SECONDARY_VALUE:0
		[/STATWATCHER]
		[STATWATCHER]
			<STRING>STAT:Toggled
			<STRING>PRIMARY_TARGET_TYPE:SELF
			<STRING>SECONDARY_TARGET_TYPE:VALUE
			<STRING>WATCH_TYPE:EQUAL TO
			<FLOAT>SECONDARY_VALUE:0
		[/STATWATCHER]
	[/EVENT_TRIGGER] 

In this snippet, I have 2 statwatchers. The first statwatcher checked for toggled. If it is 0, then proceed. Since toggled will ALWAYS be 0 at the start of a skill (unless you screwed up the code), it will always proceed here. It is actually not necessary because of the above statement, but in terms of programming and understanding the code, I like that it is here.

I do not know which statwatcher is called first, and it isn't a big deal, but I will presume it starts with the bottom one. The next statwatcher checks for the Ice_Shield_Toggle. Assuming you never cast Ice Shield, it should be 0 and it will proceed to the affixes.

The 4 affixes I have called are:

AFFIX:ICE_SHIELD_OFF

This affix I posed in the previous message and it toggles ICE_SHIELD_TOGGLE by -1, thus setting it to 0 (which is off).

AFFIX:TOGGLED_ON This affix toggles “toggle” to the on position. This is important so that the skill knows to ignore the next set of code.

AFFIX:BERSERKER_ICESHIELD

This affix gives the Berserker his ice shield.

AFFIX:SUSTAINED_MANA_ICESHIELD_1

This is my sustained mana affix that just simply subtracts a set amount of mana from MAX_MANA. Before the spell, you had 100, now you have 80. If you do use a sustained mana, make sure you remove the mana cost so that you aren't double taxed.

	[EVENT_TRIGGER]
		<BOOL>STATSHIDDEN:1
		[AFFIXES]
			<STRING>TARGET:SELF 
			<STRING>AFFIX:BERSERKER_ICE_SHIELD_ON
			<STRING>AFFIX:TOGGLED_ON
		[/AFFIXES]
		[AFFIXESREMOVE]
			<INTEGER>AFFIXLEVEL:1
			<STRING>TARGET:SELF
			<STRING>AFFIX:BERSERKER_ICESHIELD
			<STRING>AFFIX:SUSTAINED_MANA_ICESHIELD_1
		[/AFFIXESREMOVE]
		[STATWATCHER]
			<STRING>STAT:Berserker_Ice_Shield_Toggle
			<STRING>PRIMARY_TARGET_TYPE:SELF
			<STRING>SECONDARY_TARGET_TYPE:VALUE
			<STRING>WATCH_TYPE:EQUAL TO
			<FLOAT>SECONDARY_VALUE:1
		[/STATWATCHER]
		[STATWATCHER]
			<STRING>STAT:Toggled
			<STRING>PRIMARY_TARGET_TYPE:SELF
			<STRING>SECONDARY_TARGET_TYPE:VALUE
			<STRING>WATCH_TYPE:EQUAL TO
			<FLOAT>SECONDARY_VALUE:0
		[/STATWATCHER]
	[/EVENT_TRIGGER] 

Here you will see almost the same code, but first, the statwatcher is checking to see if the toggle happened up higher. If it did, then it doesn't proceed. Very important, as with no toggle, the skill won't know that you ran the shield on or off prior and it will switch it again, which, really ends up doing nothing. The second statwatcher checks to see if Ice_Shield_Toggle is on. If so, it proceeds to then turn it off.

The affixes called are

AFFIX:ICE_SHIELD_ON
AFFIX:TOGGLED_ON

This lets the code know to toggle Ice_Shield_Toggle and toggle to on. Toggle actually doesn't need to be set to on since this is the last step of the code. Had you made more than 2 pieces, then this would need to be toggled, but the last one never. However, as I said before, I like to keep things in harmony. You do what you want.

The affixes removed are:

AFFIX:BERSERKER_ICESHIELD
AFFIX:SUSTAINED_MANA_ICESHIELD_1

No more ice shield :( and no more mana sustain :)

Last bit of code:

	[EVENT_TRIGGER]
		[AFFIXES]
			<STRING>TARGET:SELF
			<STRING>AFFIX:TOGGLED_OFF
		[/AFFIXES]
	[/EVENT_TRIGGER]
[/LEVEL1] 

This simply resets toggled to off. This is done so, a) you can reuse toggle in all skills since it is just a local variable (that is a variable that only has value in the script where it is run) and b) it doesn't mess up next time you toggle your iceshield.

So, I don't know if this has been done before, but it is all new to me and it makes me excited. Of course, implementing it will be a , but whatevs. Hopefully it will help the community and add more variety in our mods.

*Note: I see that there were some attempts before and done in different ways. I think this way is the cleanest as it maintains 1 skill and just uses flags.

So, to sum up this is what you need:

For the toggle:

Stat called toggle
2 affixes, 1 to turn the toggle on and off

For each skill:

Stat called skill_toggle.
2 affixes to toggle the skill_toggle on and off.

Edit the skill with a statwatcher for the toggle and the skill_toggle with the result being what the skill does and removing the skill.

You can make this as complex as you want. You could make a skill that does something different on each press. First press it does one thing, second press it does another. Even better, if you set a min and a max for the toggle, you could make wild Mage type spells where you have no idea what will be cast(well, like 1 out of 4 possibilities). This adds a very useful function to the toolset.

If you are interested, I have finished making ice shield, battle rage and storm claw as permanant toggleables.

The mod can be found here

If you do use this method, a shoutout to Wolpak would make my kids proud of their papa.

toggleable_skills.txt · Last modified: 2018/03/05 20:24 by phanjam