Advertisement
inkoalawetrust

A_AlertDwellers() (Broken)

Apr 25th, 2021
753
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.12 KB | None | 0 0
  1.     //A pointer to the actor generated by the player when they perform actions like jumping,
  2.     //so that actor can be made into the dwellers' target, so they initially chase that last heard location instead of the player directly.
  3.     Actor LastHeardLocation;
  4.     Private Void A_AlertDwellers (Double AlertRadius = 600.0)
  5.     {
  6.         BlockThingsIterator FindDwellers = BlockThingsIterator.Create (Self,AlertRadius);
  7.         Actor FoundActor;
  8.        
  9.         While (FindDwellers.Next()) //Iterate through the nearby actors.
  10.         {
  11.             FoundActor = FindDwellers.Thing;
  12.             If (FoundActor && FoundActor is "NPC_Dweller" && NPC_Dweller(FoundActor).ActualTarget) //If a found actor is a dweller.
  13.             {
  14.                 If (LastHeardLocation) {LastHeardLocation.Destroy();} //Delete that last heard location if a new one is to be spawned.
  15.                 LastHeardLocation = Spawn ("LastHeardPlayerLocation",Self.Pos);
  16.                 FoundActor.Target = LastHeardLocation; //And make that point the player was last heard in the dwellers' target.
  17.                 NPC_Dweller(FoundActor).ActualTarget = Self; //And keep a pointer to the player themselves as well, so the dweller can check if they are around.
  18.             }
  19.         }
  20.     }
  21.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement