Friday, January 2, 2009

Siege FX Tutorial #3

Siege FX Tutorial #1


Targets

By: Aaron 'Jomdom' Ransley
Created:
1/15/2003

Introduction

In this installment, we will be discussing targets. How do you get your effects to go where you want them to? Shout at the code and mash the keyboard? That works, but very rarely. Instead, I will attempt to teach you the correct way to assign effects to targets. You will need to be familiar with the Stack, so if you haven’t read that tutorial yet, go ahead and do that now.

Notes: You might notice the lack of the Lingo section in this tutorial. The formatting is also a bit smaller than the last few tutorials. I hope it isn’t too dramatic of a change.

Taking a Peek

Please note this script is very un-optimized, it is being used because it is a good example of how targets work.

Let’s take a look:

[effect_script*]

{

name = halo;

script =[[

sfx create orbiter #TARGET

"radius(2.5)phi(0)iphi(40)itheta(0)color0(1,1,0)

offset(0,.3,0)scale(.05)invisible()";

sfx attach_point #PEEK bip01_head target;

set $orb1 #PEEK;

sfx start #POP;

sfx create fire #TARGET

"flamesize(3)color0(1,.3,1)color1(0,0,0)

scale(1)velocity(0,0,0)alphafade(.3)

count(100)accel(0,0,0)";

sfx rat #PEEK;

sfx target #PEEK $orb1 target;

sfx start #POP;

]];

}

Break it Down

Let’s go to the most important part of the script first; where the effect goes:

sfx create orbiter #TARGET

#TARGET and #SOURCE macros can yield different results depending on how the script is called into existence, and what it is run on. In this case, #TARGET is the player.

The next important thing in the script is where on the player the effect goes:

sfx attach_point #PEEK bip01_head target;

This tells the Siege FX engine (sfx) to attach (attach_point) the effect (#PEEK) to the players head (bip01_head) using the effect’s target (target).

Then, we have attaching the fire to the orbiters:

sfx rat #PEEK;

sfx target #PEEK $orb1 target;

It’s confusing isn’t it? Why do we use the (target) command on one effect, and the (attach_point) command on the other? You can think of it as a hierarchy.

First, we have the player (#TARGET). The player has a bunch of special bones to attach to. We use (attach_point) to get a certain bone we need (bip01_head) and hook the effect to it.

Secondly, we have the player again (#TARGET). We don’t want the player this time though. Let’s tell the Siege FX engine (sfx) to remove all targets (rat) from the effect (#PEEK).

Now that we have a clean slate, we can reassign targets. This time, we don’t want to go any further than just assigning a target, because an orbiter doesn’t have any special bones to attach to. We tell the Siege FX engine (sfx) to use the command (target) on the effect (#PEEK) assign a new target ($orb1) on the effect’s target (target). Since there are no special bones to attach to, we are done assigning targets.

In the end, we have an orbiter rotating around the player’s head, with fire attached to it that fades out slowly, so it looks as though we have a halo above the players head. Like I said earlier, it isn’t needed. You could easily just use a fire base effect using the radius parameter to achieve almost the exact same thing.

That wraps it up for now!

Resources

These are various resources I find very useful.

In the Future

Expect the next tutorial to cover some sneaky tricks with the Siege FX engine.

Credits

Gas Powered Games - You make a killer effects engine! Great job! I can’t wait for Dungeon Siege 2's revision of Siege FX.

0 comments:

Search

My Blog List