Post Your Source Codes Here

Posts 46–60 of 176 · Page 4 of 12
Here is a simple way to access your current players inventor
Code:
Inventory[] getInventory()
{
     return (Inventory[])(UnityEngine.Object.FindObjectsOfType(Type.GetTypeFromHandle(Type.GetTypeHandle(new Inventory()))));
}
then just do

Code:
foreach(Inventory inv in getInventory()) 
{
     // Do stuff
}
- Version: All
- Spawns in 1000 wooden walls, in a line with a spacing of 5f.

Code:
                if (GUILayout.Button("Test"))
                {
                        float adv = 0f;
                        for (int i = 0; i < 1000; i++) 
                        {
                            adv = adv + 1f;
                            SpawnStructures.placeStructure(0x4269, Camera.main.transform.position + ((Vector3)Camera.main.transform.forward * adv), 1, string.Empty);
                        
                        
                        }
                }
Quote Originally Posted by Blueblood1 View Post
- Version: All
- Spawns in 1000 wooden walls, in a line with a spacing of 5f.

Code:
                if (GUILayout.Button("Test"))
                {
                        float adv = 0f;
                        for (int i = 0; i < 1000; i++) 
                        {
                            adv = adv + 1f;
                            SpawnStructures.placeStructure(0x4269, Camera.main.transform.position + ((Vector3)Camera.main.transform.forward * adv), 1, string.Empty);
                        
                        
                        }
                }
Work on MP? I would think Nelson would have the function check that you have the valid mat in your inv.
Quote Originally Posted by jumboperson187 View Post
Work on MP? I would think Nelson would have the function check that you have the valid mat in your inv.
Didn't test it, couldn't find a server :/
Quote Originally Posted by Blueblood1 View Post
Didn't test it, couldn't find a server :/
Okay, well if it does work on MP I'm gonna give Nelson some serious shit on steam.
Quote Originally Posted by Blueblood1 View Post
Me First :P

- Version: All (Unless Unity updates)
- Spawn on cursor.
Code:
Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
RaycastHit hit;
if (Physics.Raycast(ray, out hit, distance))
{
                
}

- Version: All (Unless lighting is redone)
- Improved Full Bright
Code:
RenderSettings.ambientLight = new Color(0.95f,0.95f,0.95f);
base.light.color = Color.black;
base.light.intensity = 0f;
- Spawn Items
- Version: 2.2.1
Code:
SpawnItems.spawnItem(itemId, 1, Camera.main.transform.position);
distance is invalid.
You need a float called distance.. so
Code:
private float distance = 50f
Quote Originally Posted by Blueblood1 View Post
You need a float called distance.. so
Code:
private float distance = 50f
I swear you are awesome.

Second person I saw who actually gave real instruction on it, or at least close.

Thanks!
Quote Originally Posted by Blueblood1 View Post
You need a float called distance.. so
Code:
private float distance = 50f
I know I ask to many questions, but does this seem right?

if (GUI.Button(new Rect(230, 190, 80, 20), "Test"))
{
Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
RaycastHit hit;
if (Physics.Raycast(ray, out hit, distance))
{
SpawnItems.spawnItem(Convert.ToInt32(this.itemspaw n), Convert.ToInt32(this.amount), hit.transform.position);
}
You don't need to transform the hit to a position, just use hit.point, so

Code:
                if (GUI.Button(new Rect(230, 190, 80, 20), "Test"))
                {
                    Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
                    RaycastHit hit;
                    if (Physics.Raycast(ray, out hit, distance))
                    {
                           SpawnItems.spawnItem(Convert.ToInt32(this.itemspawn), Convert.ToInt32(this.amount), hit.point);
                    }
                }
Only problem with this being a button is that, your cursor is over the button when you press it, so it would spawn behind your mouse on the screen, so unless your looking at the ground it wouldn't spawn.
Yeah, the code isn't working for me. haha.
Well where are you getting the itemspawn and amount from?
It works MP, Kunii made a player boxer, all players on the map get trapped in walls.. lol
Quote Originally Posted by Blueblood1 View Post
It works MP, Kunii made a player boxer, all players on the map get trapped in walls.. lol
It also occasionally spawns random shit, such as firetrucks if you click it too fast, too many times
Quote Originally Posted by Kunii View Post


It also occasionally spawns random shit, such as firetrucks if you click it too fast, too many times
LOL thats great
Posts 46–60 of 176 · Page 4 of 12

Post a Reply

Similar Threads

Tags for this Thread

None

Talk with us