Jump to content
Sign in to follow this  
Stubbinz

Random Marker Locations?

Recommended Posts

Hello, first i must say that i have been reading these forums for a long time, but for the life of me i can't find what im looking for.

Basically, I have an NPC where you can accept missions from.

These missions are randomly generated on map, with markers linking to them.

I however am new to scripting and still learning, but i can't even get one to spawn randomly.

I'm trying to randomly spawn an NPC anywhere on the map, with a marker patched onto it (Like Destroy).

I'm supposed to go out and kill the NPC and gain the reward.

Any help to a newb scripter would be much appreciated, also, if you feel like im lacking any info, let me know and i'll post what i can.

Share this post


Link to post
Share on other sites

Sorry to sound stupid here, but what exactly are you trying to do? It's a little difficult to determine. Something isn't spawning randomly, or a marker isn't attaching, or something else?

- HateDread.

Share this post


Link to post
Share on other sites

I'm not sure what your problem is, my guess is, it is with the marker.

Instead of using markers what about the built in task system. (Map->Tasks).

Assuming you named the NPC the_officer something like this:

private ["_p","_currentTask","_newTask"];
//Must have player
_p = player;
if (isNull _p) exitWith {};

//Delete old task if exists
_currentTask = _p getVariable "CurrentTask";
if (!isNil "_currentTask") then {
   _p removeSimpleTask _currentTask;
   _p setVariable ["CurrentTask", nil];
};

//The new task
_newTask = _p createSimpleTask ["Eliminate"];
player setVariable ["CurrentTask", _newTask];
_newTask setSimpleTaskDescription ["Eliminate the enemy officer. Good luck", "Eliminate Officer", "Officer"];
_newTask setSimpleTaskDestination (getPos the_officer);
_newTask setTaskState "Assigned";
//Show on screen
taskHint ["Assigned: Eliminate enemy officer", [1, 0, 0, 1], "taskCurrent"];
//Maybe a sound?
playSound "IncomingChallenge";

Edited by Muzzleflash

Share this post


Link to post
Share on other sites
Sorry to sound stupid here, but what exactly are you trying to do? It's a little difficult to determine. Something isn't spawning randomly, or a marker isn't attaching, or something else?

- HateDread.

Okay, i have an NPC that when the player gets close enough, he gets the action to "Accept a Mission."

Upon accepting a mission using the action menu, another unit gets randomly spawned somewhere on the map with the name "Target01".

"Target01" should also have a destroy marker attached to it as the unit is randomly patrolling the surrounding area that it spawned at.

The player then is supposed to go out an destroy "target01" and receive a reward of some cash upon doing so.

I already have the cash mechanics working, i just need to know how to spawn units randomly placed on the map with markers attached to them, i can't seem to figure that part out.

Thanks again.

Share this post


Link to post
Share on other sites

I would suggest to deBPO "Takistan Force" cos it delivers a very well made framework for randomized missions. Sounds like what youre looking for. The missionmanager.sqf in scripts\missions and the mission-files below that have the code you need.

Share this post


Link to post
Share on other sites
I would suggest to deBPO "Takistan Force" cos it delivers a very well made framework for randomized missions. Sounds like what youre looking for. The missionmanager.sqf in scripts\missions and the mission-files below that have the code you need.

Too bad im a newb and can't understand this ha.

Which is why i was seeking help on the matter.

I don't even know where to start.

Guess first would be to know how to spawn a marker randomly on the map, how do you get the random location?

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  

×