Aller au contenu

Photo

Trying to make an fx_* file appear on a heartbeat on a object


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

#1
Morbane

Morbane
  • Members
  • 1 883 messages
 I thought I has the code needed to do it but it is not working at all.

Code to follow (so formatting doesnt get borked)

#2
Morbane

Morbane
  • Members
  • 1 883 messages
void main()
{	
object oObelisk = OBJECT_SELF;	
location lLoc = GetLocation(oObelisk);	
effect eHB = EffectNWN2SpecialEffectFile("fx_hag_spawn01", oObelisk, lLoc);
ApplyEffectToObject(DURATION_TYPE_INSTANT, eHB, oObelisk);
}
I haven't been crunching code for a while - what am I missing here?

#3
_Knightmare_

_Knightmare_
  • Members
  • 643 messages
Perhaps instead try to ApplyEffectToLocation().

#4
Morbane

Morbane
  • Members
  • 1 883 messages
Yep Tried that - no luck.

So - have I coded the effect correctly? If so I will look to other things for roadblocks.

#5
M. Rieder

M. Rieder
  • Members
  • 2 530 messages
unless the effect is a beam or projectile, the only argument you need for the function "EffectNWN2SpecialEffectFile" is the string name of the file you are using. You also should write "fx_hag_spawn01.sef", instead of just "fx_hag_spawn01".

#6
Morbane

Morbane
  • Members
  • 1 883 messages
Thanks M. Got it to work - but i had one more thing that was needed: apply the sef file to a waypoint.

void main()
{
object oObelisk = OBJECT_SELF;

location lLoc = GetLocation(GetWaypointByTag("wp_fx_a"));

effect eHB = EffectNWN2SpecialEffectFile("fx_hag_spawn01.sef");

ApplyEffectAtLocation(DURATION_TYPE_INSTANT, eHB, lLoc);
}
It is good to have a few people that are always willing to help!

#7
Guest_Chaos Wielder_*

Guest_Chaos Wielder_*
  • Guests
Hm, I never write .sef in my own work with special effect files. Still, if it works, it works!--so I'm just quibbling.

#8
M. Rieder

M. Rieder
  • Members
  • 2 530 messages
Apparently it works both ways. I suspect morbane's main problem was fixed when he applied it to a waypoint.

Glad you got it working.

Modifié par M. Rieder, 14 mars 2011 - 07:57 .


#9
Shaughn78

Shaughn78
  • Members
  • 637 messages
You don't need the .sef as said above.

The issue with the origianl post was the additional information in the EffectNWN2SpecialEffectFile() funtion. Your second script post doesn't include it and it worked. Also the origianl script shouldn't have complied, you had a location for a vector.
EffectNWN2SpecialEffectFile("fx_hag_spawn01", oObelisk, lLoc);
EffectNWN2SpecialEffectFile( string sFileName, object oTarget=OBJECT_INVALID, vector vTargetPosition=[0.0,0.0,0.0] );

#10
Morbane

Morbane
  • Members
  • 1 883 messages
Another thing on top of all that - the object the script was attached to had to be non static.

Shaughn - The extra parameters were removed before I got it working - M. mentioned that they were unnecessary, so I dropped them before posting the working script.

Further, I used the same script on 3 more similar objects and it did not work until I made them non static.

#11
MasterChanger

MasterChanger
  • Members
  • 686 messages

Morbane wrote...

Another thing on top of all that - the object the script was attached to had to be non static.

Shaughn - The extra parameters were removed before I got it working - M. mentioned that they were unnecessary, so I dropped them before posting the working script.

Further, I used the same script on 3 more similar objects and it did not work until I made them non static.


The thing to keep in mind is that "static" means just that: they cannot be changed in-game in any way, whether by interaction with a player or by script. If you want an placeable to be static (or environmental) and still be able to put something in its vicinity, using a waypoint like you did would be the ticket.