Random location for objectives ???

Post your scripting questions / solutions here

Moderator: Moderators

Post Reply
User avatar
mcunha98
Lieutenant Colonel
Posts: 384
Joined: Sat Jan 17, 2004 1:52 am
Location: Brasil
Contact:

Random location for objectives ???

Post by mcunha98 »

I search in internet but dont find nothing (tutorial) about this question.
If i make a map with two objectives, how i change the position/location of objectives (like The Hunt stock map) ???? :oops:
User avatar
tltrude
Chuck Norris
Posts: 4774
Joined: Sun Jul 07, 2002 4:03 am
Location: Oklahoma, USA
Contact:

Hunt

Post by tltrude »

You must study "The Hunt" script (obj_team1.scr). Look for this line------->

$flak88_weapon1_trigger thread flak88_random_setup $flak88_weapon1_explosive $flak88_weapon1 $flak88_target1 $flak88_base1 4

and this thread------->

flak88_random_setup local.explosive local.weapon local.point_at local.base local.number_of_locations:


The first line sends targetnames, and a number, to the thread. The thread assigns local variable names to each of them.

For a second objective, you would need to repeat the first line with different targetnames. It would seem to be simple, but in reality it is more complex because you don't want both objectives to appear in the same random location.

Hope that helps a little.
Tom Trude,

Image
User avatar
mcunha98
Lieutenant Colonel
Posts: 384
Joined: Sat Jan 17, 2004 1:52 am
Location: Brasil
Contact:

Re: Hunt

Post by mcunha98 »

tltrude wrote:You must study "The Hunt" script (obj_team1.scr). Look for this line------->

$flak88_weapon1_trigger thread flak88_random_setup $flak88_weapon1_explosive $flak88_weapon1 $flak88_target1 $flak88_base1 4

and this thread------->

flak88_random_setup local.explosive local.weapon local.point_at local.base local.number_of_locations:


The first line sends targetnames, and a number, to the thread. The thread assigns local variable names to each of them.

For a second objective, you would need to repeat the first line with different targetnames. It would seem to be simple, but in reality it is more complex because you don't want both objectives to appear in the same random location.

Hope that helps a little.
Tom,

Ok, i understand.
My question is: i need put triggers or another object to send the object, or simply pass the x y z coordinates of new position ?
User avatar
tltrude
Chuck Norris
Posts: 4774
Joined: Sun Jul 07, 2002 4:03 am
Location: Oklahoma, USA
Contact:

location

Post by tltrude »

Yes, there would need to be another set of entities in the map.

I have never done a random objective map, much less one for two objectives. But, this line is how it picks one of four locations for the flakk cannon in The Hunt.

local.location = ((randomint (local.number_of_locations)) + 1)

The locations are probable script_origins in the map that have targetnames like these.

$flak88_location1
$flak88_location2
$flak88_location3
$flak88_location4

So, I guess you could spawn more locations using coordinates. But if you are making the map in radient, you can just add more script_origin entities. Or, you can add an "if" line in the setup thread to check if the location is already being used by the first objective. And if it is, the setup thread would run again--until it picks one that is not being used.
Tom Trude,

Image
User avatar
mcunha98
Lieutenant Colonel
Posts: 384
Joined: Sat Jan 17, 2004 1:52 am
Location: Brasil
Contact:

Post by mcunha98 »

Ok Ok
Script Origins right ?
Well, i try using this method and return in this post with results and comments... :roll:
User avatar
tltrude
Chuck Norris
Posts: 4774
Joined: Sun Jul 07, 2002 4:03 am
Location: Oklahoma, USA
Contact:

trigger

Post by tltrude »

The gun's trigger_use "$flak88_weapon1_trigger " would also have to be added. In the setup thread the trigger is called "self".

Also, the script_origin that is used as an directional target "$flak88_target1"--it makes the gun and base point the right way.

"$flak88_weapon1_explosive" is probably the red flashing bomb model and it is probably a script_model.

There must be an easier way--this gun just has to many parts!!!
Tom Trude,

Image
Post Reply