Zekromius
Official Terrarian
I don't understand, can you simplify that please?Wait, you're not putting this all in one file are you?
You need to split out class instances through different files.
I don't understand, can you simplify that please?Wait, you're not putting this all in one file are you?
You need to split out class instances through different files.
Could you post the error if there is one? Can you tell us if your using Mac? What exactly is happening thats preventing you guys from playing?Ok so me and a friend are trying to play together but we are having issues it wont let us if any one has any clue how we could thanks
Is your item sprite and cs file in the Weapons subfolder of your Items directory?I came before, no one resolved my problem
You can have more than one class instance in one file, that's how to compact your code; You just can't have different namespaces in the same file afaik. For example, you could have all your non weapon, material items in one big class named "Materials.cs". The sprites of each item would just be the name of each class inside.Wait, you're not putting this all in one file are you?
You need to split out class instances through different files.
You guys have different mods and that is causing errorsCould you post the error if there is one? Can you tell us if your using Mac? What exactly is happening thats preventing you guys from playing?
ok sorryMake it 1.3.4.3 plsss its been a week or so plss
YesIs your item sprite and cs file in the Weapons subfolder of your Items directory?
[doublepost=1480915002,1480914885][/doublepost]
You can have more than one class instance in one file, that's how to compact your code; You just can't have different namespaces in the same file afaik. For example, you could have all your non weapon, material items in one big class named "Materials.cs". The sprites of each item would just be the name of each class inside.
Is your item sprite and cs file in the Weapons subfolder of your Items directory?
[doublepost=1480915002,1480914885][/doublepost]
You can have more than one class instance in one file, that's how to compact your code; You just can't have different namespaces in the same file afaik. For example, you could have all your non weapon, material items in one big class named "Materials.cs". The sprites of each item would just be the name of each class inside.
namespace MyMod.Items.RandoStuff {
public class MyFirstItem : ModItem {
}
}
I'm not so certain on the cursor change part, but for your first two things...Just a few questions:
1. how do I set a timer in my code that does not affect game's performance?
2. My intention is when the player takes out the weapon (gun with magazine), I want the weapon to not reset (like if I used 20 rounds from a 30 round magazine, and put back in and take out afterwards, the weapon should remain with 10 rounds left) whenever I equip it. Should I label the magazines upon game startup in my code?
3. I want my mouse to switch into the reticle image I created, how should I do this?
using System;
using System.Collections.Generic;
using System.IO;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.DataStructures;
using Terraria.ID;
using Terraria.ModLoader;
namespace ModName
{
public class MPlayer : ModPlayer
{
//Global variables that can be used outside this class file
//All this variables are arbitrary, meaning you can set them later on, maybe on the item
public static int maxAmmoCount = 30;
public static int usableAmmoCount = maxAmmoCount;
public static bool isReloading = false;
public static bool reloadTime = 0;
public static bool reloadTimer = reloadTime;
public override void PreUpdate()
{
if(usableAmmoCount < 1)
{
isReloading = true;
}
if(isReloading)
{
reloadTimer--; // Decrement reloadTimer
//If reloadTimer reaches zero
if(reloadTimer < 1)
{
reloadTimer = reloadTime; //resets the reload time
isReloading = false; //resets the player to not reloading
usableAmmoCount = maxAmmoCount; //resets ammo count
}
}
}
}
}
using System;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace ModName.Items.Usables
{
public class AModItem : ModItem
{
public override void SetDefaults()
{
//Fill in the rest here
MPlayer.maxAmmoCount = 30; //Calls the variable from MPlayer file and changes the thing, there is an actual way but we'll stick with this for now
MPlayer.reloadTime = 60; //Remember, an update/tick in terraria is 1/60 of a second, so 60 ticks is 1 second
}
public override bool CanUseItem(Player player)
{
//If player is reloading don't use item
if(MPlayer.isReloading)
{
return false;
}
//If the player has no usable ammo, don't use item
if(MPlayer.usableAmmoCount < 1)
{
return false;
}
return true;
}
public override bool UseItem(Player player)
{
MPlayer.usableAmmoCount--;
return true;
}
}
}
Uninitialized Array
public static int[] maxAmmoCount = new int[10]; //Initiallizes an array of size 10
Initialized Array
public static int[] maxAmmoCount = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }; //Initializes an array with these values
You can always pull values from the array depending on the weapon, so use an integer index to store with your item for the array, for example a machine gun uses the first array slot, so we would have to check:
maxAmmoCount[0] //Indexes ALWAYS start with 0, not 1
You can install the latest tmodloader on your current version of terraria, no backup needed. It's just an exe file, so all the version specific stuff is included in the exe.Uhh hi...I am new to the forums. I have played Terraria both vanilla and the Tmodloader for two years by now. I am not socially open in the internet and I am nervous to join the forums. However I would like to hear some advise from people around the globe about modding Terraria
I know Tmodloader that is compatible for Terraria 1.3.4 is not released yet, but some how you guys manage to get the older version working on a older version of terraria. I do have backed up versions of vanilla Terraria since 1.3. I am wondering if anyone of you could kindly tell me how to get Tmodloader working on my older version of terraria so I can start modding again. I need to mention that I am not an expert computer user so please make it understandable by a casual user.
Also some advise on using the forums might be helpful too. I am still kind of shy about this...
You can install the latest tmodloader on your current version of terraria, no backup needed. It's just an exe file, so all the version specific stuff is included in the exe.
But my Terraria is version 1.3.4.3. Does it still works?
Tmodloader will bring it down to 1.3.3.
Tmodloader will bring it down to 1.3.3.
Can you take a screenshot of your Items directory and Weapons directory? On Windows it's Alt+Func+PRTSC