Creating an Effectscript model

From Valve Developer Community
Revision as of 07:22, 28 September 2005 by RumikoHoshino (talk | contribs) (stub with .qc and script sample)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
  • Make an animating model.
  • In .qc, make attachments, and add a sequence with AE_START_SCRIPTED_EFFECT and AE_STOP_SCRIPTED_EFFECT events.
  • Write an effect script file.
  • In Hammer, place env_effectscript. Specify your model and scriptfile there.
  • Effect starts when the env_effectscript receives SetSequence input.


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 end frame.
}

sample effect script:

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
}