Forum

> > CS2D > Scripts > bot approach
Forums overviewCS2D overview Scripts overviewLog in to reply

English bot approach

5 replies
To the start Previous 1 Next To the start

old bot approach

Casper-
User Off Offline

Quote
Title seems noobish well nvm

i need some help here

i copied post from the "Lua/Scripts/Questions"


BureX has written
Yasday has written
Use
1
2
3
ai_aim(id,x,y)--x and y in pixels
ai_attack(id)--primitive attack
ai_iattack(id)--intelligent attack

it works but they dont stand to the window and destroy it

Picture :
Spoiler >


Script :
Spoiler >

Idk how to make them to stand to the barricade and destroy it.
Is it possible to do that ?

old Re: bot approach

DC
Admin Off Offline

Quote
you can tell them to go to any location you want.
you can tell them to aim/attack.

so yes, it is possible.

let them go next to the breakable object with.. er.. ai_goto I guess, afterwards let them rotate to the breakable and let them attack. that's it.

old Re: bot approach

Casper-
User Off Offline

Quote
DC has written
you can tell them to go to any location you want.
you can tell them to aim/attack.

so yes, it is possible.

let them go next to the breakable object with.. er.. ai_goto I guess, afterwards let them rotate to the breakable and let them attack. that's it.


it still doesnt work

heres the new one

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
function ai_gotot(id,x,y)
	if player(id,"bot") then
		if player(id,"team") == 1 then
			local c=math.random(1,11)
			if c==1 then
			ai_goto(id,12,6)
			ai_rotate(id,180)
			ai_attack(id)
			elseif c==2 then
			ai_goto(id,8,17)
			ai_rotate(id,90)
			ai_attack(id)
			elseif c==3 then
			ai_goto(id,18,20)
			ai_rotate(id,1)
			ai_attack(id)
			elseif c==4 then
			ai_goto(id,25,19)
			ai_rotate(id,1)
			ai_attack(id)
			elseif c==5 then
			ai_goto(id,21,6)
			ai_rotate(id,180)
			ai_attack(id)
			elseif c==6 then
			ai_goto(id,35,6)
			ai_rotate(id,180)
			ai_attack(id)
			elseif c==7 then
			ai_goto(id,52,19)
			ai_rotate(id,-90)
			ai_attack(id)
			elseif c==8 then
			ai_goto(id,46,32)
			ai_rotate(id,1)
			ai_attack(id)
			elseif c==9 then
			ai_goto(id,34,21)
			ai_rotate(id,90)
			ai_attack(id)
			elseif c==10 then
			ai_goto(id,25,11)
			elseif c==11 then
			ai_goto(id,43,20)
			end
		end
	end
end

old Re: bot approach

DC
Admin Off Offline

Quote
because you don't do it right.

you let the bot go, rotate and attack at the same time. you attack even if the bot has not reached the destination.

you have to check the return value of goto etc. I'm not going to explain how to write AI here but you have to know that ai_goto does only ONE step for you. you have to call it again and again MANY frames, not just once, until the bot reaches the destination. you have to save the state of the bot in variables etc. take a look at the original AI script.

old Re: bot approach

robed
User Off Offline

Quote
thats awesome thats cool

are you releasing the map next time

old Re: bot approach

DC
Admin Off Offline

Quote
wtf... which map? this is about a Lua script?! nonsense.
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview