Forum

> > CS2D > Scripts > Weird behavior while making AI use Trigger_Use
Forums overviewCS2D overview Scripts overviewLog in to reply

English Weird behavior while making AI use Trigger_Use

2 replies
To the start Previous 1 Next To the start

old Weird behavior while making AI use Trigger_Use

VapidLinus
User Off Offline

Quote
I'm trying to make the AI be able to trigger Trigger_Use.
This is for my zombie server that I'm working on, so people who are camping in rooms with trigger based doors can still get killed by zombies.

I thought that I had finished the core of it, but I'm getting weird behaviors from the AI.
The bots are rapidly shaking while slowly moving towards the trigger.

I added a new vai_mode in Standard AI.lua:
elseif vai_mode[id]==9 then
	-- 9: USE TRIGGER -------------------------------------------> find and activate trigger

	local result=ai_goto(id,vai_destx[id],vai_desty[id])
	if result==1 then
		print("Reached target")
		ai_use(id)
		vai_mode[id]=0
	elseif result==0 then
		print("Couldn't reach target")
		vai_mode[id]=0
	else
		print("Heading for target")
		fai_walkaim(id)
	end

	vai_mode[id]=0


Note that the console gets spammed all the time with "Couldn't reach target" & "Heading for target", so it seems like it can't decide whether or not it can reach the target.

In decide.lua I basically force it to switch to vai_mode 9, just for testing purposes.
Then it's constantly trying to reach and activate a trigger.
if vai_set_gm==4 then
		------------------------------------------ Game Mode 4: Zombies
		if team==1 then
			------------------- Terrorists (Zombies)
			if true then
				vai_mode[id]=9
				vai_destx[id],vai_desty[id]=randomentity(93)
			else

I cut out everything behind the last "else" so it wouldn't take up the entire page.
Here's the full decide.lua

Spoiler >


Anyone who has a clue to what I am doing wrong?
Thanks in advance!
edited 1×, last 14.04.13 06:12:33 pm

old Re: Weird behavior while making AI use Trigger_Use

VapidLinus
User Off Offline

Quote
user HeX has written
not a clue but whut i would do is remove doors and make it construction zombies so they can only make walls

then code-in AI attack building script witch is somewhere on here.

No, that's not at all what I want.
I don't want the player to be able to place walls, nor destroy them.
The reason I use the Trigger_Use entity is so the door can be both opened and closed.
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview