For the life of me I can't remember who made
the force field v2 script, but with some modifications I have enabled it to
repel alignment only instead of everyone. The script that is gonna be posted
will allow evil characters to pass but blocking anyone else from passing.
I would like to thank the original creator for making the original script,
because this wouldn't have been possible without him/ or her.
Instructions:
1. Copy this script and create a new one with a name like align_field or
something like that.
2. Create a waypoint with the tag "force_bouncer"
3. Create a trigger around that waypoint. And apply this script to the
OnEnter event of that trigger.
Tips: If your going to make a large non passable area, you should probably
place several waypoints down, all with the same tag, then create a giant
trigger around them, as it gets the closest waypoint to the current pc
entering the field.
Warning: If you have 2 fields across from each other, like a wallway, a pc
can pass through one force field through the one across from it. It's a
problem with the code I think. Well last I checked anyways. Not sure if this
is fixed, but watch out for that.
NWScript: void bounce_player(location loc) {
ClearAllActions();
JumpToLocation(loc);
ActionDoCommand( SetCommandable(TRUE) );
SetCommandable(FALSE);
}
void main()
{
object player = GetEnteringObject();
object bouncer = GetNearestObjectByTag( "force_bouncer", player );
int nAlign = GetAlignmentGoodEvil(player);
if (nAlign == ALIGNMENT_GOOD)
{
location player_location = GetLocation(player);
location bouncer_location = GetLocation(bouncer);
vector player_position = GetPositionFromLocation( player_location );
vector bouncer_position = GetPositionFromLocation( bouncer_location );
object player_area = GetAreaFromLocation( player_location );
float player_ori = GetFacingFromLocation( player_location );
vector displacement = player_position - bouncer_position;
if( VectorMagnitude( displacement ) <= 0.0 ){
displacement = -1.0 * AngleToVector( player_ori );
}
displacement = VectorNormalize( displacement );
float bounce_strength = 3.5;
displacement = displacement * bounce_strength;
player_position = displacement + player_position;
player_location = Location( player_area, player_position, player_ori );
effect bounce_flash = EffectVisualEffect( VFX_IMP_SUNSTRIKE );
ApplyEffectAtLocation( DURATION_TYPE_INSTANT, bounce_flash, bouncer_location);
AssignCommand(player, bounce_player(player_location));
}
else if (nAlign == ALIGNMENT_NEUTRAL)
{
location player_location = GetLocation(player);
location bouncer_location = GetLocation(bouncer);
vector player_position = GetPositionFromLocation( player_location );
vector bouncer_position = GetPositionFromLocation( bouncer_location );
object player_area = GetAreaFromLocation( player_location );
float player_ori = GetFacingFromLocation( player_location );
vector displacement = player_position - bouncer_position;
if( VectorMagnitude( displacement ) <= 0.0 ){
displacement = -1.0 * AngleToVector( player_ori );
}
displacement = VectorNormalize( displacement );
float bounce_strength = 3.5;
displacement = displacement * bounce_strength;
player_position = displacement + player_position;
player_location = Location( player_area, player_position, player_ori );
effect bounce_flash = EffectVisualEffect( VFX_IMP_SUNSTRIKE );
ApplyEffectAtLocation( DURATION_TYPE_INSTANT, bounce_flash, bouncer_location);
AssignCommand(player, bounce_player(player_location));
}
}
Again thank the original creater for the Force Field v2 Script.
Deadphyre out
Email deadphyre@charter.net
|