Various ScriptedPawn questions

  • Two Factor Authentication is now available on BeyondUnreal Forums. To configure it, visit your Profile and look for the "Two Step Verification" option on the left side. We can send codes via email (may be slower) or you can set up any TOTP Authenticator app on your phone (Authy, Google Authenticator, etc) to deliver codes. It is highly recommended that you configure this to keep your account safe.

BondJamesBond

New Member
Sep 23, 2001
43
0
0
Visit site
Hey Everybody!

I am making a Terrorist actor that sub-classes ScriptedPawn. I can make him play animations, give him a gun, and make him die when shot enough.


How can I make him do the following?:

1.) Detect that the player is in his FOV
2.) Turn towards the player (the compiler doesn't allow it in any of my functions)
3.) Aim at the player at look like it's doing so
4.) Shoot at the player until he's dead or out of view
5.) Find the best path to a given actor
6.) AND, find a hostage with a given tag

Do I have to use states? If so, how?????

Thanks in advance,
Rainbow Six
 

Wormbo

Administrator
Staff member
Jun 4, 2001
5,913
36
48
Germany
www.koehler-homepage.de
1) Normal(OtherPlayer.Location - Location) dot vector(ViewRotation) > someFloatValue
2) maybe TurnTowards(anActor), this is a latent function so it can only be used in state code, not in functions
3) I think that should be an animation
4) dunno, have a look at Botpack.Bot
5) also look at Botpack.Bot and the FindSpecialAttractionFor() function in Botpack.CTFGame
6) same like 5)

I guess you've got to use lots of states like other ScriptedPawns and UT's Bots.
 

BondJamesBond

New Member
Sep 23, 2001
43
0
0
Visit site
1.) Your first response... What is it for, and exactly what is the syntax? It has interested me. Isn't there a bPlayerInView variable somewhere? SeePlayer doesn't seem to get called.

2.) TurnTo(Player.Location) doesn't seem to work, even inside state code. Is there a way to accomplish this using plain math?

3.) It IS an animation!! Thank you!

4.) Yeah, I'll take a peek at that. Thanks.

5.) Isn't there a FistBestPathTo(actorName) inside ScriptedPawn? Anyway, I'll take a look at that.

6.) I looked. The Mod Developer's guide at unreal.epicgames.com has a way to perform functions with a desired actor.


THANKS FOR ALL YOUR HELP!!
--Rainbow Six
 

Wormbo

Administrator
Staff member
Jun 4, 2001
5,913
36
48
Germany
www.koehler-homepage.de
1)
This is the dot product of two vectors: "Other.Location - Location" is the vector starting at the location of the actor this function is called from and ending at the location of actor Other. Normal() returns a vector with the same direction but a length of 1 Unreal unit. vector(ViewRotation) is a vector of length 1 pointing in the same direction as the rotator ViewRotation. The dot product of these two vectors can be:
> 0 (the vectors somewhat point in the same direction with a value of 1 indicating exactly the same direction)
< 0 (the vectors point in opposite directions, again -1 means exactly the opposite direction)
== 0 (both vectors form an angle of exactly 90°)

(I hope this is what you wanted to know)#

2)
You could use Tick(), Timer() or state code with Sleep() to change the Rotation property (maybe with some vector math if you're not used to rotators.)
 

Call me Erdrik

Arch Mage
Nov 24, 1999
334
0
0
43
Spring Hill, FL, USA
www.geocities.com
@Wormbo:
with
Normal(OtherPlayer.Location - Location) dot vector(ViewRotation) > someFloatValue
does the bot have to be looking dirctly at the OtherPlayer, or does the some FloatValue indicate a variance? I want
"Detect that the player is in his FOV "
but like a cone.....


Im not sure if I said that right :p