pawn to a certain pos

Topics regarding Scripting with Reality Factory
Post Reply
User avatar
darksmaster923
Posts: 1857
Joined: Wed Jan 03, 2007 10:32 pm
Location: Huntington Beach, California, USA

pawn to a certain pos

Post by darksmaster923 »

sup yall, i am trying to make the pawn to a dynamic X-Y-Z location
like if the pawn dies in a firefight, he runs back to where he was and attacks the pawn/player he fought
Herp derp.
User avatar
paradoxnj
RF2 Dev Team
Posts: 1328
Joined: Wed Mar 01, 2006 7:37 pm
Location: Brick, NJ
Contact:

Post by paradoxnj »

You need to somehow save the position where the pawn/player died, then set the pawn/player to that position when you respawn.
User avatar
darksmaster923
Posts: 1857
Joined: Wed Jan 03, 2007 10:32 pm
Location: Huntington Beach, California, USA

Post by darksmaster923 »

well i did in 3 variables
but i have no idea to get the pawn over there
Herp derp.
User avatar
paradoxnj
RF2 Dev Team
Posts: 1328
Joined: Wed Mar 01, 2006 7:37 pm
Location: Brick, NJ
Contact:

Post by paradoxnj »

There should be a scripting command to set the target to the player/pawn name who killed you. That would probably be the best thing to do since you don't want to assume that the player/pawn will not move after you die.
Last edited by paradoxnj on Tue Jul 17, 2007 8:51 pm, edited 1 time in total.
User avatar
darksmaster923
Posts: 1857
Joined: Wed Jan 03, 2007 10:32 pm
Location: Huntington Beach, California, USA

Post by darksmaster923 »

yeah but that will like teleport him
Herp derp.
User avatar
paradoxnj
RF2 Dev Team
Posts: 1328
Joined: Wed Mar 01, 2006 7:37 pm
Location: Brick, NJ
Contact:

Post by paradoxnj »

You were too quick. I edited my post. See above.
User avatar
ardentcrest
Posts: 735
Joined: Wed Jan 25, 2006 10:55 pm
Location: Ireland

Post by ardentcrest »

Search the demos there is one where the bots if they see you move to your spot.

ie They move X,Y,Z to your X,Y,Z

find that demo look at the bots script and you will be 1/2 way there.

Infact, download all the rf demos see what they can do, most of this is scripts. Look at the scrits and learn. :twisted:


DAM YOUR QUICKER THAN ME :lol:
He's a Bot Jim, But not as we know It.
User avatar
darksmaster923
Posts: 1857
Joined: Wed Jan 03, 2007 10:32 pm
Location: Huntington Beach, California, USA

Post by darksmaster923 »

hmm i just got an idea

from the docs

self.last_enemy_yaw

Returns the last known yaw of the previously targeted enemy.

self.last_enemy_pitch

Returns the last known enemy pitch of the previously targeted enemy.

self.last_enemy_range

Returns the last known enemy range of the previously targeted enemy.
Herp derp.
User avatar
ardentcrest
Posts: 735
Joined: Wed Jan 25, 2006 10:55 pm
Location: Ireland

Post by ardentcrest »

sorry I lost your train of thought at the end of your post :twisted:

or did you hit submit before you could FINS...
He's a Bot Jim, But not as we know It.
User avatar
darksmaster923
Posts: 1857
Joined: Wed Jan 03, 2007 10:32 pm
Location: Huntington Beach, California, USA

Post by darksmaster923 »

ardentcrest wrote:sorry I lost your train of thought at the end of your post :twisted:

or did you hit submit before you could FINS...
? well i was showing the vars becuz they could be very helpful( to me anyway)
Herp derp.
User avatar
Juutis
Posts: 1511
Joined: Thu Jan 12, 2006 12:46 pm
Location: Finland

Post by Juutis »

That's very tricky without proper pathfinding.

You could make the pawn run towards the position where he died, but the level would have to be really simple. With a complex level it's very unlikely that running straight will get you where you want. Though I think there are ways to increase the possibility for the pawn reaching the point.

You could use the GetCollideDistance() command to make the pawns a bit aware of their surroundings. Then if they run into a wall and have two options, left and right, they could pick the one that's more likely to get them to the target point. I'm not sure how to do that exactly, but I think you could use the command to get many distances to the walls in different directions from the pawn and compare the results. For example, if the command returns 100 when getting the distance to the wall directly in front of the pawn, 200 to the left, 5000 to the back and 3200 to the right, it would probably mean that you can't go forward or left and back is the way you came from so going right is the only option. You would then rotate the pawn, move it there and scan the surroundings again.


Let's hope Jay finishes the pathfinding and makes another community release soon. :wink:
Pain is only psychological.
User avatar
darksmaster923
Posts: 1857
Joined: Wed Jan 03, 2007 10:32 pm
Location: Huntington Beach, California, USA

Post by darksmaster923 »

Juutis wrote:That's very tricky without proper pathfinding.

You could make the pawn run towards the position where he died, but the level would have to be really simple. With a complex level it's very unlikely that running straight will get you where you want. Though I think there are ways to increase the possibility for the pawn reaching the point.

You could use the GetCollideDistance() command to make the pawns a bit aware of their surroundings. Then if they run into a wall and have two options, left and right, they could pick the one that's more likely to get them to the target point. I'm not sure how to do that exactly, but I think you could use the command to get many distances to the walls in different directions from the pawn and compare the results. For example, if the command returns 100 when getting the distance to the wall directly in front of the pawn, 200 to the left, 5000 to the back and 3200 to the right, it would probably mean that you can't go forward or left and back is the way you came from so going right is the only option. You would then rotate the pawn, move it there and scan the surroundings again.


Let's hope Jay finishes the pathfinding and makes another community release soon. :wink:
<_< with that technique the bots are gunna run in circles

DAMMNIT JAY RELEASE!!!!!!!!!!!!!!!
Herp derp.
Post Reply