Aller au contenu

Photo

Orientation of placed effects


  • Veuillez vous connecter pour répondre
47 réponses à ce sujet

#1
andysks

andysks
  • Members
  • 1 645 messages

Hi there. I have a situation, which I think requires scripting to be done. No idea. Anyway,

 

How to orient a placed effect that's a beam, or ray.

 

If 4 same effects spawn(rays) on 4 different objects in a room, but all lead to a single point. How is this possible? To turn and effect just turns the placed effect helper and not the actual effect.

 

I have created my effect on the editor, and possibly I missed a property that makes it turnable? If such thing exists I could create 4 different ones and be done with it. If not, I need to turn them via script I guess. Somehow. Any ideas on how this can be managed?



#2
kamal_

kamal_
  • Members
  • 5 238 messages

If 4 same effects spawn(rays) on 4 different objects in a room, but all lead to a single point. How is this possible? To turn and effect just turns the placed effect helper and not the actual effect.

iirc, the actual effect can be turned via the orientation property, but the turning is only visible ingame. The toucan vfx is an easy way to check that.



#3
andysks

andysks
  • Members
  • 1 645 messages

Hmm, the birds do turn yes. And some others as well, which turning is also visible in the toolset. But the bloodstains, even if I change the orientation, the helper turns, but then in game they all look the same.

My guess is that some types of effects can be oriented but some others not. Perhaps is a property on the editor... who knows.

 

In any case, this would not help a lot anyway, since I forgot to clarify that I want to spawn these effects. They are not placed until certain actions are performed. So even if I manage to turn them, it won't matter. What I need is to turn them once they spawn, and script assist provides no clarity.



#4
rjshae

rjshae
  • Members
  • 4 478 messages

What I find is that it is the effects that incorporate a model can be turned. (See, for example, some of the decal effects.) I'm not sure if you can attach a particle mesh emitter to a model that you've already added to an effect, but perhaps that would allow you to turn it afterward. Alternatively, you can attach the mesh emission effect to a placeable, such as an invisible billboard.

 

When you create an object at a location, the location variable can include facing information. See the description for the Location() call.



#5
andysks

andysks
  • Members
  • 1 645 messages

So an effect that doesn't incorporate a model can not be turned in any way? Because what I find weird is that the spells don't incorporate models, but can turn depending on target etc. But that's another story I guess. On the editor it's even an option for where we want it to start and stop. I guess that's what defines it.

 

Creating object at location was what I had in mind.

 

Something like that to be exact:

    // create a fire placable effect over the brazier placeable
    vector vEffect = GetPosition(OBJECT_SELF) + Vector(-0.0060, -0.0080, 0.96);
    location lEffect = Location(GetArea(OBJECT_SELF), vEffect, 0.0);
    object oEffect = CreateObject(OBJECT_TYPE_PLACED_EFFECT, "fx_ashfire_2", lEffect);

Now, this is for fires over braziers. It works. But a ray is more complicated. The X and Y axises need to change(right?), but to what degree? Could I tell them somehow to change to the direction of the effect's final destination?



#6
kamal_

kamal_
  • Members
  • 5 238 messages

It would be nice if we could just place some iponts for start/end points, and then have ray effects go between them.



#7
Shallina

Shallina
  • Members
  • 1 011 messages

the only way i found is to edit the effect with the visual effect editor to turn it, and make a new one in the direction I wish.


  • Morbane aime ceci

#8
andysks

andysks
  • Members
  • 1 645 messages

It would be nice if we could just place some iponts for start/end points, and then have ray effects go between them.

 

Thought of this too. But I couldn't find any function for it.

 

the only way i found is to edit the effect with the visual effect editor to turn it, and make a new one in the direction I wish.

 

Thought of this one too, which would be the last resort option. Now that I think of it, the whole time I try to find a way I would be done using this method :D.

How do you orient the effect on the editor? My option for it is greyed out.



#9
rjshae

rjshae
  • Members
  • 4 478 messages

Something like that to be exact:

    // create a fire placable effect over the brazier placeable
    vector vEffect = GetPosition(OBJECT_SELF) + Vector(-0.0060, -0.0080, 0.96);
    location lEffect = Location(GetArea(OBJECT_SELF), vEffect, 0.0);
    object oEffect = CreateObject(OBJECT_TYPE_PLACED_EFFECT, "fx_ashfire_2", lEffect);

Now, this is for fires over braziers. It works. But a ray is more complicated. The X and Y axises need to change(right?), but to what degree? Could I tell them somehow to change to the direction of the effect's final destination?

 

If you have two placeables (such as iPoints), you could find the ray facing as follows:

vector V1 = GetPosition( oPlaceable1 );
vector V2 = GetPosition( oPlaceable2 );
vector V3 = V1 - V2;
float fFace = VectorToAngle( V3 );


#10
4760

4760
  • Members
  • 1 204 messages

Why not go with a spell then?

 

How to orient a placed effect that's a beam, or ray.

 

If 4 same effects spawn(rays) on 4 different objects in a room, but all lead to a single point. How is this possible? To turn and effect just turns the placed effect helper and not the actual effect.

Like arrow trails right?

 

So an effect that doesn't incorporate a model can not be turned in any way? Because what I find weird is that the spells don't incorporate models, but can turn depending on target etc.

I suppose they use "ActionCastSpellAtLocation(Spell_ID, lTargetLoc, METAMAGIC_ANY, TRUE, PROJECTILE_PATH_TYPE_BALLISTIC_LAUNCHED, TRUE));



#11
andysks

andysks
  • Members
  • 1 645 messages

The problem with a spell is that the effect doesn't stay permanently. The way I want it, is like an indication. You solve 4 riddles, from 4 placeables, and they activate another placeable. The rays/beams whatever, are there for aesthetic reasons :).

 

Bob I will test this to see how it goes soon.



#12
kevL

kevL
  • Members
  • 4 052 messages

It would be nice if we could just place some iponts for start/end points, and then have ray effects go between them.

i used an iPoint placeable for the endpoint of an acid-breath weapon vFx

VFX_BEAM_GREEN_DRAGON_ACID, sef: 'fx_acid_breath', line #870 in VisualEffects.2da

note: OBJECT_SELF is the startpoint (a dragon, in this case)

// set the endpoint of the Acid Beam out front of dragon, because it looks really goofy
// if Target is right under the dragon's jaw (or somewhere else ...)
location lEndLoc = GetAheadLocation(oDragon, fLength);
object oEndTarget = CreateObject(OBJECT_TYPE_PLACEABLE, "plc_ipoint ", lEndLoc);
DelayCommand(3.0f, DestroyObject(oEndTarget));

effect eAcidBeam = EffectVisualEffect(VFX_BEAM_GREEN_DRAGON_ACID);
DelayCommand(0.8f, ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eAcidBeam, oEndTarget, 1.45f));

because otherwise, the beam goes from the dragon's jaw to wherever its target is (which is a bit more random than you'd think..) so i wanted the beam to just go straight out and let imagination fill in the rest.

for this to work, and i'm no expert on .Sef, I think it needs
"SecondAttachment"=ATTACH_TORSO
"SecondAttachmentObject"=Target
in its Properties

i See there's also a property checkbox:
"UseOrientedPosition" - but that's been left FALSE for above. And uhh, oh, those properties are for the associated .BFX files (the Beam definitions)

But i have no idea if it works with a non-creature Object_self, say a jar ...



#13
andysks

andysks
  • Members
  • 1 645 messages

Alright. I managed to create the effect, both the commented out version and KevL spawned it, quite high but that's fixable. But I think I've done something wrong with the effect itself and therefore I cannot test if the path I want it to take works.

#include "x0_i0_position"

void main()
{
object oPC = GetPCSpeaker();	
object oBook1 = GetObjectByTag("plc_li_pl_book1");
object oTarget= GetObjectByTag("plc_li_ray_target");

//vector V1 = GetPosition( oTarget );
//vector V2 = GetPosition( oBook1);
//vector V3 = V1 - V2;
//float fFace = VectorToAngle( V3 );

effect eFX = EffectNWN2SpecialEffectFile("roe_beam_steeps");

//location lEffect = Location(GetArea(OBJECT_SELF), V3, 6.0);

//ApplyEffectAtLocation(DURATION_TYPE_PERMANENT, eFX, lEffect, 0.0);
//}

location lEndLoc = GetAheadLocation(oBook1, DISTANCE_MEDIUM);
object oEndTarget= GetObjectByTag("plc_li_ray_target");

DelayCommand(0.8f, ApplyEffectToObject(DURATION_TYPE_PERMANENT, eFX, oEndTarget, 0.0f));
}

Now, this is how the effect looks in the toolset.

 

rays_zpsboktw0fo.jpg

 

And this how it looked in game.

 

NWN2_SS_012415_205718_zpsg7hqsin0.jpg

 

No clue why. But I think this is what I need to fix in order to test it and see the projectile path.

 

Edit: Tested with a binding blast ray (stock effect) and this is the result.

I don't know how visible it is, but there is a starting point and ending point, ending point being the ground where I want it. This is good news. But where's the ray?

 

NWN2_SS_012415_210446_zpsvzzasart.jpg

 

Edit2: I forgot to refresh the script on the conversation which starts this, and this is why I was getting the point above the book. Now, with KevL's version I only get the sparkles on the floor. Maybe all it needs is some elevation, perhaps the ray is underground?

In general KevL's version throws the effect where we want. It doesn't seem though to have a starting point. Except if underground as said, or vertical and underground...



#14
andysks

andysks
  • Members
  • 1 645 messages

Would such a thing work? Or a placed effect would not follow actions?

 

// Orient to a target object
void ActionOrientToObject(object oTarget, int iOrientation = ORIENT_FACE_TARGET)

 

I mean, spawn it normally, and then use this to turn it facing its destination...



#15
Tchos

Tchos
  • Members
  • 5 030 messages

So an effect that doesn't incorporate a model can not be turned in any way? Because what I find weird is that the spells don't incorporate models, but can turn depending on target etc. But that's another story I guess. On the editor it's even an option for where we want it to start and stop. I guess that's what defines it.

 

For the record, billboard effects can be rotated in the toolset (rotate the placed effect helper and the effect rotates with it) and in the game.  It depends on what settings were used for the billboard effect.



#16
andysks

andysks
  • Members
  • 1 645 messages
But can a beam be a billboard? I have no clue what these definitions mean... or what's so different between them... but I guess not.

#17
Tchos

Tchos
  • Members
  • 5 030 messages

I don't think the info will help in the case of the beams.  I just wanted to confirm that model FX aren't the only ones that can be made to rotate.



#18
kevL

kevL
  • Members
  • 4 052 messages
andy,
I think whatever you're doing, you're going to have to open the .Sef in the visual effects editor
and check on the characteristics of the .sef as well as its related .bbx's and whatever

#19
andysks

andysks
  • Members
  • 1 645 messages

KevL I kinda thought the same. So I opened a stock ray (divination ray) to see how they do it. They used 4 fx, plus a sound one, while I was trying only with one. Anyway. I tried to recreate the same effect but with lower repeat time so that the beam doesn't go too fast. Result in the editor.

 

ray_zpspnrro2rx.jpg

 

In game, I only get the end effect (the one attached to the chest), no matter the script I use. So here is my guess.

 

Rays are supposed for spells, therefore they get destination target, get their direction and stop there. Changing them via script, vectors etc seemed impossible. Still, I might be doing something wrong.

 

Next step, I will try to just spawn the effect and see if it's an effect problem. If I still only see the end of it, it means yes. So hope might still exist.



#20
kevL

kevL
  • Members
  • 4 052 messages

it's gone beyond me. I will say that i find it unlikely anything here depends on having a "spellscript" tho.

( might be the z-level thing you mentioned earlier, or, try different target-attachment nodes. idk )



#21
kevL

kevL
  • Members
  • 4 052 messages

MotB has that ray-thing in the Academy basement, the beam that reflects off a half dozen mirrors. It stays up all the time once activated iirc.

u might have a look



#22
andysks

andysks
  • Members
  • 1 645 messages

Alright. In game it looks freaky. Either my vfx is wrong, or one can't spawn horizontal beams if they are not part of a spell(?).

Seeing in the VFX browser of the power bar all spell beams to be modeled as going upwards, even thought in game they are horizontal or bent, from caster to target supports this idea. I don't know.

I think thought that it's an interesting topic. It does add a lot in some highly magic areas. but for now I think next step is to go for a spell, meaning for a non permanent effect. Because they way I see it, a beam/ray cannot even be turned in the editor like the godrays which exist in all axises.

 

I would like though for this topic to go on, in case we are able to create a method for future use :).

 

Edit: Kevl, I missed your reply. The academy ray might be the last hope. Forgot about it. I'll get back with the news.



#23
andysks

andysks
  • Members
  • 1 645 messages

There is a lot of studying to go with this. First of all, did anyone even know that there is a global script call ginc_reflection which handles such things?



#24
andysks

andysks
  • Members
  • 1 645 messages

The way I see it:

 

The object to start it all sets out a beam, based on variables for where to, which beam, duration etc.

 

Next object, if we want to reflect it, has other variables for where to reflect. They work with North, South etc.

 

If we want the beam to stop, then another script handles it.

 

The placeables to interant with the beam, use the OnUserDefined slot. Don't know why, but I guess this is the way.

 

I will read the scripts included carefully and see which parts can be used for simplicity. In my case, at least for now, I don't need a reflection but just a single beam. This should make it easier to implement.

If anyone feels like it's useful information... to learn how to manipulate vfx like that, the things I found are these:

Module: E_X1

Area: e03_academy_instructor_quarters

Scripts: e_p_beamactivator_us

             e_inc_reflection

             ginc_reflection

             kp_beam_starter_ud

             e_p_beam_reflector_vfx_ud

             e_p_beam_end_ud

             kp_beam_reflector_ud

Conversation which starts it all is on the orb: e03_orb

 

Might be more, but that's all I found for now.



#25
kevL

kevL
  • Members
  • 4 052 messages

look at the beam .Sef it uses, and test your setup by replacing your current [ nwn2SpecialEffect ] with the one that's used in MotB ...

 

or if it uses a constant from VisualEffects.2da try it that way,

 

 

most of those scripts are prob. just distractions; I suspect the problem is with the .Sef itself