Page 2 of 3

Posted: Wed Jun 18, 2003 10:13 pm
by Bjarne BZR
Now I've tried it and have gotten confused...

This thing about having 2 'targetname'.
It is strange to me... to be a camper node it needs to have targetname/camper...and I cant set another targetname with another value at the same time...

In desperation I tried to set:
targetname = camper
and
$targetname = trigger_camp_wall1

this is the only way I could think of, but later when trying to set the noaxis in the script, I get:

Code: Select all

$trigger_camp_wall1.noaxis = 1 (maps/obj/obj_vemork_12.scr, 105)
$trigger_camp_wall1^
^~^~^ Script Error: Field 'noaxis' applied to NULL listener
... that is $trigger_camp_wall1 does not exist. :cry:

Or can I set 2 targetnames the same way I set multiple targets?
targetname = camper trigger_camp_wall1

So how do you mean this? Explain it to me as if I was a child :oops:

Posted: Thu Jun 19, 2003 8:57 am
by jv_map
Hmm that's strange... It worked before for me :?

Anyway there is another way: Use just one targetname (e.g. camp) and set another key, for example $tag, with as value a name for the group of $camp nodes, for example 'trigger'.

Then in your script you can quickly disable these nodes this way:

Code: Select all

for(local.i = 1; local.i <= $camp.size; local.i++)
{
  local.node = $camp[local.i]
  if(local.node.tag == trigger)
    local.node.noaxis = 1
}

Posted: Thu Jun 19, 2003 4:26 pm
by Bjarne BZR
Now it looks as if it works better. :D
A new problem however... the first round after map start: all works as expected, the next round however; the documents are stolen by invisible ghosts :shock:

I get this:

Code: Select all

INFO[jv_mp_ai::action_go_to_routed]: Bot ai: 13 is going to follow route desk_to_wall to triggernode
shortly ( not imediately) followed by this:

Code: Select all

Wall documents stolen by ai: 13
...so something is correct, Its just that the bot is not in the room as he activates the trigger...

This is the new stuff that I scripted after the trigger has been activated:

Code: Select all

for(local.i = 1; local.i <= $camper.size; local.i++) { 
  local.node = $camper[local.i]
  if(local.node.tag == desk) {
    local.node.noaxis = 1
  }
}
for(local.i = 1; local.i <= $sniper.size; local.i++) { 
  local.node = $sniper[local.i] 
  if(local.node.tag == desk) {
    local.node.noaxis = 1
  }
}
...and the "triggernodes" are made up of ( key/value ) targetname/sniper & targetname/camper nodes with the node/desk set...

...maby this problen will go away as soon as I do a full compile again, instead of the wonderful -onlyents compile...

Is there something I destroy on the "Game" level intead of the "Level" level? Must I reset the nodes to noaxis = 0 again?

If it helps:
I've put the level script here.
...and...
The console logfile here ( 2 games, the second one strange )

Posted: Thu Jun 19, 2003 5:21 pm
by jv_map
Uhm I'm startled again :oops:. According to the logfile everything worked fine :? :
mohaa wrote: INFO[jv_mp_ai::action_go_to_routed]: Bot ai: 13 is going to follow route desk_to_wall to triggernode
(...)
wall_document_trigger triggered
Documents stolen by ai: 13
Wall documents stolen.
It seems that for some weird reason the action_go_to_routed thread exited too early :?. I'll research this into the smallest detail tomorrow ;).

Oh btw use $tag instead of tag :)

Posted: Fri Jun 20, 2003 12:45 pm
by jv_map
I still can't find anything why it would work once but not twice :?. I think we'll need a debug version of some scripts...

Posted: Tue Jun 24, 2003 12:37 pm
by Bjarne BZR
Not ignoring U
On vacation
Back in a week
:)

Posted: Tue Jun 24, 2003 12:38 pm
by jv_map
Have an excellent vacation :D

Posted: Mon Jun 30, 2003 5:18 pm
by Bjarne BZR
Thanx JV, I did! :)

I'll recompile this stupid map completely now.... just to avoid any errors from the -onlyents compile.

<edit>
Now I've recompiled it. Here is the logfile from the first 3 games.

Just one thing: This $tag instead of tag thing... what is the difference between the #XXX $XXX and XXX ?

Posted: Tue Jul 01, 2003 6:25 am
by jv_map
Bjarne BZR wrote:Just one thing: This $tag instead of tag thing... what is the difference between the #XXX $XXX and XXX ?
$tag defines the key as a variable with data type string.
#tag defines the key as a variable with data type integer (I think).
tag makes the game handle the key as a command for the entity.

Maybe I can make it more understandable with a scripting example:
$tag and #tag would be:
self.tag = "mytag" or self.tag = 4

tag is:
self tag "mytag"

As 'tag' is not a valid command the latter results in an error ('failed execution of event 'tag'').

Posted: Tue Jul 01, 2003 6:44 am
by jv_map
I still don't understand why the bots don't work properly the second round, but here's the debug script I promised:
http://home.student.utwente.nl/a.b.vrij ... _debug.pk3

Please make a logfile with this file in your main folder :)

Posted: Tue Jul 01, 2003 2:09 pm
by Bjarne BZR
OKI, its done...

.... here is the logfile ( 1,4MB ).

And another thing: the bomb campers VERY seldom runs for "cover" whan the bomb is about to blow ( one in maby twenty does it ) any idea why?

Apart from these 2 strange things all is starting to look really good now :)

Oh, one more thing: Could I change the bots "hearing" to reduce the "stare at the floor/celing" error? Or are they already deaf in the latest release? If I should reduce it, how do I script that?

Posted: Tue Jul 01, 2003 2:23 pm
by Bjarne BZR
jv_map wrote:I still don't understand why the bots don't work properly the second round
...actually jv: they dont work the first round either. After some more testing it looks as if it depends more on what route the "ghosts" take ( if they decide to go to the triggers or not ), than what round it is. The trigger is activated by a "ghost-bot" even if I sit on it :shock: :D :cry:

Posted: Tue Jul 01, 2003 2:57 pm
by Bjarne BZR
I put together an ALFA version pk3 of the map If you ( or anyone else ) want to take it for a test spin in its current status. It has to be easier to debug if you've got it locally. :wink:

Here it is: user-obj_vemork_12bot.pk3

Posted: Tue Jul 01, 2003 6:08 pm
by jv_map
I'll take a look :)

I'm really curious now ;)

Posted: Wed Jul 02, 2003 10:59 am
by jv_map
Yay I found out what was wrong :). It turned out to be a bug in the action_go_to_routed thread (:oops:), which ended too soon and made the bot think he was at his destination.

Here I'll try to explain in a bit more detail. This is the basic route move code (simplified):

Code: Select all

while(isAlive self && self.task == local.task && local.nearestid > 0)
{
	local.nearestid = self waitthread getnearestid local.route
	local.id = local.nearestid - 1
	local.node = level.route[local.route][local.id]

	self thread action_go_to local.node 128 1

	local.move_thread = parm.previousthread
	local.newnearestid = local.nearestid

	while(local.move_thread && local.newnearestid == local.nearestid)
	{
		waitframe
		if(isAlive self)
			local.newnearestid = self waitthread getnearestid local.route
		else 
			break
	}
	if(local.move_thread)
		local.move_thread.terminate = 1 // terminates the move thread
}
Basically the script finds the route node nearest to the bot and makes the bot go to the route node with id -1, so if node #5 is nearest the bot goes to node #4.

Now with bots v1.1 I introduced a new feature: the bot checks for route nodes all the time, to see if he can shorten his route (this turned out to be more or less necessary for the lakeside map). When he notices a nearer route node, he will go to that one and abort his current move. Now the problem is, when he aborts his move the bot script assumes he has reached his destination. This is not a problem under most circumstances (that's why it wasn't noticed before ;)), but if the bot is going to the last node this assumption can make him exit the while loop too early. Thus the task_trigger.scr thinks the bot has completed his move and triggers the documents trigger.

This little error however has now been fixed effectively by only allowing bots to skip nodes if these nodes have a lower id than the current id. Since the destination has an id of 0 this will prevent the appearance (:?) of 'ghost' bots :)

After all all I had to do was change this line

while(local.move_thread && local.newnearestid == local.nearestid)

into

while(local.move_thread && local.newnearestid >= local.nearestid)

but try to think of it :P

I'll give you a download link shortly, just have to think of the best way to distribute this minor update.

Oh sorry about the length of this post. It was not my intention to bore you ;)