Page 1 of 2

all doods to yer own targets

Posted: Mon Jan 05, 2004 3:06 am
by small_sumo
Ok so like I give several doods the same targetname but each one of them has his own target node. Can I command them all to go to they individual targets? With one line eg.....

$doods runto local node

Somthing like that.

Posted: Mon Jan 05, 2004 7:37 am
by jv_map
How does a dood 'know' which targetnode is his? If you store that targetnode in $doods.targetnode, you could do:

Code: Select all

for(local.i = 1; local.i <= $doods.size; local.i++)
{
  $doods[local.i] runto $doods[local.i].targetnode
}
Possibly your code would work too, but I would recommend against it since it doesn't lead to a better understanding of targetname arrays.

Posted: Mon Jan 05, 2004 9:07 am
by small_sumo
Another way is to activate the ai and have them as runners and a patrol route, they will run to thyere own specified routes. what I had in mind was useing the cntrl+k meathod with the ai's but all the ais have the same targetname.........
Hmmm much to lern 4 me. :roll:

group1

Posted: Mon Jan 05, 2004 10:58 am
by tltrude
Can't you give them #group and #set numbers? It's been a while for me, but I remember something about using those for patrol members.

Posted: Mon Jan 05, 2004 11:50 am
by vonderbakluft
Easiest is to give them all a extra custom k/v (in the map)

#targetnode/<some node>

And then you can run the script of jv_map.

Von

Posted: Mon Jan 05, 2004 12:17 pm
by small_sumo
Ah crap now I have to think, hehe thanks guys.

:roll:

Posted: Mon Jan 05, 2004 1:31 pm
by mohaa_rox
how about:

$dood runto $dood.target

???

Posted: Mon Jan 05, 2004 1:32 pm
by mohaa_rox
how about:

$dood runto $dood.target

???

Posted: Mon Jan 05, 2004 3:00 pm
by jv_map
mohaa_rox wrote:how about:

$dood runto $dood.target

???
I think it will result in a cannot cast array to listener error.

Posted: Tue Jan 06, 2004 12:43 am
by nuggets
have on the pathnode
key: targetname
value: pathnode
key: #dood_number
value: 1
then value: 2, etc...
key: #node_number
value: 1
(number 1 as his 1st destination, then 2 accordingly)

then on the ai have
key: targetname
value: doods
key: pathnode_group
value: 1
and 2, 3 etc... again as needed

player_start:
for (local.i=1;local.i<=$doods.size;local.i++)
{
$doods thread run_run_run
}
end

run_run_run:
self.destinations = 0
for (local.i=1;local.i<=$pathnode.size;local.i++)
{
if ($pathnode[local.i].dood_number == self.pathnode_group)
{
self.destination[local.i] = $pathnode[local.i].node_number
self.destinations++
}
}
for (local.i=1;local.i<=self.destinations;local.i++)
{
self runto self.destination[local.i]
self waittill movedone
}
end

should work for many ai wih many paths...
A->A1->A2->A3
B->B1->B2,
you may need to put in
if !(isalive self)
{
end
}

Posted: Tue Jan 06, 2004 12:59 am
by small_sumo
Would nuggets be right, what he says sounds pretty good, you could have ai zigging and zagging all over the place, whats more it wouldnt be too hard to set up but I would liek to see a demo map tho.

Thanks all.

Posted: Tue Jan 06, 2004 1:02 am
by nuggets
lol, sorry don't do test_maps, just throw a couple of ai and path_nodes in a room, 4 path_nodes should be enough

Posted: Tue Jan 06, 2004 8:03 am
by jv_map
Sadly nuggets is not right :( (the code is almost good though)

As he posted it the AIs would try to run to an integer :? which obviously wouldn't work.

self.destination[local.i] = $pathnode[local.i].node_number

(...)

self runto self.destination[local.i]

In fact, this line:

self.destination[local.i] = $pathnode[local.i].node_number

should be changed to:

self.destination[($pathnode[local.i].node_number)] = $pathnode[local.i]

Make sure not to skip #node_number values though (i.e. don't go from #3 to #5).

Posted: Wed Jan 07, 2004 12:53 am
by small_sumo
Well sorry to be the boy who cried wolf but I think I will go for the more labor intensive but simpler route of telling each dood what he should do instead of making arrays. You explaned it quite well but it would take me quite a while to do it because I will surely get it wrong along the way.

Btw I am making a copy paste kind of tutorial (color coded nodes and all) for doing bots in a map, should come out soon after gen cobras stalingrad with bots.

Posted: Thu Jan 08, 2004 3:49 am
by nuggets
what??? WHAT!?!?!?

do you know how long i was thinking that up for, just to be turned down at the last hurdle??? :P

nevermind though, i might try it myself at a later date,

thanks for the clear up JV