Creating an Effectscript model: Difference between revisions
mNo edit summary |
m (did some cleaning up) |
||
Line 1: | Line 1: | ||
{{stub}} | {{stub}} | ||
An effectscript model is a model with attachment animation sequence events. With an effectscript file, it'll create sprite animation effects in game. Examples are <code>models\effects\teleporttrail.mdl</code> and <code>models\effects\teleporttrail_Alyx.mdl</code>, as the name suggests, you can see them in the alyx teleport scene in chapter 2. | |||
You can place one in your map with the <code>[[Env effectscript|env_effectscript]]</code> entity. | |||
The default effectscript model consists of a single cube textured with materials/models/effects/base.vmt (this is maybe because if there is no mesh, .SMD wont't be exported), several bones(one root parent, others are child bones of the root), and attachments corresponding to child bones. It also has a sequence that animates bones and attachments. Check Attachments and Bones in HLMV.exe render tab to preview it. | |||
==Authoring effectscript models== | |||
===3D Package=== | |||
*Make an animating model. | *Make an animating model. | ||
**Place some nulls. Name one null "root", and make this one the parent of the other nulls. | **Place some nulls. Name one null "root", and make this one the parent of the other nulls. | ||
Line 20: | Line 18: | ||
*Export it as reference and animation .smd files. Make sure to ''un''check "Remove all unused bones" when you are using XSI's SMD exporter. | *Export it as reference and animation .smd files. Make sure to ''un''check "Remove all unused bones" when you are using XSI's SMD exporter. | ||
==.qc | ===Setting up the .qc=== | ||
*In .qc, make attachments to child bones, and add a sequence with AE_START_SCRIPTED_EFFECT and AE_STOP_SCRIPTED_EFFECT events. | *In .qc, make attachments to child bones, and add a sequence with AE_START_SCRIPTED_EFFECT and AE_STOP_SCRIPTED_EFFECT events. | ||
Here is a sample .qc: | |||
<pre> | <pre> | ||
$modelname "effects/testtrail.mdl" | $modelname "effects/testtrail.mdl" | ||
Line 40: | Line 40: | ||
</pre> | </pre> | ||
== | ===effectscript file=== | ||
*Write an effect script file. Valve puts their effect script file in <code>hl2\scripts\effects\testeffect.txt</code>, but you can put your file anywhere under the game directory. You can specify the script file location in [[Env effectscript|env_effectscript]] entity. | *Write an effect script file. Valve puts their effect script file in <code>hl2\scripts\effects\testeffect.txt</code>, but you can put your file anywhere under the game directory. You can specify the script file location in [[Env effectscript|env_effectscript]] entity. | ||
Line 58: | Line 59: | ||
==Hammer== | ===Hammer=== | ||
*In Hammer, place [[Env effectscript|env_effectscript]]. Specify your model and scriptfile there. | *In Hammer, place [[Env effectscript|env_effectscript]]. Specify your model and scriptfile there. | ||
*Effect starts when the [[Env effectscript|env_effectscript]] receives SetSequence input. | *Effect starts when the [[Env effectscript|env_effectscript]] receives SetSequence input. | ||
[[Category:Modeling]] | [[Category:Modeling]] |
Revision as of 12:43, 5 November 2007
An effectscript model is a model with attachment animation sequence events. With an effectscript file, it'll create sprite animation effects in game. Examples are models\effects\teleporttrail.mdl
and models\effects\teleporttrail_Alyx.mdl
, as the name suggests, you can see them in the alyx teleport scene in chapter 2.
You can place one in your map with the env_effectscript
entity.
The default effectscript model consists of a single cube textured with materials/models/effects/base.vmt (this is maybe because if there is no mesh, .SMD wont't be exported), several bones(one root parent, others are child bones of the root), and attachments corresponding to child bones. It also has a sequence that animates bones and attachments. Check Attachments and Bones in HLMV.exe render tab to preview it.
Authoring effectscript models
3D Package
- Make an animating model.
- Place some nulls. Name one null "root", and make this one the parent of the other nulls.
- Name the other nulls like "test1", "test2", etc. You'll make attachments to these bones in .qc file.
- Make keyframe animations with the child nulls. (Use the translate tool)
- Add a small cube, with the
base.tga
texture (only the name matters; you don't have to extract the original one).
- Export it as reference and animation .smd files. Make sure to uncheck "Remove all unused bones" when you are using XSI's SMD exporter.
Setting up the .qc
- In .qc, make attachments to child bones, and add a sequence with AE_START_SCRIPTED_EFFECT and AE_STOP_SCRIPTED_EFFECT events.
Here is a sample .qc:
$modelname "effects/testtrail.mdl" $model "Body" "test_ref.smd" $cdmaterials "models/effects/" $hboxset "default" $hbox 0 "root" -1.000 -1.000 -1.000 1.000 1.000 1.000 // Model uses material "base.vmt" $attachment "MyParticle1" "test1" 0.00 0.00 0.00 rotate 0.00 0.00 0.00 $surfaceprop "metalpanel" $sequence idle "test_ref" fps 30.00 $sequence spiral "test_anim" fps 30.00 { { event AE_START_SCRIPTED_EFFECT 1 "mytest_sprite" } //specify the effect name and its start frame { event AE_STOP_SCRIPTED_EFFECT 99 "mytest_sprite" } //specify the effect name and its end frame. }
effectscript file
- Write an effect script file. Valve puts their effect script file in
hl2\scripts\effects\testeffect.txt
, but you can put your file anywhere under the game directory. You can specify the script file location in env_effectscript entity.
sample "mytesteffect.txt":
effect "mytest_sprite" //effect name { type "sprite" //the other option is "trail" material "sprites/glow01.vmt" attachment "MyParticle1" //point to the attachment in your effectscript model color "255 50 240 128" scale 1 fadetime 3 stopfollowonkill 1 }
Hammer
- In Hammer, place env_effectscript. Specify your model and scriptfile there.
- Effect starts when the env_effectscript receives SetSequence input.