View Full Version : Particle Coding Help with special FX for Heretic weapons
picklebro
March 9th, 2005, 06:11 AM
Please read down if you are a code expert - I'm not at all, but I'm not afraid to experiment, but after the code paste I have a question:
So someone made a special DED to give Heretic weapons a little extra Vavoom, for instance the crossbow:
first some stuff is defined at the top for all weapons - I actually believe this is particle stuff and not weapon related....
Header { Version = 5; }
# Particle generator flags and values.
Flag { ID = "gnf_static"; Value = 1; }
Flag { ID = "gnf_srcvel"; Value = 2; }
Flag { ID = "gnf_spawn"; Value = 4; }
Flag { ID = "gnf_blend"; Value = 0x10; }
Flag { ID = "gnf_floor"; Value = 0x20; }
Flag { ID = "gnf_ceiling"; Value = 0x40; }
Flag { ID = "gnf_space"; Value = 0x80; }
Flag { ID = "gnf_density"; Value = 0x100; }
Flag { ID = "gnf_modelonly"; Value = 0x200; }
# Particle types.
Flag { ID = "pt_point"; Value = 1; }
Flag { ID = "pt_line"; Value = 2; }
# Particle flags (for Stages).
Flag { ID = "ptf_stagetouch"; Value = 0x1; }
Flag { ID = "ptf_stagevtouch"; Value = 0x20; }
Flag { ID = "ptf_stagehtouch"; Value = 0x40; }
Flag { ID = "ptf_dietouch"; Value = 0x2; }
Flag { ID = "ptf_bright"; Value = 0x4; }
Flag { ID = "ptf_shading"; Value = 0x8; }
Flag { ID = "ptf_hflat"; Value = 0x10; }
Flag { ID = "ptf_vflat"; Value = 0x80; }
Flag { ID = "ptf_flat"; Value = 0x90; }
Flag { ID = "ptf_force"; Value = 0x100; }
....and here is the specific code for the crossbow:
# -----------------------------------------------------------
# FRECCE CHE LASCIANO LA SCIA
# -----------------------------------------------------------
Generator {
State = "CRBOWFX1";
Flags = "gnf_blend";
Particles = 10;
Speed = 5;
Speed rnd = .7;
Spawn age = 2;
Max age = 45;
Spawn rate = 5;
Vector rnd = 1;
Stage {
Type = "pt_point";
Flags = "ptf_bright";
Radius = 8;
Tics = 4;
Rnd = .1;
Color { 1 1 1 1 };
Gravity = 0.1;
Resistance = 0.02;
Bounce = 0.5;
};
Stage {
Type = "pt_point";
Flags = "ptf_bright";
Radius = 1.0;
Tics = 6;
Rnd = .4;
Color { 0 .6 0 .9 };
Gravity = 0.1;
Resistance = 0.02;
Bounce = 0.5;
};
}
Now, here is my question - all of the weapons FX are triggered when the weapon is fired, or for instance of the Gauntlets, only when you make contact with an enemy.
However, the bow has an animated portion that is always going and the Gauntlet gloves fire off a stream of energy even if they aren't making contact with anyone as long as you are pressing fire. I would love to have particle based FX for those instances but I have no idea how to make it happen. I would even be happy to share the .ded with anyone wanting to help (or anyone just wanting it for that matter).
Any help you could provide would be incredible! :)
DaniJ
March 9th, 2005, 09:48 AM
All the definitions in the top code window you don't need to put in your own DED as they are defined in Doomsday's Flags.DED.
To enjoy the benefits of DED reader ver 6's syntax - either change your header line to read:
Header { Version = 6 } (note that semicolons arn't required in ver 6)
OR
Remove the Header block completely. Doomsday will automaticaly use the syntax of the latest version of the DED reader.
For more info about DED and the syntax try the WIKI (http://deng.sourceforge.net/cgi-bin/view/Editing/WebHome).
However, the bow has an animated portion that is always going and the Gauntlet gloves fire off a stream of energy even if they aren't making contact with anyone as long as you are pressing fire. I would love to have particle based FX for those instances but I have no idea how to make it happen. I would even be happy to share the .ded with anyone wanting to help (or anyone just wanting it for that matter).Atm it is not possible to attach a particle generator directly to a HUD weapon. The only option would be to modify the behaviour of the weapon so that it spawns a real object that you can then attach a generator to. I don't think that would be particularly easy to achieve without totally changing how the weapons work
picklebro
March 9th, 2005, 12:16 PM
Thanks for your response...(FYI, the .ded isn't mine - I wish I knew how to write them- I'm hoping modifying it will help me learn)...I'll remove the header block
So the generator is being attached to the missle? What is the generator attached to on the gauntlets?
*EDIT* Is it using the state GAUNTLETPUFF1_1 to generate particles when that state occurs? If so, is there maybe a state that occurs when they go active that could be used? Hmmm.....maybe I'm going off in the wrong direction - just wondering out loud and hoping you'll guide me right.
I'll paste the code below:
# -----------------------------------------------------------
# PARTICLES X GUANTI
# -----------------------------------------------------------
Generator {
State = "GAUNTLETPUFF1_1";
Flags = "gnf_blend";
Particles = 10;
Speed = 5;
Speed rnd = .7;
Spawn age = 2;
Max age = 45;
Spawn rate = 5;
Vector rnd = 1;
Stage {
Type = "pt_point";
Flags = "ptf_bright";
Radius = 8;
Tics = 4;
Rnd = .1;
Color { 1 1 1 1 };
Gravity = 0.1;
Resistance = 0.02;
Bounce = 0.5;
};
Stage {
Type = "pt_point";
Flags = "ptf_bright";
Radius = 1.5;
Tics = 41;
Rnd = .4;
Color { 0 .6 0 .9 };
Gravity = 0.1;
Resistance = 0.02;
Bounce = 0.5;
};
Stage {
Type = "pt_point";
Color { 1 0 0 0 };
};
}
Generator {
State = "GAUNTLETPUFF2_1";
Flags = "gnf_blend";
Particles = 10;
Speed = 5;
Speed rnd = .7;
Spawn age = 2;
Max age = 45;
Spawn rate = 5;
Vector rnd = 1;
Stage {
Type = "pt_point";
Flags = "ptf_bright";
Radius = 8;
Tics = 4;
Rnd = .1;
Color { 1 1 1 1 };
Gravity = 0.1;
Resistance = 0.02;
Bounce = 0.5;
};
Stage {
Type = "pt_point";
Flags = "ptf_bright";
Radius = 1.5;
Tics = 41;
Rnd = .4;
Color { 0 .6 0 .9 };
Gravity = 0.1;
Resistance = 0.02;
Bounce = 0.5;
};
Stage {
Type = "pt_point";
Color { 1 0 0 0 };
};
}
Again, thanks for all/any help you can provide me - I am looking forward to learn more and will definitely read the wiki entry on it.
picklebro
March 9th, 2005, 02:04 PM
Okay Dani J (and anyone else who'd like to hop in here) What about using a Type generated particle generator for the bow and the gauntlet? I was reading:
Type Triggered
All Type triggered generators are spawned at the beginning of a level. Each Type triggered Generator definition gets its own particle generator entity. Type triggering makes the generator multi-sourced: all mobjs in the level with one of the types associated with the generator will act as particle sources. The effect is similar to having a separate generator for each mobj. Note, however, that you need to allocate a fairly large number of particles in the definition since all the mobjs use the same generator.
Should that work?
DaniJ
March 9th, 2005, 03:45 PM
Like I said it won't work I'm affraid. HUD weapon states aren't "real" mobj states because there IS no mobj...
The way the particle system works currently there needs to be a "real" mobj (map object) to attach a generator to.
In the case of weapons like the gauntlets there IS no mobj so you can't attach a generator to them. Similarly the crossbow is not a mobj but the arrow it fires IS. Which means you could attach a generator to the arrow that is spawned with the mobj. This means you could add a flare or something similar that appears when the crossbox is fired but not while it is idle. Also bare in mind that because the generator is attached to the arrow and not the weapon - as soon as you move and further particles are spawned relative to where you were when you first fired it.
I've made an RFE so that the local player mobj (the invisible mobj that represents the player) can have particles and models attached that change with the states of the current weapon as well as being able to "exist" independantly from the current weapon, instead attached to the local player mobj. We'll have to wait and hope but Skyjake has said that this should be possible.
I'm not too clued up on the states used in jHeretic yet but I think that GauntletPuff is only spawned when you punch a wall...
picklebro
March 9th, 2005, 04:26 PM
awesome info - thanks! :) As for Gauntletpuff, apparently its made when the gauntlet energy stream makes contact with an enemy in Heretic as there is no punching. Hexen may use the same name for the fighter class punching a wall. In Heretic it probably functions like a missle to allow the game to determine contact with an enemy.
Where can I find a list of states? Do I need to fire up Wintex and look through the game or is that something defined in the new doomsday engine?
Ton80
March 10th, 2005, 03:46 AM
Where can I find a list of states? Do I need to fire up Wintex and look through the game or is that something defined in the new doomsday engine?
Objects.ded located in the defs\'game folder'. Scroll down.
picklebro
March 10th, 2005, 03:48 AM
thanksya onnit
*EDIT*
wellll...I did some poking around in objects.ded and found a whole slew of states for Gauntlet. Do you know a good reason something a state like Gauntlet_Ready or Gauntlet_Attack couldn't have a generator attached to them?
I'm not being a smart-aleck here - I'm serious ...I realize there might be a valid reason not to and I wanted your opinion before I just leapt in. Here is the code from objects.ded that I speak of:
State {
ID = "GAUNTLETREADY";
Sprite = "GAUN";
Frame = 0;
Tics = 1;
Action = "A_WeaponReady";
Next state = "GAUNTLETREADY";
}
State {
ID = "GAUNTLETDOWN";
Sprite = "GAUN";
Frame = 0;
Tics = 1;
Action = "A_Lower";
Next state = "GAUNTLETDOWN";
}
State {
ID = "GAUNTLETUP";
Sprite = "GAUN";
Frame = 0;
Tics = 1;
Action = "A_Raise";
Next state = "GAUNTLETUP";
}
State {
ID = "GAUNTLETREADY2_1";
Sprite = "GAUN";
Frame = 6;
Tics = 4;
Action = "A_WeaponReady";
Next state = "GAUNTLETREADY2_2";
}
State {
ID = "GAUNTLETREADY2_2";
Sprite = "GAUN";
Frame = 7;
Tics = 4;
Action = "A_WeaponReady";
Next state = "GAUNTLETREADY2_3";
}
State {
ID = "GAUNTLETREADY2_3";
Sprite = "GAUN";
Frame = 8;
Tics = 4;
Action = "A_WeaponReady";
Next state = "GAUNTLETREADY2_1";
}
State {
ID = "GAUNTLETDOWN2";
Sprite = "GAUN";
Frame = 6;
Tics = 1;
Action = "A_Lower";
Next state = "GAUNTLETDOWN2";
}
State {
ID = "GAUNTLETUP2";
Sprite = "GAUN";
Frame = 6;
Tics = 1;
Action = "A_Raise";
Next state = "GAUNTLETUP2";
}
State {
ID = "GAUNTLETATK1_1";
Sprite = "GAUN";
Frame = 1;
Tics = 4;
Next state = "GAUNTLETATK1_2";
}
State {
ID = "GAUNTLETATK1_2";
Sprite = "GAUN";
Frame = 2;
Tics = 4;
Next state = "GAUNTLETATK1_3";
}
State {
ID = "GAUNTLETATK1_3";
Sprite = "GAUN";
Frame = 32771;
Tics = 4;
Action = "A_GauntletAttack";
Next state = "GAUNTLETATK1_4";
}
State {
ID = "GAUNTLETATK1_4";
Sprite = "GAUN";
Frame = 32772;
Tics = 4;
Action = "A_GauntletAttack";
Next state = "GAUNTLETATK1_5";
}
State {
ID = "GAUNTLETATK1_5";
Sprite = "GAUN";
Frame = 32773;
Tics = 4;
Action = "A_GauntletAttack";
Next state = "GAUNTLETATK1_6";
}
State {
ID = "GAUNTLETATK1_6";
Sprite = "GAUN";
Frame = 2;
Tics = 4;
Action = "A_ReFire";
Next state = "GAUNTLETATK1_7";
}
State {
ID = "GAUNTLETATK1_7";
Sprite = "GAUN";
Frame = 1;
Tics = 4;
Action = "A_Light0";
Next state = "GAUNTLETREADY";
}
State {
ID = "GAUNTLETATK2_1";
Sprite = "GAUN";
Frame = 9;
Tics = 4;
Next state = "GAUNTLETATK2_2";
}
State {
ID = "GAUNTLETATK2_2";
Sprite = "GAUN";
Frame = 10;
Tics = 4;
Next state = "GAUNTLETATK2_3";
}
State {
ID = "GAUNTLETATK2_3";
Sprite = "GAUN";
Frame = 32779;
Tics = 4;
Action = "A_GauntletAttack";
Next state = "GAUNTLETATK2_4";
}
State {
ID = "GAUNTLETATK2_4";
Sprite = "GAUN";
Frame = 32780;
Tics = 4;
Action = "A_GauntletAttack";
Next state = "GAUNTLETATK2_5";
}
State {
ID = "GAUNTLETATK2_5";
Sprite = "GAUN";
Frame = 32781;
Tics = 4;
Action = "A_GauntletAttack";
Next state = "GAUNTLETATK2_6";
}
State {
ID = "GAUNTLETATK2_6";
Sprite = "GAUN";
Frame = 10;
Tics = 4;
Action = "A_ReFire";
Next state = "GAUNTLETATK2_7";
}
State {
ID = "GAUNTLETATK2_7";
Sprite = "GAUN";
Frame = 9;
Tics = 4;
Action = "A_Light0";
Next state = "GAUNTLETREADY2_1";
}
State {
ID = "GAUNTLETPUFF1_1";
Sprite = "PUF1";
Frame = 32768;
Tics = 4;
Next state = "GAUNTLETPUFF1_2";
}
State {
ID = "GAUNTLETPUFF1_2";
Sprite = "PUF1";
Frame = 32769;
Tics = 4;
Next state = "GAUNTLETPUFF1_3";
}
State {
ID = "GAUNTLETPUFF1_3";
Sprite = "PUF1";
Frame = 32770;
Tics = 4;
Next state = "GAUNTLETPUFF1_4";
}
State {
ID = "GAUNTLETPUFF1_4";
Sprite = "PUF1";
Frame = 32771;
Tics = 4;
Next state = "NULL";
}
State {
ID = "GAUNTLETPUFF2_1";
Sprite = "PUF1";
Frame = 32772;
Tics = 4;
Next state = "GAUNTLETPUFF2_2";
}
State {
ID = "GAUNTLETPUFF2_2";
Sprite = "PUF1";
Frame = 32773;
Tics = 4;
Next state = "GAUNTLETPUFF2_3";
}
State {
ID = "GAUNTLETPUFF2_3";
Sprite = "PUF1";
Frame = 32774;
Tics = 4;
Next state = "GAUNTLETPUFF2_4";
}
State {
ID = "GAUNTLETPUFF2_4";
Sprite = "PUF1";
Frame = 32775;
Tics = 4;
Next state = "NULL";
DaniJ
March 10th, 2005, 08:54 AM
I will repeat, particle generators cannot be attached to HUD weapon states period. They can only be attached to a "real" mobj (eg a plant/monster/missile etc...).
picklebro
March 10th, 2005, 10:00 AM
again, not trying to be a smart-aleck...just trying to understand - but if you look at the original code from the .ded in my first post, isn't that what they did? Or is Gauntlet_Puff considered a 'missle' by the game?
Vermil
March 10th, 2005, 10:08 AM
Yep, the puff created when you hit something with the Gauntlet's is a thing you can attach particle generators to.
You can attach a particle generator to anything except the hud weapon itself.
picklebro
March 10th, 2005, 10:10 AM
cool-thanks-- Can you guys tell me how I can tell if something is a mobj or not by looking at the code or some readme? For instance, can a sprite be a mobj?
If so, while I still can't fake a HUD weapon based generator ( I hope your RFE is implemented Dani J) I could enhance the gauntlets particle effect by using the attack sprites as mobj to tie generators to.
Thanks,
PiCKlebro
vBulletin® v3.8.5, Copyright ©2000-2013, Jelsoft Enterprises Ltd.