Forum

> > CS2D > Scripts > Recordmovement, let a bot play it.
Forums overviewCS2D overview Scripts overviewLog in to reply

English Recordmovement, let a bot play it.

6 replies
To the start Previous 1 Next To the start

old Recordmovement, let a bot play it.

ZaibatsuTEAM
User Off Offline

Quote
Is there a way to record my own movement, for example:

I walk to a wall, and hit it with a knife.
and then I will be able to save that, then a bot will be able to do what I just did.

And, is it possible to do different movements to different bots? cuz i want all bots to have different directions to go to.

old ty

ZaibatsuTEAM
User Off Offline

Quote
lol thanks for telling me that it is possible, but since i'm super noob, i have absolutely no idea how to code it. xd

old Re: Recordmovement, let a bot play it.

Rainoth
Moderator Off Offline

Quote
Well, you store player position into a table then make bot move to that position using the values you recorded. How frequent you record the position is up to you. I would do it every 1-3 seconds since bots have pathfinding and will walk to the spot you recorded regardless if there's a wall between the last and new position or not. You also record each time the bot attacks and in what position he does that, then u just use the command for bot to attack if he's in that spot. Hope I'm clear enough. There are commands for what I mentioned but I never used them because I never coded bots.

old Re: Recordmovement, let a bot play it.

ZaibatsuTEAM
User Off Offline

Quote
Yes thanks rainoth, you're a 100% clear. but I do need a script example like usually since i'm useless at scripting, i can only understand it with examples since im too lazy to actually learn lua.

but hmm, isn't there already a script or map with bots who moves around and guarding places? like coop.. I remember there being such map. I just can't remember the name of it, cuz maybe that script/map can help me out aswell.

old Re: Recordmovement, let a bot play it.

Rainoth
Moderator Off Offline

Quote
Not that I know of. I can't script a definite example but something like this:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
tehbl = {}
for i = 1,32 do
	tehbl[i] = {}
end

sec = 0

addhook("second","_s")
function _s()
	sec = sec + 1
	for k,v in pairs (player(0,"tableliving")) do
		tehbl[v][sec] = {}
		tehbl[v][sec].x = player(v,"tilex")
		tehbl[v][sec].y = player(v,"tiley")
	end
end
This should supposedly record bot positions (records player to later be used by bot) every second. Then you use that information with cs2d lua cmd ai_goto and if the bot is in position of the table, you increase index by one and use the same command to walk to next recorded spot

Same thing with attacking and other actions - record when they happened and at what spot, if a bot is at that spot he does the action. You'll need different hooks for different actions of course
edited 1×, last 27.11.15 06:30:24 pm
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview