Home   Help Search Login Register  

Author Topic: Dynamic Creation of Names  (Read 1587 times)

0 Members and 1 Guest are viewing this topic.

Offline OzDeaDMeaT

  • Members
  • *
Dynamic Creation of Names
« on: 07 Dec 2010, 20:33:26 »
Hi again,

I am wondering if its possible to create dynamic variable names.

E.G. Position_1 is the name of a game logic in game. I want to be able to dynamically create a marker called Position_1_Marker.

Is there a way to get the entity name and add another string to it to make another variable name and then use that name to create the marker?

I would like to do similar things with ammo boxes, flag poles.

The goal is to have a script create an entire capture and hold position including markers, ammo boxes, flags, triggers, everything.

Offline Spyder001

  • Members
  • *
Re: Dynamic Creation of Names
« Reply #1 on: 03 Jan 2011, 10:21:02 »
Here is a short answer because I'm not sure how you are executing all this and what the entire scope of what you are trying to do is.

Code: [Select]
// This goes in the gamelogic you have
// _null = [this, 'Position_1'] execVM "logic_marker.sqf";

// this select 0 is this, this select 1 is the object name you define
_object = this select 0;
_objectName = this select 1;

// The name format you want to use, based on what the object name is
_markerName = format ["%1_Marker", _objectName];

// Creates the marker at the position of the gamelogic with the dynamic name
_marker = createMarkerLocal [_markerName, getPos _object];
// rest of marker stuff ...
« Last Edit: 03 Jan 2011, 10:23:16 by Spyder001 »