playMaker

Author Topic: Playmaker variable send to scripts variable?  (Read 1581 times)

LightSoftStudio

  • Guest
Playmaker variable send to scripts variable?
« on: March 27, 2013, 10:04:55 AM »
How can i charge a variable in a script from a playmaker variable? so when i change a playmaker variable "int" which is a integer. i want that value to be sent to the scripts value "yieldTimeMin". thanks for any help.
#pragma strict
 
var spawnPoints : Transform[];  // Array of spawn points to be used.
var enemyPrefabs : GameObject[]; // Array of different Enemies that are used.
var amountEnemies = 20;  // Total number of enemies to spawn.
var yieldTimeMin = theFsm.FsmVariables.GetFsmInt("Int").Value;
var yieldTimeMax = 5;  // Don't exceed this amount of time between spawning enemies randomly.
var i : int;
public var theFsm : PlayMakerFSM;
 
function Spawnblock()
{
    for (i=0; i<amountEnemies; i++)
    {
      yield WaitForSeconds(Random.Range(yieldTimeMin, yieldTimeMax));  // How long to wait before another enemy is instantiated.
 
      var obj : GameObject = enemyPrefabs[Random.Range(0, enemyPrefabs.length)]; // Randomize the different enemies to instantiate.
      var pos: Transform = spawnPoints[Random.Range(0, spawnPoints.length)];  // Randomize the spawnPoints to instantiate enemy at next.
 
      Instantiate(obj, pos.position, pos.rotation);
}}

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Playmaker variable send to scripts variable?
« Reply #1 on: March 28, 2013, 01:19:21 AM »
Hi,

 from playmaker to scripts, you can use the "Set property" action, and make sure that the property is PUBLIC, else it will not be accessible.

bye,

 Jean