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

Pages: 1 ... 7 8 [9] 10
Action Requests / BergZergArcade's "Follow" ai script to an action.
« on: March 24, 2012, 12:20:53 PM »
So, to anyone that's followed BergZergArcade's Hack-n-Slash tutorial should be familiar with this one...

and i've tried (and failed miserably) to make this into a custom action... so, i'm officially asking for help turning this into a custom action so that i can use it.

Code: [Select]
//BergZerg Arcade helped with this one

using UnityEngine;
using System.Collections;

public class EnemyAI : MonoBehaviour {
public Transform target;
public int moveSpeed;
public int rotationSpeed;
public int maxDistance;

private Transform myTransform;

void Awake()
myTransform = transform;


// Use this for initialization
void Start ()
GameObject go = GameObject.FindGameObjectWithTag("Player");
target = go.transform;
maxDistance = 2;

// Update is called once per frame
void Update ()
Debug.DrawLine(target.position, myTransform.position,;

//Looking at the player
myTransform.rotation = Quaternion.Slerp(myTransform.rotation,
                                        Quaternion.LookRotation(target.position - myTransform.position),
                                        rotationSpeed * Time.deltaTime);
if(Vector3.Distance(target.position, myTransform.position) > maxDistance) {
//Moving to the player
myTransform.position += myTransform.forward * moveSpeed * Time.deltaTime;

it works as a regular script but for the AI systems i've got to make, i need to control it much like you would with any Playmaker FSM... and it would be a lot simpler for what i need it for.

to note, i need this to be a "constantly on" action and the distance, speed and turning variables exposed so that i can control them with variables (or hard-coded in numbers.)

can't get into the program at all, not even to change to a different project and only gives me the bug-report window each time i try.

and i've already tried uninstalling unity, rebooting and going with a fresh install.

both the new version of unity and the old one.

i've clicked on a different level in a different project through the explorer and only the projects that have been updated to playmaker 1.3 are affected.

PlayMaker Tutorials / Making a pathfinding network (collab)
« on: January 19, 2012, 06:57:27 AM »
Okay... so, i'm not begging for code, i'm not asking for someone to do this for me, what i'm hoping to acomplish with this thread is a way to brainstorm and implement a waypoint network system to be used with Playmaker (and released as a package once it's fully done and successfully tested to work.) that can be used for pathfinding with enemies.

So, first off, let's assume that the waypoints are placed on the game map...

i've tried to make one that does it dynamically, looking for the objects that are tagged as "Waypoints" (custom tag of course) and collecting them... but unless using arrayMaker (still trying to figure that one out completely) i don't know how i can make it grab all of them, sort through them and sort them from distance from eachother.

another possible thing to consider is to have waypoints broadcast to all other waypoints the location of the object that the "enemies" are pursuing to all the others (as well as what waypoint is doing the broadcasting.) so that whatever enemy is using the waypoint system, it knows where it eventually has to go.

every project (i think) should have at least a bit of brainstorming involved... and IF this thread can get really popular and get all sorts of ideas in it, it could become a resource for those of us looking to do just such a thing.

so, please post your ideas on how you'd get something like this to work. let's also look at the pros and cons too.

yeah, i was trying to work out a way of manipulating textures via a variable and noticed that when that method i was trying wasn't working, the variable i created couldn't be deleted. when changing it to a float, bool or other non-object var, it would create another one with the same name...

tried on a fresh install, new project... same results. i'm thinking that it has something to do with the menu in the lower part where you can select the sub-type of object (and it brings up a menu with options such as Unityengine.object, iTween, FSMtemplate, etc...)

i've made it such that this issue isn't impacting the game (i've isolated the variables that have done that as unused) but still, thought i'd mention it... anyone else face this as well? that and the "perfectionist" in me is itching to get rid of those variables so that the var list is clean (well, as clean as my var lists get :P)

i know it seems pretty specific... and i'm trying to figure out the maths to calculate the force and angle required to make an object be thrown in an arc to land where i want it to.

yes, i am brainstorming ways that i can fudge it:
- such as firing off an object towards the target point and having the grenade follow on the XZ plane and the Y axis moving it upwards until it hits the apex (distance/2) then falling downwards... it would do the trick but it wouldn't look very pretty... also figuring out how i can calculate the rate of ascension so that it has a falloff nearing the apex and then having the same rate applied backwards to calculate the downward gravity...

yeah, i know i can easily just "create object" with physics and "apply force" but that doesn't really strike me as being able to target with relative accuracy.

hmm... is there a plan to add in some trigonometry functions? that could help (since a sin-curve would be close enough for what i have in mind.)

EDIT: i'm researching how to calculate trajectories... man, i really wish i had paid better attention in math class :lol: not sure i'll be able to crack it and if you've cracked it already, i'll be your bestest of friendsies if you'd be willing to help me nail this one.

PlayMaker Help / Sending Variables to other FSMs?
« on: December 18, 2011, 02:20:00 PM »
I was wondering, since i'm trying to streamline what i've got on a project and i'm needing to find a way to send a variable's (in this case, a vector3) value to another object in the scene so that it can use that information in a state.

before i was using global variables but since i want to have multiplayer capabilities, having one vector3 variable that's global and accessible/used by multiple players, it would cause some issues... i have thought of a workaround of making "player 1 vector," "player 2 vector" and such but that seems a little clunky to me. i will use it but if i can find a way to pass the vector information and keep it somewhat private (as in, being able to tell a specific object the variable information as opposed to having it exposed) it would help.

PlayMaker Help / Adding Explosive force [SOLVED]
« on: October 22, 2011, 02:29:58 PM »
so, i've got a FSM made such that when a monster is killed, it spawns random gibbets randomly within an area with it's center being where the monster is (or, more appropriately, was.)

thing is, it would be nice to give it some explosive force but i don't think i'm using the "add explosive force" correctly. (sadly, i've tried uploading a screenshot of how it's configured but my connection is too spotty for that.)

the gibbets have the rigidbody physics component added so that they fall and though they are kinda exploding, it's not because of the action (it's because some of them overlap and the rigidbody engine i think tries to make them come apart) reason i'd like to add the proper force is two fold... first to know how to use it properly, second is so that i can make the gibbets smaller if need be.

i've even tried ramping up the force to astronomical levels ("99999" in both force and radius) to test, and it doesn't do it. is there a tutorial on how to do it correctly so that i can learn me some physics stuffs?

to help give some clarity on the situation, i've got it so that it cycles through the "add gibbet" section randomly so i can have some randomness to the number and size of the gibbets.

so, i think in order of execution.

1. create a random number from 3-8
2. create three random float variables (from -1 to 1) and put those into the X, Y and Z values of a vector3 variable.
3. select a random object (using the action and each gibbet listed in that action) and put selected object into a gameObject variable.
4. spawn object at the point of the monster, offset by the previous vector3 variable value
5. add the force (still have yet to get it to do what i need it to.) (step 5 and 6 are in the same state, one after the other.)
6. test if the value of the number from step 1 is at or below 0, if so, end the cycle... if not, go back to 2.

anyone able to help with this one?

when playing the standalone version, the state titles are still there... i was hoping that someone could show me where i can turn that off so that the game doesn't have "idle," "shooting," "pursuing," etc. in the final project when it ships (even if it's to beta-testers.)

okay... i'm trying to get an enemy cubie to detect when it collides with a bullet-spark prefab that's created and does not move (giving the impression that the gun firing is firing too fast to see) and thought that it would work for telling the monster (an Evil Cubie) when it's hit so that it can subtract the appropriate amount from it's health... and once down to 0 it's to destroy itself. the FSM seems to get hung up on detecting the collision if it's anything but a custom tagged item (i'm using a tag "damagers" for the prefabs being created where the bullets hit.)

it detects player and untagged (haven't tried other enemies) but not "damagers."

any hints on how to get my characters minigun to do damage? i don't mind scrapping what i have so far (though i would like to keep the bullet sparks where it hits, but afaik that's purely cosmetic.)

PlayMaker Help / Trigger Event issues
« on: October 19, 2011, 08:56:31 AM »
Using a script (my AIFollowRange script which is based off of berg-zerg arcade's and the Tornado Twins' AI script to follow only) and with the FSM set to detect the trigger intersecting with the player doesn't seem to trigger if the enemy enters into range (the trigger) unless the player is moving... it'd work find if the player is always moving but not every player will always be moving.

the script works allright (though i'd love to make a FSM to drive it but iTween doesn't seem to do what i need it to) but the trigger issue...

basically, if teh player stands still, the trigger doesn't activate the event... if the player is moving, it will... i need to make it so that the player will trigger it even if they're moving or not.

PlayMaker Tutorials / A Sharing FSM thread?
« on: October 14, 2011, 08:42:09 AM »
So, i was curious how many would be up for a "let's share how we did it" thread where we post our FSMs to achieve various tasks that are a little more on the complex side? i've been working on some but i know that there are some areas where i could learn to do better.

though, not meant as a "copy this into your game to do X" kinda thing, more along the lines of exploring how all the actions can come together to make the behaviors we're aiming for. (though i'm sure some will probably take without contributing, but i guess that's unavoidable.)

emphasis is on sharing how we do specific actions. because i know that i could definately use some help in some but i've managed to crack others... also as a means of maybe checking out our FSMs to see if they can be streamlined.

I think it would be a way of increasing our respective productivity by learning how to apply ourselves with Playmaker to reach the goals we're hoping for a lot sooner than if we were to all do it on our lonesome.

i know there are tutorials out there but i'd think this would be more about just posting the templates and such.

so, good idea? bad idea? if so or not, why?

PlayMaker Help / "Mouse Pick" no longer picks
« on: October 04, 2011, 02:18:50 PM »
so, i've done and redone the tutorial that can be found on youtube but the action "Mouse Pick" isn't registering anything... like, at all... at the least according to the tutorial, i should have a cube moving to the target place clicked... but it doesn't sit there. it just goes back to the initial state.

i've exposed all the variables into the inspector to watch, i've started from scratch with a new scene and followed the youtube tutorial to the letter and i'm at a loss as to what to try next other than updating playmaker again (already tried that.)

is this an error (and not a PEBCAK or RTFM error either?)

PlayMaker Help / Newbie Question: How do i Interrupt "Move Towards?"
« on: June 18, 2011, 05:38:49 AM »
the title pretty much says it all... i've been working on AI and i like how the "move towards" function is compact, easy to use and all that... but, it seems not to allow me to set in some conditions such as the range for ranged attacks and melee attacks and branching out to them. it's almost like the Move Towards action does it's thing until it reaches the end distance. (which isn't really going to help me with the conditional statements i need to set up the actions that branch from it.)

am i missing something rather fundamental or is that action just plain uninterruptable?

Action Requests / Get Object(s) with Tag...
« on: June 17, 2011, 04:26:08 PM »
so, the game that i'm making uses tags to the fullest... basically, player tags are players, enemy tags are enemies, i can imagine you get the idea.

i was looking through the action lists and it doesn't seem to have an intuitive "get" associated with the tagging system in unity. i understand that in some cases it would probably return more than one result which would probably require some sort of array variable kinda thing and though i can make the single-player portion of the game just fine without having to specify or search via tag, when it comes to multiplayer, that would mean i'd have to rework the AI systems i'm working which could potentially lead to issues or just general buggyness...

if there isn't a "get via tag" sort of system, is there a workaround you can suggest?

Action Requests / Advanced Character Controller
« on: June 13, 2011, 09:48:04 AM »
is there one already that i'm missing? (my google-fu is weak, did not produce any answers)

basically, a character control action that integrates things like idle, walk, run, holds animation clips for those actions and a jump feature... i am quite aware that this could be done with some standard FSM workings but it seems like it'd be a lot cleaner to integrate those actions into one.

or maybe a way of creating a character controller that allows you to add as many states within it as you need to hold the various animation clips and what action they're associated with?

Pages: 1 ... 7 8 [9] 10