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.

Messages - Thore

Pages: [1] 2 3 ... 13
Playmaker Help / Re: Unitys Shadergraph Float access?
« on: April 24, 2019, 02:48:04 AM »
I think shader graph mangles the names. This might help:

When a new property is added, it generates an inscrutable string, as visible on the second picture above. To access the property, you just need to define a name there (convention is _yourPropertyParameter).

Playmaker Help / Re: How do I make this faster?
« on: April 13, 2019, 09:40:26 AM »
I think the standard is with Set Event Data, Get Event Info.

The weapon sets the data into a “package” and the receiver picks up the info to process it. It should normally be near instantaneous with no problems. But when the health FSM is a huge labyrinth of states, then it takes a bit more.

Use Start state to initialise everything, reset health, load from data container etc. Then put the logic for taking damage in a single standalone state, with your own custom “on hit” global event (sent by your weapons, set with set event info in their damage dealing FSM ).

On hit, get event info, get damageReceived variable, substract from health, then null damageReceived (since it was processed). And that’s it. Put a finished event there, and have it go to an empty “done” state, so you see it did the thing. With debug mode on, you can also count how often it gets there.

Where done is now, you can then add the checks and compare logic to set off hit animation, check if you’re dead etc. Our you can make it more modular which is generally better.

General Discussion / Re: Wait Problem...
« on: April 13, 2019, 09:06:49 AM »
Here‘s how wait time works:

Unity has its own internal clock, which can be manipulated to do e.g. slo-motion effects, pausing the game etc. This clock is called time scale, and you normally use this. But some stuff still needs to wait, but should not be affected by Unity’s internal time, which is “real-time”.

Say a puzzle must be solved in 30 seconds, but the game is paused. Of course, the 30s timer should be paused, too. But the UI has 2 second delay for some effect, and this should always be 2 seconds, in “real-time” no matter what.

Playmaker Help / Re: How to reset animation to starting point?
« on: April 10, 2019, 01:44:01 AM »
When it happens sometimes, it looks like a bug, especially in an endless runner type of game. Can you de- and reactivate the object when it is off screen and reset it then? Otherwise use mechanim, and a set animation trigger action to return to a state you want. You can hook up the resting state to any state, and reset it that way.

A: Set the raycast to go to next state after it found something (do not use every frame). That might do the trick. The next state, you do the thing, then return to checking. If you need constant checks, you can also build a loop manually. Use two identical states with rays, and a wait action in each, plus finished events. You can also put the wait between them etc.

Playmaker Help / Re: Convert FSM to C#,possible?
« on: April 09, 2019, 10:26:22 AM »
The resources are negligible. Make sure you keep your FSMs tight and focussed, and use more of them, not less (like with scripts, take advantage of component modularity).

No, you can’t convert FSMs to scripts, because they work totally different. You can try out a mechanic (prototype) and then use that to write a perfect script for that purpose, if you want to.

Playmaker Help / Re: Jumping within camera
« on: April 09, 2019, 09:14:34 AM »
Use the CineMachine package (free addon for Unity) for this, and follow the instructions explained here to get a good start.

Install CineMachine and configure it, see video. CineMachine allow to follow an object with nice controls. Now add a game object to the player under the holder object, and instead of following the player character directly, follow a new empty game object under the holder, call it e.g. “focus”. Once you got the basics ironed out, you can use Playmaker to slightly adjust the focus, e.g. offset it when jumping. But I advice to do this only as the last step, rely mostly on CineMachine.

Playmaker Help / Re: How to you equip items with PlayMaker?
« on: April 05, 2019, 03:47:05 PM »
Try something like this:

Add FSM to character. Start State, call it Ini. Here we first want to find the attachment game object, that is child of hand. If you want to do this right, prefer referencing game objects by name, or tag, etc. and rather not by drag and drop (only if the object is part of the same prefab). A game object in the scene is a concrete individual object, whereas a prefab is a blueprint that can be used to produce actual objects. So name it “WeaponHolder” or something. Then add the find child action. Thus, when the character spawns, it will look for the WeaponHolder, and remember it in a variable. Finish event...

Next state, called “unarmed”, say we wait for key down, space bar. Later on, use button down and Unity’s input manager. But for prototype or web game, keys are fine.

Next state, create game object, and reference the sword prefab. Also store the object (you need this to reference the actual sword later). Next action, set parent, to move it below the WeaponHandler, which we conveniently stored as a variable. I believe the parent  action allows to set child’s transforms to zero everything. No rotation, 0/0/0 location. That’s the point of the preparation above, because now you can make weapons that will always work when simply dropped into the WeaponHandler at zero.

After that’s done, go to next state, called “armed”. In the same manner you can reverse back to unarmed (wait for a key here, if pressed, go to next state, destroy sword, then go back to unarmed).

Well, presto, now after pressing space, the character has the weapon in hand. But that’s just the start. Now when arming, you also need to to send animation trigger, to tell mechanim to go into “armed” set of animations and so on. Also, when armed, you want to activate another FSM to do the actual attacking etc. And switch it off when unarmed etc.

It’s not easy. You can do it in a few days, but you should start with something slightly easier as a first attempt.

Another tip: stuff like that can often be created manually. I.e. what do you need to do, exactly, so that the sword appears in the hand? Is it switching on a game object? Is it parenting and zero transform a prefab instance? That means, you can do this step by step in Unity’s editor. After you figured out what you need to do, you can make an FSM, almost like a macro, that does these steps in automated fashion.

Playmaker Help / Re: How to you equip items with PlayMaker?
« on: April 05, 2019, 11:18:39 AM »
First, a system like this is intricate, but I can give you a few pointers.

1) weapon needs to have a pivot point or parent game object so that when you rotate it, it rotates at the handle. Prefab this whole thing.

2) the hand needs to have a child game object where you want the sword to attach to. Use gizmo to make it visible. Attaching is simply putting that sword as a child of this object, do this by hand, so it’s zero in the transform. Then rotate or adjust the attach game object parent so that the sword is attached correctly. Now you have this set up, you can delete or unparent the sword.

The goal is that you can just drop the sword into the attachment as child, zero tthe swords transform, and it looks correctly.

3) equipping is then, after some interaction (button press etc), parenting/child the sword to this attachment game object, or creating a sword object new. And then setting the transform to zero, so it sits correctly.

Playmaker Help / Re: Shooting a raycast through an object?
« on: April 02, 2019, 02:28:36 AM »
Maybe you can turn the raycasting game object, rather than the raycast itself, towards a target?

If players save the file, and restore it later, and there is no server-side oversight, expect players to tamper with the file and cheat. As long it’s strictly single player, it might be barely permissible, but if actual money or any kind of multiplayer (even indirect, hiscores etc) is involved, I strongly advice against such solutions.

I’d say depends on what you want to do. You can expand with playmaker just fine, add new mechanics and features, or replace something. The more separate the new stuff, the easier. You can add new powerups, do the new boss mob fight with it etc.

But you cannot use playmaker to complete existing scripts, make it write code, or easily expand already developed systems (what jean wrote), i.e. if you have three RPG classes and you want a fourth one, that’s going to be difficult or impractical altogether.

Playmaker Help / Re: Send Key/Button
« on: March 25, 2019, 09:45:23 PM »
You have to think differently. You don’t want to press the U key, but you want to execute the same routines that are executed after pressing U. To do this, simply add (global) events wherever you also listen for the key. Then whatever “presses the U key” broadcasts an event, and in turn, all the routines are executed as if the U key was pressed.

Hi guys, i solved the issue of multiple weapons firing together by simplifying the system and sending global event from input controller to weapons, but now i have issue of another nature.

When i press the button, FIRE event is sent to the designated weapon, when i release button STOP FIRING event is sent. That works fine for automatic weapons, but for manual weapons that are supposed to have some cooldown between shots, they can be overriden with continuous pressing of the fire button, thus resending the fire event again and again and overriding the cooldown.

Any ideas on how to overcome this?

Put the global event FIRE as a usual event under the state, then add a wait at the end, and then loop back to the state with FIRE underneath. That should do the trick. Though for autofire you need to add some more logic, I think, to keep the firing going.

Else, you need a separate state for the cooldown.

Pages: [1] 2 3 ... 13