PDA

View Full Version : visual effect scripting


Darkkender
12-07-2004, 04:27 PM
how would i get a visual effect to appear to originate from the barrel of a weapon. More to the point which scripting command would i use to apply a certain effect type to appear to originate from a gun. the effect I want to work with would be a beam effect such as the flamethrower uses. however effectbeam originates from a body location. I was thinking to write a visual effect called effectgunbeam which would originate from a weapon and use all the other data in effect beam except the body slot definition. what would be a sample script showing the origin of the effect from the weapon and possibly being implemented in replace of the effect beam's body slot definition. thanks guys.

ok I'm realizing this isn't very clear above so here is a little more detail. This is the EffectBeam definition from nwscript.nss

EffectBeam(int nBeamVisualEffect, object oEffector, int nBodyPart, int bMissEffect=FALSE)

this is it implemented in k_sup_droid

EffectBeam(2053, OBJECT_SELF, BODY_NODE_HAND)

so i'm curious if this could be altered to something like this very easily.

EffectGunBeam(int nBeamVisualEffect, object oEffector, int "gunbarrel origin location", int bMissEffect=FALSE)

which would look like this implemented

EffectGunBeam(2053, OBJECT_ITEM, "gunbarrel origin location")

I realize I'm missing some important details which are what I need help with.

tk102
12-07-2004, 05:22 PM
I looked for this exact thing when I was trying to build a flamethrower and the best I came up with was the armband flamethrower. But most of my efforts were focussed on getting the script to fire, let alone getting the beam to work. Have you figured out how to get scripts to fire when a weapon is shot?

beancounter
12-07-2004, 06:17 PM
I do not think you can create your effect EffectGunBeam. Also, I do not believe you can have a script fire from a gun.

Even using an armband is limited because the armbands can not be targeted.

If you have figured a way out to have a gun fire a script please post it.

Darkkender
12-08-2004, 06:14 AM
well getting the gun to fire it's script as we all know is handled by spells.2da as item_comshots1-3 which is handled by the script k_sup_comshots. so just like you added the flamethrower script from k_sup_droids to k_sup_bands. I figured to add it into k_sup_comshots. I'll post the code for a gun fire and maybe we can put heads together and hack together something. I was starting to wonder if a effectlinkeffect script might be helpful in this.

tk102
12-08-2004, 06:17 AM
well getting the gun to fire it's script as we all know is handled by spells.2da as item_comshots1-3 which is handled by the script k_sup_comshots.
I think those are just injections.

Darkkender
12-08-2004, 06:19 AM
I actually just realized that myself. but I'm not giving up hope yet.

Darkkender
12-08-2004, 06:58 AM
Okay after looking closer it looks like most of what I'm trying to do is driven by the 2da files themselves now I just need to decipher some of the array files like ranges weapondischarge and damagehitvisual and have them applied into a new line on baseitems.2da. I'm trying to recall has anybody made anymods that effect baseitems.2da before? after writing to the 2da's i'll be able to write the weapon utc. I'm also going to double check some of the other sup scripts to see if they have some hidden info for us(they have to).

ChAiNz.2da
12-08-2004, 07:23 AM
Originally posted by Darkkender
I'm trying to recall has anybody made anymods that effect baseitems.2da before? after writing to the 2da's i'll be able to write the weapon utc. I'm also going to double check some of the other sup scripts to see if they have some hidden info for us(they have to).

Hey Darkkender, my Segan Wyndh Armor uses a baseitems.2da edit. I had to adjust some settings to allow Force Powers with Class8 armor (Cinnagar). It didn't involve any scripting however, so I'm not sure how much it helps... :giveup:

:::EDIT:::
hmmm..nevermind, mine was just an 'added' line in the baseitems, it didn't really affect anything 'else' in the .2da (not sure if this still helps or not)

Darth333
12-08-2004, 07:33 AM
Originally posted by Darkkender
Okay after looking closer it looks like most of what I'm trying to do is driven by the 2da files themselves now I just need to decipher some of the array files like ranges weapondischarge and damagehitvisual and have them applied into a new line on baseitems.2da. I'm trying to recall has anybody made anymods that effect baseitems.2da before? Yes, there are quire a few mods that use an edited baseitems.2da including Beancounter's balance blaster pack which is in the AIOFPM (it also edits weapondischarge.2da.):

http://lucasforums.com/showthread.php?s=&threadid=135386
http://lucasforums.com/showthread.php?s=&threadid=134243

btw, the search function is back for everyone (I think).

However, as Beanconter and tk102 mentionned, I doubt that firing a script from a blaster is possible.

Darkkender
12-08-2004, 10:20 AM
Originally posted by Darth333
Yes, there are quire a few mods that use an edited baseitems.2da including Beancounter's balance blaster pack which is in the AIOFPM (it also edits weapondischarge.2da.):

http://lucasforums.com/showthread.php?s=&threadid=135386
http://lucasforums.com/showthread.php?s=&threadid=134243

btw, the search function is back for everyone (I think).

However, as Beanconter and tk102 mentionned, I doubt that firing a script from a blaster is possible.

Well I knew the search was back infact I pm'ed Fred the Other Day to let him know. I admit me and keyword searches are like cats & dogs on a bad day. Thanks for the links there useful. Now that I have power back on I was going to attempt writing a item activate script to attach to the weapon in spells and see if it fires when I shoot the blaster for a basic test if it works then I'll go from there into deeper hacking.

Darkkender
12-09-2004, 02:41 PM
Okay here is a couple of updates everyone might be able to make use of.

first by adding a line to basseitems.2da for a new item type spell_effect_weapon and leaving out some information from the blaster rifle line I've been able to monkey around and have a script actually firing from the weapon. now there are some quirks I'm running into when doing this but I have had success at getting a script to work.

second if nobody was aware of this before blaster bolts are governed by models in ammunitiontype.2da. I imagine with the proper modelling effort we can actually generate a flamethrower effect coming out of the muzzle of a gun then all that would be needed is to apply the proper damage effects in the baseitems.2da. there are 4 different types of ammunition covered in ammunitiontype.2da they are blaster, ion, disruptor, and bowcaster. Each uses 2 seperate models that govern the blaster bolts movement. with some success of using different textures on the blaster bolt model I was able to get longer flame looking bolts of energy instead of the short red blasts.

If any of our modelers out there could look into this and take a crack at these model files and there textures would could quite easily have the potential of a flamethrower. I'm sorry but I must admit that my skills with modeling are at negative levels. So trying to convince me to try my hand at something that would take me about 2 years to figure out the basics on would be a waste.

tk102
12-09-2004, 02:52 PM
first by adding a line to basseitems.2da for a new item type spell_effect_weapon and leaving out some information from the blaster rifle line I've been able to monkey around and have a script actually firing from the weapon. now there are some quirks I'm running into when doing this but I have had success at getting a script to work.

Details! Details! Column by column, what is the new baseitems.2da entry? I beat myself up on that long ago.

So you can call GetSpellTargetObject and have hostile targeting? If so, then right now you can add a flame impact and flame bumpout appear on the target like they were getting hit with napalm or something.

Do the blaster bolts still fire when a script is invoked?

If you've got it working, retitle this thread to Darkkender's breakthrough. :)

Darkkender
12-09-2004, 03:50 PM
Originally posted by tk102
Details! Details! Column by column, what is the new baseitems.2da entry? I beat myself up on that long ago.

So you can call GetSpellTargetObject and have hostile targeting? If so, then right now you can add a flame impact and flame bumpout appear on the target like they were getting hit with napalm or something.

Do the blaster bolts still fire when a script is invoked?

If you've got it working, retitle this thread to Darkkender's breakthrough. :)

okay the 2 columns that I have kept from blasterrifle's entry that are probably the most important are
equipableslots: 0x00010
weaponwield: 5

now I actually kept the model and texture columns as well but they don't matter. Now as I said I have been having limited success in this area at one point i was able to pull off the flamethrowers damage but none of the visuals meanwhile scripts such as for healing aren't seeming to work. no matter what it does seem to do some base damage to an opponent with or without any scripts. as far as the damage the weapon does beyond the basic's of your str & dex modifier is going to be determined by columns in the baseitems.2da.

your blaster bolts firing are determined by the ammunitiontype column if you have **** there there are no blaster bolts. Since you can set your ammunitiontype in one column I think we would have better luck modeling a flamethrower flame. rather than a script action because of the difficulties with this particular.

As to renaming the thread "That I Most Definetly cannot do!" I don't have Admin level access to my own thread.(I already tried:p ) Besides I wouldn't call it a "Breakthrough" because of my limited success.

But if a Moderator sees this and wants to rename it "Potential for flamethrowers and other weapon viual effects" That woiuld be nice and more to the point for this thread.

tk102
12-09-2004, 04:20 PM
Hmm, seems like there's more to it than that. Maybe I will wait for a prototype weapon/script combo mod to analyze...
Of course if you'd like another set of eyes to look at it, PM/email me.

Edit: Tried for about an hour butchering up a .uti, baseitems.2da, and spells.2da. It's like déjà vu all over again.

Darkkender
12-12-2004, 08:44 AM
I have a hunch I know where are mystery problem lays at. In Spells.2da there is the "category" column. Now in your create a force power tutorial (http://www.lucasforums.com/showthread.php?s=&threadid=130898&highlight=spells.2da) it was brushed on. When I look in that column armbands use the same bit string 0x1808 and droid mounted items use 0x8000. I'can't recall what some of the other items use. now I think if we play with this long enough we may find a category for weapons. Any idea what might be a good start?

P.S. tk102 is Central Point, OR on the coast?

tk102
12-12-2004, 09:00 AM
That could be Darkkender. I never did mess with that very much. Normal force powers are all over the place and even a lot of the droid items vary (0x1304 0x1404 0x1408) etc. It's obviously a bit mask of some sort but I couldn't find any constants in nwscript.nss that looked applicable to it. I've never seen any effect from this column, but who knows?

So, just to clarify, did you actually get the weapon to fire a script?

If you haven't seen it, you'll find this (http://www.lucasforums.com/showthread.php?s=&threadid=125847) thread especially useful for debugging scripts. Especially beancounter's posts. I use them whenever I question whether the script actually fired.

Central Point, OR is inland, on the I-5 corridor, about 35 miles north of California.

Darkkender
12-12-2004, 11:16 AM
Originally posted by tk102
That could be Darkkender. I never did mess with that very much. Normal force powers are all over the place and even a lot of the droid items vary (0x1304 0x1404 0x1408) etc. It's obviously a bit mask of some sort but I couldn't find any constants in nwscript.nss that looked applicable to it. I've never seen any effect from this column, but who knows?

Alright I have done some looking around a laborious deciphering and figured out one piece in this puzzle above more or less the second digit is a reference to categories.2da example as above 0x1304 the 3 means this is a harmful_touch, 0x1404 & 0x1408 the 4 means beneficial_healing_AOE where in this case the AOE would be self. Now I have also come to the conclusion that the last digit if it is an 8 is of some beneficial purpose to any character while a 4 seems to be useful to a limited source(eg. droid heal, or a creature weapon). Now this is still a theory riddled with questions spawned by the other digits and interaction with those digits.


So, just to clarify, did you actually get the weapon to fire a script?


No I believe at this point I did not. I now believe my computer used the Force Power Affect Mind so that when it did physical damage from melee(without melee animations) I was thinking it was firing the script. I'm not about to give up though because I'm sure there has to be a secret to tap into.


If you haven't seen it, you'll find this (http://www.lucasforums.com/showthread.php?s=&threadid=125847) thread especially useful for debugging scripts. Especially beancounter's posts. I use them whenever I question whether the script actually fired.


No I had not but I might try to make use of this.


Central Point, OR is inland, on the I-5 corridor, about 35 miles north of California.

That's why it sounded familiar it's up around the general neck of the woods of Ashland and some of that country. I probably heard of it when I was at OIT in K Falls.

Darkkender
12-13-2004, 04:22 AM
Further update to my above post relating to spells.2da and the category column.

of the last 4 digits this is what I have determined and seems to be correct so far.

0x0000
^ = First Digit
0x0000
^ = Second Digit
0x0000
^ = Third Digit
0x0000
^ = Fourth Digit

First Digit: Inconclusive But I believe this is how it relates to an opponent

Second Digit: categories.2da listing as a direct effect upon a target(eg. a "2" here is "harmful_ranged" while a "4" is "Beneficial_Healing_AOE") so this would be aplied as damage or health benefits.

Third Digit: also a categories.2da listing however this is a indirect effect upon a target(eg. shields, poison, anything that is not immediatly applied to your health)

Fourth Digit: Inconclusive But I believe this is relating to your character a common factor used here is "1","4",& "8"
"4" = a select group of individuals droids usually.
"8" = any person usually(even though medpacks have an "8" at the end they don't apply to droids.)

I figured this was a good heads up if I get better information I'll update this.