Jump to content
Sign in to follow this  
WallyJas

'Fudge factor' when spawning task markers

Recommended Posts

I have my first task setup via a trigger

(tsk1 setSimpleTaskDestination (Position Jeep);)

but am hoping that instead of the task marker being spot on top of the task it can be randomly placed within say 100m of the task marker, like give it a 'fudge factor'. Is this possible?

Share this post


Link to post
Share on other sites

http://community.bistudio.com/wiki/random

you can use random or round to get it to spawn in a random position away from the actual marker.

(tsk1 setSimpleTaskDestination (Position Jeep random 100);)

i dont know if my example there would work but something along those lines, if not then you can try

tsk1 setSimpleTaskDestination (getMarkerPos "obj1" random 100);

youll have to play around with the syntax since i havnt used this command in getting random position drawings on the map, so i dont know how to properly use it.

hope that helps

Share this post


Link to post
Share on other sites

You could try;

(tsk1 setSimpleTaskDestination ((Getpos Jeep select 0) + random 100 - random 100,(getpos Jeep select 1) + random 100 - random 100,0);

I think that'd work - not sure if the 'destination' of a task accepts three axes like that.

Share this post


Link to post
Share on other sites

Thanks guys, hey Dread in the editor it's asking for one more ) any idea where I need to put it?

Share this post


Link to post
Share on other sites

Oh crap. I deleted one at the end because I thought I added one too many - turns out I was right the first time! My apologies!

(tsk1 setSimpleTaskDestination ((Getpos Jeep select 0) + random 100 - random 100,(getpos Jeep select 1) + random 100 - random 100,0));

Just to show you the sets of brackets:

(tsk1 setSimpleTaskDestination ((Getpos Jeep select 0) + random 100 - random 100,(getpos Jeep select 1) + random 100 - random 100,0));

Share this post


Link to post
Share on other sites

That's what I had thought (after the editor told me off) and I tried adding the extras you have suggested.

This time I copied exactly what you have and unfortunately it still does not like it, being fussy alright.

Any suggestions on what I can do mate?

Share this post


Link to post
Share on other sites

Apologies once again! I was so busy worrying about whether the setdest would take three axes, I forgot some basic structure rules. The xyz of a location is written in an array, like [X,Y,Z]. The fact that I used the parenthesis instead of these square brackets is what confused the engine, and understandably, too!

Here is the actual code, that I tested this time - I should've tested before posting, earlier. Enjoy!

(tsk1 setSimpleTaskDestination [(Getpos Player select 0) + random 100 - random 100,(getpos Player select 1) + random 100 - random 100,0]);

Share this post


Link to post
Share on other sites

It's not up to you to test it mate, but I really do appreciate it.

Thanks for this Dread it works a treat ;)

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×