fencing in creatures within a trigger
This scripting forum is to discuss scripting and for those needing help scripting to get help from others.

Moderators: Mermut, rdjparadis

Post Reply
User avatar
Winterhawk99
Posts: 1629
Joined: Thu Oct 08, 2009 12:00 am
ctp: Yes
nwnihof: Yes
Location: Pa.
Contact:

fencing in creatures within a trigger

Post by Winterhawk99 »

I worked alittle on a script to corral creatures in. This is very basic and isnt tested as yet. I have to make a custom on spawn and on death to prevent some exploits yet. I did prevent one exploit with a heal creature on jump. In this case (example) I will use fish.

You draw a trigger in the water you want the fish to say in so they cannot go on land. Place a waypoint in the center. place an integer on the fish. then place the fish in the water. The fish swims within the trigger. If a PC comes along wading in the water the fish will attack them. The pc moves out of the water then turns on land and tries to shoot the fish. The fish when reaching the exit of the trigger will jump to the waypoint in the center and be healed so that the pc has to go into the water to kill it.

Code: Select all

void main()
{
  object oCreature = GetExitingObject();
  object oTarget = GetWaypointByTag("06_post");
  int iCoral = GetLocalInt(oCreature, "iFence");
  location lDest = GetLocation(oTarget);
  int iHP = GetMaxHitPoints(oCreature);
  effect eHeal = EffectHeal(iHP);



   if(iCoral > 0 )

  {  ClearAllActions();
    DelayCommand(1.0,AssignCommand(oCreature, ActionJumpToLocation(lDest)));
    ApplyEffectToObject(DURATION_TYPE_INSTANT, eHeal, oCreature);

  }

}
Next I will make a custom OnSpawn script so that you can put any creature in a fence. I will also make a custom OnDeath script to prevent further exploitation of killing the creatures outside the trigger area.
CTP team member
http://www.harvestmoonconsortium.com
Chief cook and bottle washer for Harvest Moon

Post Reply