Logical Combat, Passing Values to Other Functions

mmoaddict

Original Script Author: VGA
With changes to our game, it is becoming more and more difficult to simply hit the mob with any old ability. You will eventually have to develop a way to centralize how you check if you should hit an ability. To that end, i want to plant an idea in your head if you are using script similar this..

Code:
function attack()
{
		If ${Me.Ability[${Ability1}].IsReady}
			{
			Me.Ability[${Ability1}]:Use
			call MeCasting
			}
		elseIf ${Me.Ability[${Ability2}].IsReady}
			{
			Me.Ability[${Ability2}]:Use
			call MeCasting
			}
		elseIf ${Me.Ability[${Ability3}].IsReady}
			{
			Me.Ability[${Ability3}]:Use
			call MeCasting
			}
}

function MeCasting()
{
                wait 3
	while ${Me.IsCasting}
	{
		wait 1
	}

	while ${VG.InGlobalRecovery}
	{
		wait 1
	}

	while ${Me.ToPawn.IsStunned}
	{
		wait 1
	}
                wait 3
}
consider a change and route all your abilities through a central function. This will allow you to check to make sure you should cast that ability and later you can add a feature that can even make sure that if it is an ice based ability, that you dont use it on a mob that is healed by ice (but that is further down the road)

Code:
function attack()
{
          Call DoAbility "${attack1}"
          Call DoAbility "${attack2}"
          Call DoAbility "${attack3}"
}

function DoAbility(string ability)
{
        if ${Me.Ability[${ability}].IsReady}
                  {
                  Me.Ability[${ability}]:Use
                  call MeCasting
                  }

}
function MeCasting()
{
                wait 3
	while ${Me.IsCasting}
	{
		wait 1
	}

	while ${VG.InGlobalRecovery}
	{
		wait 1
	}

	while ${Me.ToPawn.IsStunned}
	{
		wait 1
	}
                wait 3
}
Now all you "Experts" out there will hack on me for not using a loop. Ya Ya... you gotta crawl first. Perhaps one of the other guys will take some time and explain how looping works.

Anyway, for those of you that are just working on customizing things like vgshaman, this should help you take steps to really focusing the logic of your script to allow for future filters and routines. Hope it helps someone out there.

mmo
 

MstrGareth

Active Member
The biggest problem with selecting proper damage/debuff types is knowing what every ability uses for its resist check. The vast majority are very unclear so lots of trial and error.

A master list would be extremely helpful if you wanted to undertake such a task :)
 

mmoaddict

Original Script Author: VGA
This is correct... The game doesnt even report to the client the kind of data you are looking for. So here is what i did. Instead of creating a static system where i have to know everying. I needed something i could change organically

First i made 2 screens in the UI. Each with 5 List Boxes
Mobs
Fire
Ice
Spiritual
Physical
Mental

Abilities
Fire
Ice
Spiritual
Physical
Mental

Lets say you are out in SoD Fighting and you see that your "Fire BoomBoom" ability heals the mod named "Omac". You add Omac to the Fire List on the Mobs Screen and you add "Fire BoomBoom" to the fire list on the Abilities Screen.

Now using my sample above.. add this just before you execute the ability
Code:
	call mobresist "${ability}"
	if ${Return}
	{
                         if ${Me.Ability[${ability}].IsReady}
                        {
                        Me.Ability[${ability}]:Use
                        call MeCasting
                         }
                 }
Then make a new function that checks to make sure that the ability type your casting matches the type of mob you are trying to kill. If it does Return "FALSE" if it doesnt match Return "TRUE"

Code:
Function:bool mobresist(string x_ability)
{
	variable iterator Iterator
	If ${MobResists.Fire}
		{
		FireA:GetSettingIterator[Iterator]
		Iterator:First
		while ( ${Iterator.Key(exists)} )
		{
			if ${x_ability.Equal[${Iterator.Key}]}
				{
				debuglog "NO FIRE!!!"
				return FALSE
				}
		Iterator:Next
		}
		}

	If ${MobResists.Ice} 
		{
		IceA:GetSettingIterator[Iterator]
		Iterator:First
		while ( ${Iterator.Key(exists)} )
		{
			if ${x_ability.Equal[${Iterator.Key}]} 
				{
				debuglog "No ICE!!!"
				return FALSE
				}
		Iterator:Next
		}
		}
	If ${MobResists.Spiritual} 
		{
		SpiritualA:GetSettingIterator[Iterator]
		Iterator:First
		while ( ${Iterator.Key(exists)} )
		{
			if ${x_ability.Equal[${Iterator.Key}]} 
				{
				debuglog "No Spiritual!!!"
				return FALSE
				}
		Iterator:Next
		}
		}
	If ${MobResists.Physical} 
		{
		PhysicalA:GetSettingIterator[Iterator]
		Iterator:First
		while ( ${Iterator.Key(exists)} )
		{
			if ${x_ability.Equal[${Iterator.Key}]} 
				{
				debuglog "No PHYSICAL!!!"
				return FALSE
				}
		Iterator:Next
		}
		}
	If ${MobResists.Arcane}
		{
		ArcaneA:GetSettingIterator[Iterator]
		Iterator:First
		while ( ${Iterator.Key(exists)} )
		{
			if ${x_ability.Equal[${Iterator.Key}]} 
				{
				debuglog "NO ARCANE!!!"
				return FALSE
				}
		Iterator:Next
		}
		}
	return TRUE
}
oh and i guess i made an object to check what the mob resists

Code:
objectdef MobResists
{
	member:bool Fire()
	{
		variable iterator Iterator
		Fire:GetSettingIterator[Iterator]
		Iterator:First
		while ( ${Iterator.Key(exists)} )
		{
			if ${Me.Target.Name.Equal[${Iterator.Value}]} 
				return TRUE
		Iterator:Next
		}
	return FALSE
	}

	member:bool Ice()
	{
		variable iterator Iterator
		Ice:GetSettingIterator[Iterator]
		Iterator:First
		while ( ${Iterator.Key(exists)} )
		{
			if ${Me.Target.Name.Equal[${Iterator.Value}]} 
				return TRUE
		Iterator:Next
		}
	return FALSE
	}
	member:bool Spiritual()
	{
		variable iterator Iterator
		Spiritual:GetSettingIterator[Iterator]
		Iterator:First
		while ( ${Iterator.Key(exists)} )
		{
			if ${Me.Target.Name.Equal[${Iterator.Value}]} 
				return TRUE
		Iterator:Next
		}
	return FALSE
	}

	member:bool Physical()
	{
		variable iterator Iterator
		Physical:GetSettingIterator[Iterator]
		Iterator:First
		while ( ${Iterator.Key(exists)} )
		{
			if ${Me.Target.Name.Equal[${Iterator.Value}]} 
				return TRUE
		Iterator:Next
		}
	return FALSE
	}

	member:bool Arcane()
	{
		variable iterator Iterator
		Arcane:GetSettingIterator[Iterator]
		Iterator:First
		while ( ${Iterator.Key(exists)} )
		{
			if ${Me.Target.Name.Equal[${Iterator.Value}]} 
				return TRUE
		Iterator:Next
		}
	return FALSE
	}
	
}

variable MobResists MobResists
There you have it.. an organically buildable list of what spells classify as what resists and what mobs are healed by those spells.
 

Zandros

Script Author: VGA
Totally awsome... I like that idea!

I went the short easy route which you will have to toggle on/off to use that type of ability. To show you what I am talking about this is what I did:

Here is a snippet to add one toggle button to your UI: (my program is called RAID and the button is to toggle Physical type abilities on/off)
Code:
<checkbox Name='chkDoPhysical' Template='VG.GreenCheckbox'>
	<visible>1</visible>
	<X>5%</X>
	<Y>55%</Y>
	<Width>15</Width>
	<Height>20</Height>
	<Text>Physical</Text>
	<OnLoad>
		if ${Script[RAID].VariableScope.DoPhysical}
		{
			This:SetChecked
		}
	</OnLoad>
	<OnLeftClick>
		Script[RAID].VariableScope.DoPhysical:Set[${This.Checked}]
	</OnLeftClick>
</checkbox>
Next, is a snippit from my RAID script you would call that checks if the Ability matches the DoPhysical flag:
Code:
;===================================================
;===           Is ABILITY set to use?           ====
;===================================================
function:bool DoAbility(string ABILITY)
{
	echo "${ABILITY} == ${Me.Ability[${ABILITY}].School}"

	if  ${Me.Ability[${ABILITY}].School.Find[Arcane]} 
	{
		if ${DoArcane}
		return TRUE
		return FALSE
	}
	if ${Me.Ability[${ABILITY}].School.Find[Physical]}
	{
		if ${DoPhysical}
		return TRUE
		return FALSE
	}
	if ${Me.Ability[${ABILITY}].School.Find[Fire]}
	{
		if ${DoFire}
		return TRUE
		return FALSE
	}
	if ${Me.Ability[${ABILITY}].School.Find[Ice]}
	{
		if ${DoIce}
		return TRUE
		return FALSE
	}
	if ${Me.Ability[${ABILITY}].School.Find[Spiritual]}
	{
		if ${DoSpiritual}
		return TRUE
		return FALSE
	}
	if ${Me.Ability[${ABILITY}].School.Find[Mental]}
	{
		if ${DoMental}
		return TRUE
		return FALSE
	}
	return TRUE
}
Below is how I would use it in my routine:
Code:
;===================================================
;===         Use an Ability                     ====
;===================================================
function:bool UseAbility(string ABILITY)
{
	call DoAbility "${ABILITY}"
	if ${Return} && ${Me.Ability[${ABILITY}].IsReady}
	{
		Me.Ability[${ABILITY}]:Use
		wait 5
		call IsCasting
		return TRUE
	}
	return FALSE
}
 

mmoaddict

Original Script Author: VGA
snippets

I really do like zandros's ideas there. I know some of you really would rather that we just release our entire projects, so you can just use them rather than posting all these how tos and code snippets. The only reason we dont do this is because we feel it is more fun developing script for yourselves and designing it around your play style and enjoyment. Zandros and I are 2 different programmers with 2 different goals for our scripts. So our projects look different and act differently. It is very fun to bounce ideas off each other and work together on stuff but ultimately the fun is making things our own.

If you are out there as a scripter and are looking to bounce ideas off other scripters, let me or zandros know, we would be happy to chat with ya.

mmo
 

Akku

Active Member
Well not everyone can script or have the time to learn it.
Even if i understand the parts of your snippets im not able to build a working script from them.
Building a script or change them for your use are 2 diferent worlds.
 

mmoaddict

Original Script Author: VGA
moving forward with isxvg

zandros and I are currently discussing putting out a public version of VGA (Vangaurd Assist). Zandros also has some fixes and such for various old projects.

What you can do to help is encourage Amadeus to support us in our attempts to pick up isxvg and provide the volunteer support it needs. Vote on our bug reports and feature requests. Keep posting on the boards. Keep requesting things you want.
 
Top Bottom