all doods to yer own targets

Post your scripting questions / solutions here

Moderator: Moderators

User avatar
small_sumo
Lieutenant General
Posts: 953
Joined: Mon Jul 01, 2002 4:17 pm
Contact:

all doods to yer own targets

Post 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.
Image

www.smallsumo.tk

Yeah Truth above Honor Man ;)
jv_map
Site Admin
Posts: 6521
Joined: Tue Sep 03, 2002 2:53 pm
Location: The Netherlands
Contact:

Post 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.
Image
User avatar
small_sumo
Lieutenant General
Posts: 953
Joined: Mon Jul 01, 2002 4:17 pm
Contact:

Post 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:
Image

www.smallsumo.tk

Yeah Truth above Honor Man ;)
User avatar
tltrude
Chuck Norris
Posts: 4774
Joined: Sun Jul 07, 2002 4:03 am
Location: Oklahoma, USA
Contact:

group1

Post 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.
Tom Trude,

Image
vonderbakluft
Corporal
Posts: 46
Joined: Fri Aug 01, 2003 11:15 am
Location: NL
Contact:

Post 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
Real mappers map in wordpad ;-)
User avatar
small_sumo
Lieutenant General
Posts: 953
Joined: Mon Jul 01, 2002 4:17 pm
Contact:

Post by small_sumo »

Ah crap now I have to think, hehe thanks guys.

:roll:
Image

www.smallsumo.tk

Yeah Truth above Honor Man ;)
User avatar
mohaa_rox
Field Marshal
Posts: 2760
Joined: Mon Nov 11, 2002 7:05 am
Contact:

Post by mohaa_rox »

how about:

$dood runto $dood.target

???
Live to map, not map to live.
-mohaa_rox, .map
moderator
User avatar
mohaa_rox
Field Marshal
Posts: 2760
Joined: Mon Nov 11, 2002 7:05 am
Contact:

Post by mohaa_rox »

how about:

$dood runto $dood.target

???
Live to map, not map to live.
-mohaa_rox, .map
moderator
jv_map
Site Admin
Posts: 6521
Joined: Tue Sep 03, 2002 2:53 pm
Location: The Netherlands
Contact:

Post 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.
Image
nuggets
General
Posts: 1006
Joined: Fri Feb 28, 2003 2:57 am
Location: U-england-K (england in the UK) :P
Contact:

Post 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
}
hope this helps, prob not cos it's all foreign 2 me :-/
User avatar
small_sumo
Lieutenant General
Posts: 953
Joined: Mon Jul 01, 2002 4:17 pm
Contact:

Post 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.
Image

www.smallsumo.tk

Yeah Truth above Honor Man ;)
nuggets
General
Posts: 1006
Joined: Fri Feb 28, 2003 2:57 am
Location: U-england-K (england in the UK) :P
Contact:

Post 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
hope this helps, prob not cos it's all foreign 2 me :-/
jv_map
Site Admin
Posts: 6521
Joined: Tue Sep 03, 2002 2:53 pm
Location: The Netherlands
Contact:

Post 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).
Image
User avatar
small_sumo
Lieutenant General
Posts: 953
Joined: Mon Jul 01, 2002 4:17 pm
Contact:

Post 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.
Image

www.smallsumo.tk

Yeah Truth above Honor Man ;)
nuggets
General
Posts: 1006
Joined: Fri Feb 28, 2003 2:57 am
Location: U-england-K (england in the UK) :P
Contact:

Post 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
hope this helps, prob not cos it's all foreign 2 me :-/
Post Reply