playMaker

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - djaydino

Pages: 1 ... 4 5 [6] 7
76
Share New Actions / Random Int No Repeat
« on: January 27, 2015, 05:06:20 AM »
hi, i have added a option to random int.

you can choose now if the int result can be the same 2x in a row or not.

you can also find this on the EcoSystem

friendly greetings,

Dino

if there is an interest in a no repeat on random float, let me know.

77
Playmaker Help / random int no repeat[SOLVED]
« on: January 26, 2015, 05:18:46 PM »
hi,
i'm making an action request but having a problem.
i have no errors on my action and with the debug log i get the desired result.

BUT when i play i can see that the "Store Result" is changed to none.
I think i'm just to tired atm to see whats wrong but i thought i drop it here :)

here's my code :

Code: [Select]
// (c) Copyright HutongGames, LLC 2010-2015. All rights reserved.
// 'inclusiveMax' option added by MaDDoX (@brenoazevedo)
// no repeat option added by DjayDino
/*--- __ECO__ __ACTION__ ---*/

using UnityEngine;

namespace HutongGames.PlayMaker.Actions
{
[ActionCategory(ActionCategory.Math)]
[Tooltip("Sets an Integer Variable to a random value between Min/Max.")]
public class RandomIntNoRepeat : FsmStateAction
{
[RequiredField]
public FsmInt min;
[RequiredField]
public FsmInt max;
[RequiredField]
[UIHint(UIHint.Variable)]
public FsmInt storeResult;
        [Tooltip("Should the Max value be included in the possible results?")]
        public bool inclusiveMax;
public FsmBool noRepeat;

private int randomIndex;
private int lastIndex = -1;

public override void Reset()
{
min = 0;
max = 100;
storeResult = null;
// make default false to not break old behavior.
    inclusiveMax = false;
noRepeat = false;
}

public override void OnEnter()
{
PickRandom();
            Finish();
}

void PickRandom()
{
if (noRepeat.Value)
{
do
{
randomIndex = (inclusiveMax) ?
Random.Range(min.Value, max.Value + 1) :
Random.Range(min.Value, max.Value);
} while ( randomIndex == lastIndex);

lastIndex = randomIndex;
storeResult = randomIndex;

}else
{
randomIndex = (inclusiveMax) ?
Random.Range(min.Value, max.Value + 1) :
Random.Range(min.Value, max.Value);
storeResult = randomIndex;
}
Debug.Log("" +storeResult);
Debug.Log("" +randomIndex);
}
}
}


friendly greetings,

Dino

78
Share New Actions / Easy Save 2 Add int / float
« on: January 23, 2015, 04:04:47 AM »
hi,
i made 2 new "Easy save 2" Action to add an int / float to a ES2 int / float

 they work the same as the Playerprefs add int / float but then for easy save 2

Warning use Easy save 2 only on key moments

these actions might be added later to the easy save 2 default Actions.
if so probably under a different name and these actions can still be used

these action can also be found on the EcoSystem

79
Share New Actions / PlayerPrefs Add Int / Float
« on: January 20, 2015, 12:55:30 PM »
hi,
i made 2 PlayerPrefs Action to add an int / float to a playerprefs int / float

this combines a : pp Get (int/float) / add (int/float) / pp Set (int/float) into 1 action

Warning use PlayerPrefs only on key moments

don't use this like :
adding score every frame or something,
add score on a variable and add to pp for example : end of a level , when player dies etc.

these action can also be found on the EcoSystem


80
Playmaker Help / new action playerprefs add int / float[SOLVED]
« on: January 19, 2015, 04:09:44 AM »
hi,

i made a new action to add an int / float to a playerprefs int / float

so not to have to set 3 actions to do this (pp get int, int add, pp set int)

but i am trying to get it to work for multiple variables (Count)

when played i get Nullreference on line 26

Code: [Select]
// (c) Copyright HutongGames, LLC 2010-2015. All rights reserved.
using UnityEngine;
namespace HutongGames.PlayMaker.Actions
{
[ActionCategory("PlayerPrefs")]
[Tooltip("Adds a value to a playerprefs int identified by key.")]
public class PlayerPrefsAddInt : FsmStateAction
{
[CompoundArray("Count", "Key", "Variables")]
[Tooltip("Case sensitive key.")]
public FsmString[] keys;
public FsmInt[] add;
private FsmInt[] ppValue;

public override void Reset()
{
keys = new FsmString[1];
ppValue = new FsmInt[1];
add = new FsmInt[1];
}

public override void OnEnter()
{
for(int i = 0; i<keys.Length;i++)
{
if(!keys[i].IsNone || !keys[i].Value.Equals(""))  ppValue[i].Value = PlayerPrefs.GetInt(keys[i].Value, ppValue[i].IsNone ? 0 : ppValue[i].Value);

ppValue[i].Value += add[i].Value;

PlayerPrefs.SetInt(keys[i].Value, ppValue[i].IsNone ? 0 : ppValue[i].Value);
}
Finish();
}

}
}

it has to do with the ppValue...
i don't have much experience with arrays and i guess somethings is wrong in that direction...

here is the code from the working "single add int to playerprefs" DO NOT USE THIS in your project as this will be changed when i got this working on multiple values (count)
Code: [Select]
// (c) Copyright HutongGames, LLC 2010-2015. All rights reserved.
using UnityEngine;
namespace HutongGames.PlayMaker.Actions
{
[ActionCategory("PlayerPrefs")]
[Tooltip("Adds a value to a playerprefs float identified by key.")]
public class PlayerPrefsAddInt : FsmStateAction
{
[Tooltip("Case sensitive key.")]
public FsmString key;
public FsmInt add;
private FsmInt variables;

public override void Reset()
{
key = "";
variables = new FsmInt();
add = null;
}

public override void OnEnter()
{
if(!key.IsNone || !key.Value.Equals("")) 
variables.Value = PlayerPrefs.GetInt(key.Value, variables.IsNone ? 0 : variables.Value);

variables.Value += add.Value;

PlayerPrefs.SetInt(key.Value, variables.IsNone ? 0 : variables.Value);

Finish();
}

}
}

81
Playmaker Help / application focus
« on: December 10, 2014, 09:43:02 PM »
hi, is there a way to Not Broadcast application focus on startup?

i got several "application focus" global transitions, but i do not want them to trigger on startup

Greetings,

Dino

82
Playmaker Help / Led display
« on: December 05, 2014, 08:25:36 PM »
hi,

i am working on a Led Display (using sprites no text), but trying to figure out what the best approach is.

there will be custom text running (player name, and score updating every frame)
and this is running from right to left.

i'm thinking to loop an animation with  empty sprites from right to left and update those sprites every frame with text

or using set postions wait .1 and set next postion instead of animation
and somehow set the text on it.

Here is a sample of the display

Greeting,

Dino

83
Playmaker Help / Light sequence
« on: November 27, 2014, 03:01:58 AM »
hi, i am making a light strip with 20+ lights and i want to let a light run in 50+ different preset sequences (left to right, right to left, stop for a seccond @ light nr4 and so on) giving each light a number 01-20+ so i can set it like this (for example) :
1,2,3,2,3,4,5,wait 0.5,6,5,4,5,6 and so on for a sequence

whats the best way to do this?
i know how to do this with states but that is gonna be a lot of work.

84
Share New Actions / Countdown Timer
« on: November 24, 2014, 12:27:03 AM »
hi, i made a countdown timer action for one of my projects and i will share it here :)
i don't know if it exist already but i could not find 1 so here it is :

Code: [Select]
// (c) Copyright HutongGames, LLC 2010-2013. All rights reserved.
/*--- __ECO__ __ACTION__ ---*/

using UnityEngine;

namespace HutongGames.PlayMaker.Actions
{
[ActionCategory(ActionCategory.Time)]
[Tooltip("Countdown from a certain time to a certain time and possible to display time left")]
public class CountdownTimer  : FsmStateAction
{
[RequiredField]
[Tooltip("Time To Countdown from")]
public FsmFloat time;
[Tooltip("Stop timer when this time is reached. Value must be lower than time")]
public FsmFloat stopOn;
public FsmEvent finishEvent;
public bool realTime;
public FsmFloat storeValue;

private float startTime;
private float timer;

public override void Reset()
{
time = 1f;
stopOn = 0f;
finishEvent = null;
realTime = false;
storeValue = null;
}

public override void OnEnter()
{
if (time.Value <= stopOn.Value)
{
Fsm.Event(finishEvent);
Finish();
return;
}

startTime = FsmTime.RealtimeSinceStartup;
timer = 0f;
}

public override void OnUpdate()
{
if (realTime)
{
timer = FsmTime.RealtimeSinceStartup - startTime;
storeValue.Value = time.Value - timer;
}
else
{
timer += Time.deltaTime;
storeValue.Value = time.Value - timer;
}

if (storeValue.Value <= stopOn.Value)
{
Finish();
if (finishEvent != null)
{
Fsm.Event(finishEvent);
}
}
}

}
}

you can let it countdown to any value and you can store the time left value to convert it to a string.

and should be ready to be added to the Ecosystem.

greets djaydino

Edit : Countdown Timer is now Available on the Ecosystem.

85
Playmaker Help / Random Weighted int problem [SOLVED]
« on: October 26, 2014, 01:12:48 PM »
hi, i wanted to use the custom Action : Random Weighted int
But it is giving me the result 0,1,2,3,4,5
and not the numbers i placed in them.
i am using (testing) unity 4.6.0.b17

i have set it up like this :

86
Action Requests / iTween value to
« on: October 19, 2014, 04:09:30 PM »
hi,
i would like to have an action for a line in this script i made :

Code: [Select]
using UnityEngine;
using System.Collections;

public class ValueTo : MonoBehaviour {
public int int1 = 0;
public int int2 = 100;
public GUIText scoreDisplay;

void OnMouseDown(){
//go from value 1 to value 2:
//this next line i would like to have a playmaker action for
iTween.ValueTo(gameObject, iTween.Hash("from",int1,"to",int2,"time",6,"onUpdate","UpdateScoreDisplay","easetype","easeOutBounce"));

}

void OnMouseUp(){
}

void UpdateScoreDisplay(int newScore){
scoreDisplay.text = "Score: " + newScore.ToString();
}
}

i tried to make it myself but i'm getting an error you can check it in this topic

this would be very useful for me can can be usefull in many ways :)

87
Playmaker Help / custom itween action error
« on: October 17, 2014, 09:23:01 AM »
hi, i am making my own itween action but i get an error and can't find the solution (yet)

the action needs to change from int "a" to int "b" and store that result each frame.
i dont get errors on the script but when i play i get this error :
Quote
iTween Error: ValueTo() only works with interpolating Vector3s, Vector2s, floats, ints, Rects and Colors!
UnityEngine.Debug:LogError(Object)

this is my script :

Code: [Select]
{
[ActionCategory("iTween")]
[Tooltip("Changing Int value 1 to value 2")]
public class iTweenIntValueTo: iTweenFsmAction
{
[RequiredField]
public FsmOwnerDefault gameObject;

[Tooltip("iTween ID. If set you can use iTween Stop action to stop it by its id.")]
public FsmString id;

[RequiredField]
[Tooltip("IntValue from.")]
public FsmInt Int1;
[Tooltip("IntValue to.")]
public FsmInt Int2;
[Tooltip("IntValue to.")]
public FsmInt newValue;
[Tooltip("The time in seconds the animation will take to complete.")]
[UIHint(UIHint.Variable)]
public FsmInt storeResult;
[Tooltip("The time in seconds the animation will take to complete.")]
public FsmFloat time;
[Tooltip("The time in seconds the animation will wait before beginning.")]
public FsmFloat delay;
[Tooltip("Can be used instead of time to allow animation based on speed. When you define speed the time variable is ignored.")]
public FsmFloat speed;
[Tooltip("The shape of the easing curve applied to the animation.")]
public iTween.EaseType easeType = iTween.EaseType.linear;


public override void Reset()
{
base.Reset();
id = new FsmString{UseVariable = true};
time = 1f;
delay = 0f;
Int1 = new FsmInt { UseVariable = true };
Int2 = new FsmInt { UseVariable = true };
storeResult = new FsmInt { UseVariable = true };
speed = new FsmFloat { UseVariable = true };
}

public override void OnEnter()
{
base.OnEnteriTween(gameObject);
// if(loopType != iTween.LoopType.none) base.IsLoop(true);
DoiTween();
}

public override void OnExit(){
base.OnExitiTween(gameObject);
}


public void DoiTween()
{
GameObject go = Fsm.GetOwnerDefaultTarget(gameObject);
if (go == null) return;
// init position
itweenType = "value";
iTween.ValueTo(go, iTween.Hash(
"from", Int1.Value,
"to", Int2.Value,
"name", id.IsNone ? "" : id.Value,
speed.IsNone ? "time" : "speed", speed.IsNone ? time.IsNone ? 1f : time.Value : speed.Value,
"delay", delay.IsNone ? 0f : delay.Value,
"easetype", easeType,
"onupdate", "tweenOnUpdateCallBack",
"onupdatetarget", go,
"oncompletetarget", go,
"oncomplete", "iTweenOnComplete",
"oncompleteparams", itweenID,
"onstart", "iTweenOnStart",
"onstartparams", itweenID,
"ignoretimescale", realTime.IsNone ? false : realTime.Value
));
}

public void tweenOnUpdateCallBack()
{
// storeResult.Value = 50;
Debug.Log ("test");
storeResult.Value = newValue.Value;
}
}

}

i am not a scripting expert and copy paste most of it :)
does anyone have an idea why i get the error?

edit : removed looptype because it can not be used in valueto.
but problems is still there.

edit 2 : added .Value  int1 and others
error is gone but not getting result

edit 3 : added public but did not change anything

88
Playmaker Help / random weight
« on: October 02, 2014, 05:52:41 AM »
hi,

i like to know more about how the random weight works

for example i have 2 random events, both set to 1.0, this is a 50/50% right?

but when it is set to 0.9 and 0.1 is it  90% / 10% then?

when i have 3 items. set like this 1.0 / 0.8 / 0.8 how does the chance % work then?

basically i would like to know how this calculates.

89
Playmaker Bug Reporting / 3th party section
« on: September 23, 2014, 08:39:02 AM »
it would be nice to have a 3th party section where supported assets can make sub sections for actions, bug report, Q&A, Suggestions.

for example : "3th party Assets" when clicked you see a list of the 3th party Assets.
 then click (For example) "Android Native"
then you see the sub section for Actions, Bug Report, etc.
then in those sub sections are the posts

this makes it easier to navigate and search for 3th party actions and to report bugs, request actions.

and easier for the 3th parties also to know what people want, get help on making Actions and bug fixing.


i checked simple machines and it should be possible to do so (Child Boardds)

greetings Kurt

ps. jeanfabre asked to write a bug report on this i guess to place this into this section.

90
Android Help / Touch Object Event Stationary delay
« on: September 10, 2014, 04:01:28 PM »
at the moment i think the Touch Object Event works every frame yes? (correct me if i'm wrong)  ;)

but i want to add a delay in it so that when i stop moving an Object for less than (for example) .3 sec it will not go yet to the event : Touch Stationary
Only when when i stopped moving longer than .3 sec

and maybe a way to adjust the sensitivity would be very nice also

Pages: 1 ... 4 5 [6] 7