Forum

> > CS2D > Scripts > Control activities bot
Forums overviewCS2D overview Scripts overviewLog in to reply

English Control activities bot

9 replies
To the start Previous 1 Next To the start

old Control activities bot

KabirDuy
User Off Offline

Quote
> First of all sorry for my bad english...
And I have a few requests, i'm not good at that script:

• A bot script only moves in the direction of the script (Go step by step, for example: go to the left -> go straight -> stop).

• A script for bot attacks directed wall ... (No, wait a little, well true, the bot go to a place where the wall next to the bot, the bot will attack until the wall is collapsed).

• Every 30 seconds, bot: speed up +1, attack power +1 and HP +5.

∗ Thank you for reading and thank you even more if you help me.

old Re: Control activities bot

MikuAuahDark
User Off Offline

Quote
You can do this with coroutine and this: http://www.cs2d.com/help.php?luacat=ai

if you still not know anything, i need some data from you

user KabirDuy has written
• A bot script only moves in the direction of the script (Go step by step, for example: go to the left -> go straight -> stop).

I need
1. ID of the bot
2. Start from where
3. Stop where

user KabirDuy has written
• A script for bot attacks directed wall ... (No, wait a little, well true, the bot go to a place where the wall next to the bot, the bot will attack until the wall is collapsed).

1. Rotation of the boton the wall. Example:
Spoiler >

from that, we can see wall is on 90degree
or just give me the tile x and y of the wall
2. how many times the bot will attack the wall

Afterwards i can do it without any problem

old x

Gomme
User Off Offline

Quote
wo si control bot script

old Re: Control activities bot

MikuAuahDark
User Off Offline

Quote
oh my mistakes, i mean the tile coordinate of the wall

EDIT:
Okay here the code you just need to edit line 14 if it's not shooting wall correctly
Required file cs2d Timer Extra function(timerEx) v4.0
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
statusBot=0
controller=coroutine.create(function(bot)
	parse("setpos "..bot.." 544 2240")
	for i=1,180 do
		ai_rotate(bot,i)
		coroutine.yield()
	end
	statusBot=1
	ai_goto(bot,17,79)
	repeat
		coroutine.yield()
	until ai_goto(bot,17,79)==1
	statusBot=2
	ai_rotate(bot,180)	-- Bot rotation for attacking the wall
	coroutine.yield()
	statusBot=3
	for i=1,15 do
		ai_iattack(bot)
		coroutine.yield()
	end
	statusBot=4
end

addhook("always","botcontroller")
function botcontroller()
	if statusBot==2 then
		timerEx(5000,coroutine.resume,1,controller,2)
		statusBot=2.5
		
	elseif statusBot<1 and statusBot>=3 then
		if coroutine.resume(controller,2)==false then
			freehook("always","botcontroller")
		end
	end
end

timerEx(30000,parse,100,"setmaxhealth 2 "..(player(2,"maxhealth")+5).."; speedmod 2 "..(player(2,"speedmod")+1),0)
It' untested but i think it should work
Note: it's impossible to increate the damage for 1 player, it would take more long lines to do that
edited 2×, last 09.06.13 12:02:12 pm
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview