• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • ✅ The POLL for Hive's Texturing Contest #33 is OPEN! Vote for the TOP 3 SKINS! 🔗Click here to cast your vote!

Some help could be pleasant at-least

Status
Not open for further replies.

Screamernail

S

Screamernail

(This forum really need to come back really)

I need quick help with my project. I made some super basic scripts and now i want them to be more advanced. Can anyone help here?

I'll send forth the project's file over here but first comment on this thread so i know that i'm not wasting my time.
 

Screamernail

S

Screamernail

Okay then the forum seemed not to be dead(I hope) and i admit i don't know how to exactly send the ENTIRE file through here so i'll give you the scripts.

using UnityEngine;
using System.Collections;

public class PlayerControls : MonoBehaviour {

public bool Active;
public float Speed;

void Start () {
Active = true;
}

void Update () {

if (Input.GetKey (KeyCode.LeftArrow) && Active == true)
{
transform.Translate (new Vector3 (-Speed, 0, 0));
}
if (Input.GetKey (KeyCode.RightArrow) && Active == true)
{
transform.Translate (new Vector3 (Speed, 0, 0));
}

if (Input.GetKey (KeyCode.UpArrow) && Active == true)
{
transform.Translate (new Vector3 (0, Speed, 0));
}
if (Input.GetKey (KeyCode.DownArrow) && Active == true)
{
transform.Translate (new Vector3 (0, -Speed, 0));
}

}
}

This next one is meant to be different than how other RTS controls works. (Because it's easier for someone like me)
using UnityEngine;
using System.Collections;

public class UnitControls : MonoBehaviour {

public int MaxTurnPoints = 3;
public int TurnPoints;
public float TPfloat = 0.1f;
float TPGone;
public bool Active;
public float Speed;
public PlayerControls player;
Rigidbody2D Rigy;

void Start(){
Rigy = gameObject.GetComponent<Rigidbody2D> ();
TurnPoints = MaxTurnPoints;
}

void OnMouseUp () {
if (player.Active == true) {
Active = true;
player.Active = false;
Rigy.isKinematic = false;
}
}

void Update () {

if (Input.GetKey (KeyCode.LeftArrow) && Active == true && TurnPoints != 0)
{
transform.Translate (new Vector3 (-Speed, 0, 0));
TPGone += Time.deltaTime;
}
if (Input.GetKey (KeyCode.RightArrow) && Active == true && TurnPoints != 0)
{
transform.Translate (new Vector3 (Speed, 0, 0));
TPGone += Time.deltaTime;
}

if (Input.GetKey (KeyCode.UpArrow) && Active == true && TurnPoints != 0)
{
transform.Translate (new Vector3 (0, Speed, 0));
TPGone += Time.deltaTime;
}
if (Input.GetKey (KeyCode.DownArrow) && Active == true && TurnPoints != 0)
{
transform.Translate (new Vector3 (0, -Speed, 0));
TPGone += Time.deltaTime;
}
if (Input.GetKeyDown (KeyCode.Escape) && Active == true) {
Active = false;
player.Active = true;
Rigy.isKinematic = true;
}

TPfloat += Time.deltaTime;
if (TPfloat >= 5f) {
TPfloat = 0f;
TurnPoints += 1;
}
if (TurnPoints >= MaxTurnPoints) {
TurnPoints = MaxTurnPoints;
}
if (TPGone >= 1f) {
TPGone = 0f;
TurnPoints -= 1;
}
}
}

This one is unfinished.
using UnityEngine;
using System.Collections;

public class UnitStats : MonoBehaviour {

public int Health = 20;
public int Armor;

public bool Mechanical;

public int MaxDamage = 4;
public int MinDamage = 6;
public float AttackDuration = 0.1f;
public float AttackSpeed = 0.3f;
public float AttackTime = 1.5f;
public GameObject Projectile;

void Start () {

}


void Update () {

}
}

I'm a really basic programmer so some help can be of need here.
 
Level 7
Joined
Mar 10, 2013
Messages
366
We're not going to teach how to develop.

Maybe you can point out what's the problem you're having.
 
Level 29
Joined
Jul 29, 2007
Messages
5,174
Again, you didn't give any details, just some arbitrary code. What are you having problems with?

If you have a specific question, shoot. If it's a generic "how do I make code for X type of game", search for tutorials, there are plenty of them.

Use the [code] tag.
E.g. [code=cs]stuff[/code]
 

Screamernail

S

Screamernail

I just wanted to know how to advance the codes. Might just look up Youtube.


And aren't this and the main forum "Game Development" made for teaching?
 
Level 29
Joined
Jul 29, 2007
Messages
5,174
There are countless of tutorials, more and less specific, for Unity, and pretty much anything else. If you want to learn C#, or Unity development, it will be much faster for you to simply look for them. In addition, if you have a question, you can most definitely be assured that someone had it before you, asked it somewhere on the internet, and got the answer. If it's a programming question, this will most likely be on stackoverflow.
The skill you will most need in your life as a programmer of any kind is searching for information.
While you can ask questions here, and you will likely get an answer if they are not generic, it will simply save you a lot of time to search them on a search engine.

Now, the issue with your questions in this thread, is that they aren't questions.
You simply posted some arbitrary code, not saying what it is, what you want, and what you're having trouble with.

As an example - if you have a specific problem, like "why is this code that's supposed to do X not working and I get error Y", you will probably get an answer.
If you ask "how do I make all of the code for a game of type X", you won't, but searching for relevant tutorials might help you.
 
Level 25
Joined
May 11, 2007
Messages
4,650
Okay then the forum seemed not to be dead(I hope) and i admit i don't know how to exactly send the ENTIRE file through here so i'll give you the scripts.

using UnityEngine;
using System.Collections;

public class PlayerControls : MonoBehaviour {

public bool Active;
public float Speed;

void Start () {
Active = true;
}

void Update () {

if (Input.GetKey (KeyCode.LeftArrow) && Active == true)
{
transform.Translate (new Vector3 (-Speed, 0, 0));
}
if (Input.GetKey (KeyCode.RightArrow) && Active == true)
{
transform.Translate (new Vector3 (Speed, 0, 0));
}

if (Input.GetKey (KeyCode.UpArrow) && Active == true)
{
transform.Translate (new Vector3 (0, Speed, 0));
}
if (Input.GetKey (KeyCode.DownArrow) && Active == true)
{
transform.Translate (new Vector3 (0, -Speed, 0));
}

}
}
Here you're missing the jetpack and double jump codes, google them and you should be able to implement them.

This next one is meant to be different than how other RTS controls works. (Because it's easier for someone like me)
using UnityEngine;
using System.Collections;

public class UnitControls : MonoBehaviour {

public int MaxTurnPoints = 3;
public int TurnPoints;
public float TPfloat = 0.1f;
float TPGone;
public bool Active;
public float Speed;
public PlayerControls player;
Rigidbody2D Rigy;

void Start(){
Rigy = gameObject.GetComponent<Rigidbody2D> ();
TurnPoints = MaxTurnPoints;
}

void OnMouseUp () {
if (player.Active == true) {
Active = true;
player.Active = false;
Rigy.isKinematic = false;
}
}

void Update () {

if (Input.GetKey (KeyCode.LeftArrow) && Active == true && TurnPoints != 0)
{
transform.Translate (new Vector3 (-Speed, 0, 0));
TPGone += Time.deltaTime;
}
if (Input.GetKey (KeyCode.RightArrow) && Active == true && TurnPoints != 0)
{
transform.Translate (new Vector3 (Speed, 0, 0));
TPGone += Time.deltaTime;
}

if (Input.GetKey (KeyCode.UpArrow) && Active == true && TurnPoints != 0)
{
transform.Translate (new Vector3 (0, Speed, 0));
TPGone += Time.deltaTime;
}
if (Input.GetKey (KeyCode.DownArrow) && Active == true && TurnPoints != 0)
{
transform.Translate (new Vector3 (0, -Speed, 0));
TPGone += Time.deltaTime;
}
if (Input.GetKeyDown (KeyCode.Escape) && Active == true) {
Active = false;
player.Active = true;
Rigy.isKinematic = true;
}

TPfloat += Time.deltaTime;
if (TPfloat >= 5f) {
TPfloat = 0f;
TurnPoints += 1;
}
if (TurnPoints >= MaxTurnPoints) {
TurnPoints = MaxTurnPoints;
}
if (TPGone >= 1f) {
TPGone = 0f;
TurnPoints -= 1;
}
}
}
You're missing the youtube rendering system here, you should check this out:
Error | Unity Community

using UnityEngine;
using System.Collections;

public class UnitStats : MonoBehaviour {

public int Health = 20;
public int Armor;

public bool Mechanical;

public int MaxDamage = 4;
public int MinDamage = 6;
public float AttackDuration = 0.1f;
public float AttackSpeed = 0.3f;
public float AttackTime = 1.5f;
public GameObject Projectile;

void Start () {

}


void Update () {
for (int i = 0; i < 1337; i++)
{
Debug.LogError("We don't know what you need help with, saying I need better codes does not mean anything since you can do so much things with coding. You should learn how to specifiy what problem you're having.
When you've done that, go to the correct forum (Unity forums) rather than Hiveworkshop.", Projectile);
}
}
}
I added a very good code here, will make it whole better.
Answered in the quote on things you can do to make it better.
 

Screamernail

S

Screamernail

Answered in the quote on things you can do to make it better.

Thanks i'll see what i can do.

You guys want to know what the project is?

Reufo2D:
It where first going to be a 3D Real Time Strategy game, but alas i am weak when it goes to 3D.

As you people would notice by the code it was going to be a unique slow game instead of real-time. This takes place in a world which has Morna as the magic (Morna like in my Xillu world) and i decided to put the Uothi (Mellia's specie) in the game. It's very similar to Warcraft 3 except the controls are different.

I planed it to be a 3DS game because it got a touch screen.
You first control the camera, moving it around and click on things. When you select a unit the camera controls are disabled and you can move, attack and cast abilities with the unit. However any of these actions will remove a unit's turn-points. If all of them depletes then you must wait for the unit to regain point after point. (Meanwhile you'll command the other units)

I need to think for more game-play mechanics but in the meanwhile, is it worth doing this game?
 
Status
Not open for further replies.
Top