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 - krmko

Pages: 1 2 [3] 4
31
Playmaker Help / Restarting a FSM from another object [SOLVED]
« on: February 19, 2017, 04:19:16 PM »
Hi guys, this is some simple stuff, but i'm not sure what should i use. I have a weapon object which detects whether is it equipped on ship or a pickup drifting in space and based on that the state machine branches further. However, when it is replaced by another weapon, it needs to get back to start state so it can do the weapon/pickup check again.

I can't use reset on exit since i will be activating it from another object. I tried sending an event but it didn't work out, i don't know if i'm doing it right.





The event is global of course.

I tried some debugging, but obviously event has not been received.



Any ideas?

32
Playmaker Help / Simple problem to be solved with Arraymaker
« on: February 07, 2017, 01:26:11 PM »
Hello,

I must admit that i've been running away from arrays for some time, but there comes a time when you simply can't do your thing without them. It came for me and i need your help to finally overcome one of the last obstacles in, well, some basic Playmaker functions (after that it's time for enums ;D).

As i said, it is simple but includes using arrays (i have been using them for some VERY basic stuff, nothing more).

Here's a simplified example:

- There are three weapons in the game, let's call them Sword, Axe and Spear.

- Every weapon has three upgrade levels which are basically separate objects. So we have Sword1, Sword2, Sword3, Axe1, Axe2, Axe3, Spear1, Spear2, Spear3.

- Player can only hold two weapons, and use one weapon at a time (let's call it currently active weapon).

- When player holds Sword and Axe and pickups Spear, currently used weapon is replaced by Spear.

- When player holds Sword1 and Axe1 and pickups Sword1, Sword1 is upgraded to Sword2.

How i think it should be done:

I have weapon objects themselves. They spawn on the player and do their thing (fire, deal damage...).

I have pickup objects which are basically empty objects with sprite renderer and collider.


Case 1:

Player is equipped with Axe1 and Sword1, they are added to the Weapons Equipped array - that's simple and i know how to do it.

Player stops on Sword1 pickup and clicks the button to pick it up.

Weapons Equipped array is be checked if it contains Sword1, Sword2 or Sword3. If it contains any of those three, Sword1 weapon object will be destroyed, removed from Weapons Equipped array, Sword2 weapon object will be created on player and added to Weapons Equipped array.

Pickup object will be destroyed.

Case 2:

Player is equipped with Axe1 and Sword1, they are added to the Weapons Equipped array.

Player stops on Spear1 pickup and clicks the button to pick it up.

Array is checked if it contains Spear1, Spear2 or Spear3. There are no such objects in the array, so the currently active weapon object (Sword1 or Axe1) is removed from array and destroyed. Spear1 weapon object will be created on player and added to Weapons Equipped array.

Pickup object will be destroyed.

I tried using the Arraymaker, and i suppose i should use Array Get Next to loop through all the array items, but i don't know how to use it. Ok, i can set it to loop through all of them, and then what? How do i compare the pickup object with all the array items? What does the result represent?

Ok, so there's Array Contains action, but the only way i can think of using it is like this:

- I pick up Sword1 pickup object
- I run Array Contains action and check if the array contains Sword1. If it doesn't the next state which checks is the array contains Sword2 is called, and so on.

Of course, the game is a bit more complicated than the example so it would take a few more events (which means more frames) to check for all weapon objects so i think this is not the right approach and can be done a lot simpler. I watched the Arraymaker GetNext tutorial by RezRezRez, but i don't quite get it, i'm more of a reading than watching guy.






33
Playmaker Help / Line Renderer Glitch
« on: February 06, 2017, 11:31:36 AM »
Hello guys,

it took me some time to make a functioning line renderer continuous laser beam in a 2D sidescrolling game, but there it is. Unfortunately, a glitch occurs.

Here's how it's setup:



First step is getting the original line renderer X position for later reference.



Standby state, waiting for player to fire the laser beam.



Raycasting with line cast. Hit location is stored to be used for positioning end object for line renderer. Bool test is used to determine if object is hit or not.



Nothing hit, line renders from ship to original end point, everything fine.



We hit something! Magic happens, hit location is converted from vector2 to vector3, line renderer end point is set to hit location, line is drawn, then to loop gets back to raycasting again.

Everything works fine, but two bad things happen.

As you can see, the first thing is that the laser sometimes gets through the object.



Second thing is this:



I separated line casting and the draw line events in different states so the line wouldn't be drawn until the hit position is taken and line renderer end object set on hit position, but it occurs if the first shot did not hit anything. Do you think that i should perhaps put setting the position of line renderer end object in a separate state before firing or maybe use a raycast? Set Position in a different state would cause one frame of lag tho.

Please help, i'm going out of my mind >:(

34
Playmaker Help / Detaching children on collision [SOLVED]
« on: January 28, 2017, 07:11:29 AM »
Hi,

i'm using Core Gamekit together with playmaker for my game. I made some missiles that have a child particle system for trail generation from a spritesheet. As you know, when the particle system object is destroyed, particles don't finish their lifetime and die, but die instantly. That poses a problem since when the missile hits the target and explodes all the particles disappear at the same moment too.

I tried putting the particle system on a child prefab and detaching it upon impact, but it seems that the despawn of the missile and the detachment happen in the same update period, so it doesn't work properly. Any elegant ideas on how to solve this, i.e. make the particle system object detach properly? Listening to the missile hp doesn't work, and getting the distance is also useless since missile hits the collider which is way off from the object center.

35
Playmaker Help / 2 questions regarding facing direction in 2D [SOLVED]
« on: January 10, 2017, 05:06:19 AM »
1. I've got some paths that i'm using in Simple Waypoint System in 2D, and this is what i'm basically trying to do.



Ship in the upper part of the waypoint moves as set in transform, but i want it to flip sprite or change it's Y rotation when it starts moving right, like the one down. It uses Catmull Rom without locked positions, so it always faces forward. Changing the transform or flipping a sprite is not a problem, but i don't know what parameter should i listen as a condition.

I'm pretty bad with quaternions, vectors and other rotation related stuff, so i'd really appreciate some help, i'm sure it's simple :)

2. I've got a type of enemy that measures distance from the player, once it is in range, it gets player position in that moment (let's name it PlayerPosition), and speeds up towards PlayerPosition with Move Towards. However, i don't want the enemy to stop when it reaches PlayerLocation, i want him to continue moving until it gets off screen. That's the first part of the problem, how to get the direction of movement and continue moving along it. The second is that i want the enemy to rotate towards the PlayerPosition.

As i said, i'm not really proficient with rotations, i've been checking out unity forums, and i see that some of the solutions include quaternion lerping/slerping, but i'm not sure how it is used. I tried using vector3 rotate towards, but to no avail.



36
Playmaker Help / Translate Movement unexpected behaviour [SOLVED]
« on: January 08, 2017, 08:56:14 AM »
Hello,

i'm using a quite simple FSM for translating the object depending on its position. I get the objects position, and i compare it to float values, which are thresholds that determine the movement direction.



As you can see, there are four possible outcomes:

1. If the object is instantiated on the upper portion of the screen, it translates down
2. If the object is instantiated on the lower portion of the screen, it translates up
3. If the object is instantiated on the left portion of the screen, it translates right
4. If the object is instantiated on the right portion of the screen, it translates left

3 and 4 work great, but when it instantiates up or down, the Y axis movement is ok, but it also applies the same amount of translation to the negative X axis, so the object move down/left when it is instantiated in the upper part of the screen, and up/left when it's instantiated in the lower part of the screen.

Any ideas what's going on? No translation is being set until the final states.

37
Playmaker Help / Get Position / Set Position problem
« on: January 03, 2017, 02:35:55 AM »
Hi guys,

i have a small spawner which is supposed to spawn gameobjects in a a pattern (spaceships spawning in arrow formation). Spawner is an empty object with an FSM which contains one state and the following actions:

Get Position - Getting the position in World space and storing it as Vector3 variable Spawner Position.



Spawning a GameObject - I'm using Core GameKit for spawning. Spawn Position Mode is set to Use This Object Position to Spawn on the place of the Spawner, and i store the Spawned Game Object as GameObject variable.



Set Position of a GameObject - For the GameObject whose position i want to set i choose stored GameObject variable, select Spawner Position for the Vector3, and adjust X, Y and Z position relative to Self Space.



But, the object sets it position relative to world space and it appears near the world center.

Any ideas what i'm doing wrong? I had a similar setup with with two different objects (Spaceship and a GunPoint spawning on a defined space on the spaceship) and things worked fine. Spaceship had the Get Position on itself, and it stored the position in vector3 variable in world space. The GunPoint had Set Position, used the Spaceship vector3, and Space set to Self and it worked, i don't know what's different here.

38
Action Requests / Check for visible objects with TAG[SOLVED]
« on: December 30, 2016, 02:37:02 AM »
Hi guys,

is is possible to make an action that would check if any objects with TAG are visible or not and then move to the following action if TRUE or no if FALSE?

I am using Core GameKit and i want to fire custom events based on the info is any enemies are visible on the screen or not.

39
Hi guys, this is kinda like two questions in one.

ProCamera2D actions can't be seen in Playmaker anymore, and any FSM that has them now reports that there is a missing action. I tried the famous reimport all button that never helps anything, so neither did it now. Yes, scripting define symbols are all set in the build settings.

I tried deleting Playmaker and importing it again, but after i restart Unity my hierarchy view messes up.



I tried doing it twice, and it messed up the view both times. I have a backup, so maybe some advice on how to fix the ProCamera2D actions issue or the reimport issue?

Making a new project is not quite the solution, i don't know how to transfer everything. I'm using latest Playmaker version and Unity 5.3.5f

40
Playmaker Bug Reporting / Playmaker Shuriken Proxy not working
« on: December 22, 2016, 05:30:30 AM »
Hi Jean,

i tried installing the Shuriken package from https://hutonggames.fogbugz.com/default.asp?W1141 but unfortunately id doesn't let me add the playMakerShurikenProxy script to any object. I get the error message:

Can't add script component 'playMakerShurikenProxy' because the script class cannot be found. Make sure that there are no compile error and that the file name and class name match.

Any ideas?

Edit: Oh yes, Unit 5.3.5f, Playmaker 1.8.1.f10

41
General Discussion / Recommend a simple 2D UI asset
« on: November 24, 2016, 08:04:35 AM »
Hi guys,

i've been making a game for almost a year now, and been learning unity for more than a year. I'm not really skilled but i have some basic programming skills and things are going slow but fine.

One thing remains pretty horrible for me. It's the dreaded user interface, i'm really having trouble with canvases, scalers, rect tranforms and all the clunky mechanics the unity implements and that are over the top for my needs.

I tried NGUI but it's too complex, way over my needs.

There's InstantGui which is free on the store, but it is also clunky, i haven't managed to find my way around.

What i need: Some simple 2D GUI system with simple button resizing, sliders and toggle boxes.

Main menu would be something like this:





And the other place where i would implement the UI would be shop, which would also be simple:





Some things i saw, but haven't tried

DoozuUI - Uses Unity UI but seems simple enough. Unfortunately, there's not a demo to try it out (as far as i have seen). Has support for Playmaker which is neat.

Psd 2 Unity uGUI Pro - It's idea has stricken me as simple. I make an interface in Photoshop, then simply transfer it, but it also has no demo to try out.

2D Toolkit - It has support for Playmaker, but i don't know can i make only UI in it, or should i transfer my whole game to 2D toolkit? Also, i haven't tried it, i don't know if it's easy or not.

So, any suggestions or experience in using any of these?

42
Playmaker Help / Bulk changing of values of global variables
« on: September 16, 2016, 12:00:15 PM »
Hi guys,

i made a multiple weapon/weapon heating/damage/bullet system for my game and now i have to make a power-up system which will have double fire rate, double damage and no heating pickups.

Now, i arranged my weapon system like this:

Every weapon has its own prefab (5 weapon levels, 5 different fire rates and 5 patterns). Every weapon level has its own bullet prefab. Weapon X level 1 shoots bullets X level 1, fire rate X, pattern X, weapon X level 2 shoots bullets X level 2, fire rate X, pattern X, etc. You get the idea.

Every bullet prefab has its own heat variable which adds up to the main heat counter (weapon shuts down when it overheats) and damage points variable.

Regarding power-ups, i'm having difficulties of making a concept that would be easiest to work and maintain.

For now, the easiest solution for me with so many prefabs and variables is to simply multiply all the global variables (all are integers) when i pickup double damage or double fire rate power-ups and to seat heat variables of bullets to zero when i pickup the no heating pickup, and revert them back after the timer goes off.

Any ideas on how to do this? Is ia possible to change variables by scripting? I'm also open to other ideas on solving the problem if you have them :D

43
Hi guys,

i posted this on unity forums, but i would like to hear your opinion too!

I am implementing the normal/half/double damage mechanics. The way i do it is like this (simplified):

There are two types of weapons:

1. Bullet
2. Energy

Eash type of weapon can be upgraded, so we have something like this:

1. Bullet Level 1 (deals 2 damage)
2. Bullet Level 2 (deals 4 damage)
3. Energy Level 1 (deals 4 damage)
4. Energy Level 2 (deals 8 damage)

There are two types of enemies too:

1. Red enemy - Bullet does normal damage (2 and 4), Energy does half damage (2 and 4)
2. Blue enemy - Bullet does normal damage (2 and 4), Energy does double damage (8 and 16)

Now, when the bullet enters the collider, it is registered by tag (Bullet Level 1, Bullet Level 2, Energy Level 1, Energy Level 2), corresponding to that, damage variable is called and, depending on the enemy type, it is multiplied, divided, or left as it is. This is a fairly simple example, and the total number of combinations is 8. However, when we insert 20 weapons with 4 upgrade levels and 40 types of enemies, things start to look like spaghetti, overly complicated and hard to maintain.

If there would be a possibility to multiple tag the object and to particular number of damage point when a set of tags is recognized it would be much easier, alas, it is not supported (yeah, i know about the stuff on the asset store, but i want to see what other legit way to do this would be. Besides, i think those are useful only for organizing, i wouldn't know how would i compare multiple tags).

The FSM is:

First state:

Collision 2D event/Compare Tag

Second state:

Int Operator with divide or multiply operator depending on type of damage, or only take damage if there are no modifications.

I would like to hear your opinion :)

44
Playmaker Help / Following the camera and moving [SOLVED]
« on: August 17, 2016, 12:21:46 AM »
Hello,

i have a simple FSM for moving the spaceship around (get axis and set velocity2d). I have a moving camera so the ship has to follow the camera and retain its ability to move at the same time. I can't seem to wrap my head around it, either i set the ship to follow the camera, but i can't move it, either i can move the ship but it doesn't follow the camera, please help! It's a classic shmup setup that i can't seem to recreate.

Here's the FSM i'm using


45
Playmaker Help / Making a smooth speedup and slowdown magnet [SOLVED]
« on: August 03, 2016, 12:13:33 AM »
Hello guys,

i am making a small shmup with the ship having a magnet for pulling credits that stay behind destroyed enemies.

The first part was quite easy:

1. I put the Get Distance action and i store the distance from the object that will be attracted to the Player in the Distance variable.
2. In the Conditional Expression, if the Distance variable is under predetermined value, we go to the next state.
3. Move Towards action is targeted towards Player, with the Max Speed set as MaxSpeed variable.
4. In the Fload Add action i set the Float Variable to MaxSpeed, set the desired increment in the Add field, check every frame, and the magnet is working.
5. To stop the magnet from working, i insert Get Distance action and Conditional Expression again to revert to state one when the object gets out of the magnet's "range". Unfortunately, it stops immediately. So i inserted the third state with Ease Float that will revert to the first state on finish event, but i'm not sure how to set it up, i'm using MaxSpeed as From Value, To Value is 0, but it stops immediately also. I also tried to use Get Speed 2D action, store it in Speed variable and put it in From Value, but it's not working. Any ideas?

Pages: 1 2 [3] 4