User:Alvexor/UDA

This documentation covers the usage and implementation of the Ultimate Duelling Avatar Code.

For a tutorial on UDA V2.0 or later, head here.

Prerequisites
First, you'll need to download the UDA V1.2 Source.

Unzip and copy all files into examples -> avatars -> uravatar -> src of the whirled SDK.

You'll also need to know how to create an Advanced Avatar and have a good idea as to what's what regarding code.

How it works in-game
If you're familiar with LSA, UDA operates in a very similar manner, but with noticeable differences.

Worth noting is that the UDA code will do practically nothing if you don't have a friend with an avatar that is UDA-enabled, too.

Also note that UDA is NOT compatible with LSA.

To use, simply enter a duel state and trigger an action. If your friend/opponent is also in a duel state, they will take damage and lose health. The amount of health you have will (by default UDA code) be displayed directly below your hotspot. When an avatar loses all its health, it will immediately transition into a "defeated" state and the avatar that dealt the final blow will be awarded some exp. When you gain enough exp, you will "level up" (this is permanent, and any levels gained will stay with you even when you change avatars), granting you bonus health, and occasionally granting you bonus attack damage and healing points.

A few notes:

- If you are out of range, then you won't be able to hit your friend and they won't be able to hit you. This is to make sure one person can't kill everyone on-screen at once

- If you want to take a break from duelling but would still like to enjoy any combat animations, just type "!uda off" into the chat and any UDA functionality will be disabled! To re-enable, type "!uda on".

- You can check the info panel by typing "!uda info" to see your level, exp, health, and kills vs deaths.

If this seems a little hard to get, don't worry! Just experiment with the duelling functionality with your friends and it should begin to make sense.

Here is an in-game example UDA-enabled avatar I created: http://www.whirled.com/#shop-l_5_133700

Code
With the UDA source docs in place, all you'll need to do is do a few modifications to the code in your Main scene.

First off, instead of your basic avatar code, have this:

import com.whirled.AvatarControl; import flash.events.Event;

if(_ctrl == null) { _ctrl = new AvatarControl(this); _body = new Body(_ctrl, this, 600); _uda = new UDAControl(_ctrl, this); _uda.setHotSpot(300, 375, 250);

_uda.registerDuelStates; _uda.registerHitAction; _uda.registerDeadState; _uda.registerDuelActions; addEventListener(Event.UNLOAD, handleUnload); function handleUnload(...ignored):void { _body.shutdown; _uda.clean; } }

var _ctrl:AvatarControl; var _body:Body; var _uda:UDAControl;

From here you can make any necessary modifications as desired, such as changing Body to MovieClipBody, adding listeners for state changes, changing the hotspot, etc.

Now, this is where personal customisation comes in. Between the parentheses (these:) of the four register functions, you'll need to put in any appropriate things between quotation marks, separated by commas.

For _uda.registerDuelStates, you'll need to include states that you wish to enable UDA for.

For _uda.registerHitAction, you'll need to put only one action that you want to play when your avatar gets hit.

For _uda.registerDeadState, you'll need to put in only one state - this will be the one that your avatar changes to when you lose all your health

Finally, for _uda.registerDuelActions, put in any actions you wish to have UDA-enabled. However, if you want a healing action, you'll need to put in a little extra code. Instead of stating it between simple quotation marks, you'll need to state it like so: [ "HealAction", "h" ]

Here's a small example of what yours might look like when it's all done: _uda.registerDuelStates("Combat 1", "Combat 2"); _uda.registerHitAction("Hit"); _uda.registerDeadState("Defeated"); _uda.registerDuelActions("Attack 1", "Attack 2", [ "Heal", "h" ]);

Once you've done all that, your UDA configuration is all done!

(Note: Whenever setting the hotspot, it's strongly advised that you call it through _uda instead of _ctrl, or the health bar might be very weirdly positioned.)

Objects
You'll also need to add objects to the library for the UDA to work. These objects are provided in the "UDA Components.fla" file included in the source package, and all you need to do is copy them over to your main library.

If you wish to modify the appearance of these objects, modify inside the symbols only. Tampering with the names of the movie clips could potentially break the code.

However, if you use Flash CS3 (the .fla is in CS4 format), you might need to add these symbols manually.

For the first of the two, create a Movie Clip, and under the "AS Linkage" column of the library panel, name it "UDAControlPanel". Inside that Movie Clip, you'll need a text box named "debugText".

For the second, create another Movie Clip, and under AS Linkage name it "UDADisplay". Inside it, you'll need a text box named "hp", a movie clip named "barMask", and another movie clip named "green". Unfortunately, because of my poor ability to explain these things, it is strongly recommended that you have Flash CS4 or above so you can access the components file, or a friend who is able to help you better than I.

Changelog
V1.0:

- Initial release

V1.1:

- UDA is no longer assigned to _body

- Removed UDAAvatarControl

- Removed UDABody

- Health bar now only displays for the avatar's owner

- Info panel is now accessed through the chat command "uda info"

- UDA is now compatible with config-enabled avatars (I think)

V1.2

- Teams

--- Set your team with the chat command "uda team "

--- Maximum length of 8 characters (longer names will be shortened)

--- Just "uda team" resets your team

--- You won't be able to attack anyone on your team

- Chat command - "uda reset" - resets the activation and team

- Cooldowns on attacks and heals to prevent unfair spamming

- The health bar now flips correctly if you haven't moved since equipping the avatar

- Optional debug mode

--- Displays debug messages in the info panel

--- Debug command: "uda wipe" - wipes all the avatar's saved data from Whirled

V2.0

- Added new displays

--- Messages, and animations that show when you are healed or revived

- Added mana

--- Heals now consume mana

- Added strong attacks

- Added team heals

- Added team revives

- Health and mana now gradually regenerate

--- Regenerates faster while you're in a dead state

--- No more instant-heals when changing states

- Chat command prefix changed from "uda" to "!uda"

- Support for interaction with third-party pets and toys

- Lots of minor modifications and bug fixes

FAQ

 * Is it compatible with LSA?

No.


 * Is it compatible with ConfigXP?

Yes! As of UDA V1.1, UDA is compatible with any config code (I think.)