ScriptedPawn help!!

  • 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 All!

I am making a terrorist actor that sub-classes ScriptedPawn. How can I make him do all of this stuff?:


1.) Detect that a PlayerPawn is in his FOV. SeePlayer won't work when I use it outside of a state. Do I have to use a state?

2.) Turn towards/aim at the PlayerPawn in view. The TurnToward() function is "not allowed" in my functions. Again, do I have to use states?

3.) Shoot at the PlayerPawn until he's dead or out of view. I know what Weapon.Fire() is, but how to use it?

4.) Find the best path to get to a given actor. Do I use the FindBestPathTowards() function?

5.) Find/Refer to a hostage actor with a given tag.

Thanks everyone!
-Rainbow Six
 

MecaNitroPenguin

Errrr...
Dec 24, 2001
44
0
0
Visit site
this isn't really an answer but what's so bad about states. Just have something like

auto state begin
{
Put functions here that need to use functions that can only be called within states(I think there called latent functions)
}

Your code will start in the begin state and so you can use those functions you want
 

EasyRaider

Crazy coder
Sep 21, 2001
74
0
0
43
Norway
If you are making it for UT and not Unreal, I think it would be better to subclass HumanBotPlus or MaleBotPlus.

I don't know much about AI programming, but I have tried to modify the bots for Unreal, to make the lower skill bots play more like real newbies. It was harder than I thought.
 

usaar33

Un1337
Mar 25, 2000
808
0
0
Unknown
www.UsAaR33.com
Well, I see no reason for you to use bot. I'd just stick with scriptedpawn, if you want mappers to be able to use alarms/patrols/etc.

Originally posted by Rainbow6
Hey All!

I am making a terrorist actor that sub-classes ScriptedPawn. How can I make him do all of this stuff?:


1.) Detect that a PlayerPawn is in his FOV. SeePlayer won't work when I use it outside of a state. Do I have to use a state?


Yes, it does work outside of a state. You are doing something wrong.

2.) Turn towards/aim at the PlayerPawn in view. The TurnToward() function is "not allowed" in my functions. Again, do I have to use states?

Yes, turntoward() is latent, and is "state only"..You could also exploit desiredrotation and brotatetodesired.

3.) Shoot at the PlayerPawn until he's dead or out of view. I know what Weapon.Fire() is, but how to use it?

Just use standard GotoState('Attacking');
in fact scriptedpawn already does this. All you should really need to do is add animation playing code, default properties, and if you want some extra code.

4.) Find the best path to get to a given actor. Do I use the FindBestPathTowards() function?

Ya... Well not really.. if it is already reachable, you need to check that...

5.) Find/Refer to a hostage actor with a given tag.

Foreach AllActors(class'HostageClass',Hostie,HostageTag)
 

BondJamesBond

New Member
Sep 23, 2001
43
0
0
Visit site
Thanks usaar33 !!!!

A few more questions...

PLEASE tell me more about desiredRotation !! How exactly to use it??

If I was doing something wrong with SeePlayer, then what?? FYI: This is outside of a state.

event SeePlayer( actor Seen )
{
GotoState('Attacking');
}

Do I have to have an 'Attacking' state if I call it, or does ScriptedPawn know what I'm talking about?

Thanks again,
-Rainbow Six
 
Last edited by a moderator:

usaar33

Un1337
Mar 25, 2000
808
0
0
Unknown
www.UsAaR33.com
Uh, that code won't work, as it doesn't have its enemy set.

Look, just base all your code of the normal scriptedpawn stuff. It has proper seeing code. And for desiredrotation, set desiredrotation to what you want him to rotate to and set bRotateToDesired to true.

Again, stay with normal scriptedpawn code and maybe implement other stuff in other states or whatever.
 

BondJamesBond

New Member
Sep 23, 2001
43
0
0
Visit site
one LAST question...

Hi!! Me again!!

I am using the correct ScriptedPawn tecniques, but when I kill the terrorist, he turns into a greenish-grey texture.

How to fix?? I have a PlayDying sequence...

Thanks in advance time,
--Rainbow Six
 

Mr.Mitchell

New Member
Sep 5, 2001
140
0
0
the Netherlands
home.ict.nl
It sounds like the default texture is used. This probably means that no texture is assigned or a wrong name is used. Check the unrealtournament.log file. It probably has a waring in it that can help you find the problem.