My new questions: Combat, Animal Lore, etc.

Forum where anything UOX3-related goes - including, but not limited to: newbie-support, ideas, general questions, comments, etc and-so-forth.
Post Reply
mikel123
UOX3 Neophyte
Posts: 27
Joined: Thu Aug 18, 2011 4:28 pm
Has thanked: 0
Been thanked: 0

My new questions: Combat, Animal Lore, etc.

Post by mikel123 »

On the off chance someone stops by, I figure I may as well get all of my questions out there in case there's an easy answer. Without further ado:

1) Animal Lore doesn't show me pet happiness level, nor what they prefer to eat. I think I can figure out how to add these to the gump, but I don't know what the variables are. Where are they listed/located?

2) Additionally, where can I find the scripts that govern pet behavior? I would like to adjust "all kill" behavior, and double-check how happiness works on failed and succeeded commands. Additionally, the taming process seems to be happening instantaneously, instead of requiring 10 seconds (and the vocalizations like "good timber wolf" are all happening immediately, rather than across the 10 seconds).

3) For combat, where is this behavior handled? I'd like to adjust swing rate to be based on Stamina, not DEX.

4) NPCDAMAGERATE in UOX.ini is a bizarre thing. Default seems to be "2". If I set it to "1", I seem to be doing half the damage to NPCs that I did at "2". Which makes sense. But it also seems like they're doing double the damage to me! Is this intentional?

5) A Spectre, which has .dfn damage listed as 9 to 19, was doing as much as 35 damage to me with NPCDAMAGERATE=1. Even with a roll of 19, adding in STR and Tactics bonuses, they shouldn't be hitting that hard. Where is this behavior housed, so I might debug?

6) Again going back to combat, how does "def" work here? It looks like it's based on the physical resist system? I'd like to adjust it to be based on old-fashioned AR, which removes some flat amount of damage, rather than physical resist which removes a percentage. Where would I do this?

7) Am I correct that Herding doesn't exist? It seems I'd need to add a .js file called "shepherdcrooks.js" or something like that, to govern the behavior of the crook, and then "herding.js" to govern the behavior of the herding skill.

8) Super basic JS question: are all functions continually checked at some interval? It seems to me based on my limited understanding of JS and UOX3 that I can make a script and put it pretty much anywhere, and as long as it is properly references in js_fileassociations, js_objectassociations, etc., it will be seen? Or perhaps you guys put all of these in global.js, which is constantly read?

9) What is Global.js? Where is this? Is this the same as script 0?

10) I understand how to add spell charges to a weapon (http://guide.uox3.org/section2.htm#mww) but how do I add charges of ItemID?

11) Related to the guide section above... how do I spawn a magic item like the one in the example? Is it as easy as adding lines like

TYPE=15
MOREX=5
MOREY=7
MOREZ=22

to the .dfn file?

12) Based on Stranf's info here: viewtopic.php?t=765 Does this mean that any time he calls forth a cloak (0x1515), it will be a shadow cloak? Furthermore... if his second post instead said: \

"if (ourObj.id == shadow_cloak", rather than
"if (ourObj.id == 0x1515",

does that mean he could get the effect of the magic cloak separate from the plain cloak (0x1515) to keep them as two possible distinct items, one which had the onEquip behavior and one which did not?

13) Can an item .dfn have two or more scripts attached to it? Like:

SCRIPT=3201 //add tactics
SCRIPT=3202 //add healing skill

14) Liches are auto-killing me with Mind Blast. How does this spell's behavior work? Where can I edit it? In Spells.dfn, I've tried turning this spell of (ENABLE=0) and I've tried changing it's spell circle to 9 (my liches can only cast up to circle 7) but neither seems to work.

Thanks a lot for any help you can provide!
giwo
Developer
Posts: 1780
Joined: Fri Jun 18, 2004 4:17 pm
Location: California
Has thanked: 0
Been thanked: 0

Post by giwo »

1) Most attributes of characters are exposed in JS, and you can generally find information about them in the docs\JavaScripting folder under characterp.html and characterm.html

2) I'm not sure if there are any javascripts that currently exist to control pet commands, you can certainly add OnSpeech events to handle pet commands.

3) Most of the combat code is still handled via C++, this is largely for performance reasons. At first glance it appears Stamina is used to calculate speed

Code: Select all

R32 CHandleCombat::GetCombatTimeout( CChar *mChar )
{
	R32 getDelay	= (R32)( (R32)UOX_MIN( mChar->GetStamina(), static_cast<SI16>(100) ) + 100 );
	int getOffset	= 0;
	int baseValue	= 15000;

	CChar *ourTarg = mChar->GetTarg();

	CItem *mWeapon = getWeapon( mChar );
	if( ValidateObject( mWeapon ) )
	{
		if( mWeapon->GetSpeed() == 0 ) 
			mWeapon->SetSpeed( 35 );
		getOffset = mWeapon->GetSpeed();
	}
	else
	{
		if( mChar->GetSkill( WRESTLING ) <800>GetSkill( WRESTLING ) / 200 )) * 5) + 30;
		else
			getOffset = 50;
	}
	
	//Allow faster strikes on fleeing targets
	if( ValidateObject(ourTarg) )
		if( ourTarg->GetNpcWander() == WT_FLEE)
			baseValue = 10000;

	getDelay = (baseValue / (getDelay * getOffset));
	return getDelay;
}
4) If the target is not an NPC then the final calculated damage amount is divided by NPCDAMAGERATE

5) combat.cpp

6) combat.cpp

7) I've never heard of herding. :)

8) Functions are checked as they would be called either for script 0 (global.js) or whatever script is assigned to an object. So OnSpeech is only called when we start handling a speech event

9) This is a script file you can use to house scripts that will be automatically associated to all objects (I believe this includes objects that have other scripts associated to them).

10) Don't really understand what you mean

11) Basically, yes. And if you don't want to alter an existing item, simply create a new record with a tag of GET=whatever_item_its_based_on to automatically pull in the values from the original

12) The item "shadow_cloak" uses the artwork 0x1515, but is a different item (as it has different attributes set by the script) So adding shadow_cloak is different than adding 0x1515. Again the GET functionality can come in handy when you want to create a new item based upon an existing item.

13) Yes you should be able to have any number of scripts associated with a single item, remember that you want to be mindful of what events each script handles, so you don't wind up doing the same thing twice.

14) magic.cpp looks like this spell is based on the difference between the casters intelligence and the targets, so try turning down their int levels to lower the damage of this spell.

Code: Select all

bool splMindBlast( CChar *caster, CChar *target, CChar *src )
{
	if( caster->GetIntelligence() > target->GetIntelligence() )
	{
		if( Magic->CheckResist( caster, target, 5 ) )
			Magic->MagicDamage( target, (src->GetIntelligence() - target->GetIntelligence())/4, src, COLD );
		else
			Magic->MagicDamage( target, (src->GetIntelligence() - target->GetIntelligence())/2, src, COLD );
	}
	else
	{
		if( Magic->CheckResist( caster, src, 5 ) )
			Magic->MagicDamage( src, (target->GetIntelligence() - src->GetIntelligence())/4, src, COLD );
		else
			Magic->MagicDamage( src, (target->GetIntelligence() - src->GetIntelligence())/2, src, COLD );
	}
	return true;
mikel123
UOX3 Neophyte
Posts: 27
Joined: Thu Aug 18, 2011 4:28 pm
Has thanked: 0
Been thanked: 0

Post by mikel123 »

giwo, thanks so much. This is like drinking through a firehose.

I didn't realize the uox3.exe file was in c++... I assume I need to do all sorts of things to modify that which involve "compiling". I know nothing about this, so I think I'll stick to .dfn's first, then try to learn javascript, and finally tackle that stuff in .cpp files.

For (10), I was asking about items that use the Item Idenfication skill. So in addition to wands of Clumsy, Greater Heal, etc., there were wands whose charges used the Item Identification skill for the user. But, since this isn't a spell, I don't know how to set the MOREX=, MOREY=, etc, to make the wands use that skill instead of a spell. Given some other issues I've had with identifying, I think I'm just going to make all of my custom-made magic items be identified already.

I think I understand all of your other answers, thanks so much.

The Mind Blast spell, by the way, is amusing. For something like a Lich Lord, with ~600 INT, it is essentially auto-death against a player character. Even when resisted, it looks like it does 25% of the INT difference in damage, which is well over 100.
Post Reply