Menu

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.

Show posts Menu

Messages - TomaszA2

#1
Help / Re: Few features I'd like to know how to make
October 20, 2019, 06:58:59 AM
What if I'd use/create small ID system for this type of weapon? Comp is created only once and ThingDef everytime an object is created?
I was thinking about some simple array in Comp that would check which one is spawned. ThingDef would have just it's own ID. If something is spawned then ThingDef with this one ID would get boost only for itself.
Problems that I noticed about this idea are I'd need to know which one is spawned and I'm not sure if I can make this type of interaction between Comp and ThingDef.
Do you think it's possible without bigger problems?

About your first approach, I'm looking in ThingComp and there is nothing even connected to ,,damage" stats.(power stat of tool inside a weapon) I was thinking before about using PostPreApplyDamage(DamageInfo dinfo, out bool absorbed) and changing DamageInfo before the damage was dealt(probably misunderstood what is this method for) but DamageInfo objects and read-only.
Thing Comp doesn't also contain any class that is connected to something that has Tool class list(not even single Tool class) inside.
ThingComp's parent is ThingWithComps, which has this method:

I am not sure yet and it might be reverse to what I think, I mean Comp created every time object is created and ThingDef one for all. If so I maybe could use above method somehow to call every ThingComp of all this type objects separately. (or no because it would anyway change power of one ,,global" ThingDef which may result in having +x*amount of copies damage bonus)

About the second option. It's nice but it feels for me like escaping from the problem and making solution around of it. Then I may have problem if I'd want to allow few of them possible but also extremaly rare.

Your code gives me an idea I didn't think about before, why not just add item to the game without using xml at all? Am I right it would be then much easier to manage them?
I am yet a little confused and trying to understand your note written under the code fragment.
Anyway, why doesn't ThingWithComps have any ThingDef inside by default? And does creating one really work without any issues? By default are ThingWithComps' not having any representation as an item lying on the ground? (is it that what ThingDef does?)

Approach 3, as I see tools have their ID's. Maybe that's the easiest way if it would work. (but this ID variable is under [unsaved] tag in ILSpy, I am not sure what does it mean and if I could use it as I want)
#2
Help / Re: Few features I'd like to know how to make
October 17, 2019, 03:18:24 PM
Okay, now as it works(thanks for this.parent.def.tools...) I've tried to change = 200 to +=20.
Works fine but is there anything that would make this bonus unique to one item instance?
For now every one spawned sword of this type is getting +20 power (to it's three attack types) everytime another is spawned. (including hauling, equiping and dropping, etc.)
For example first one is in one place with 20 damage, second, third and fourth one are spawned somewhere and all of these items are having 80 damage.
#3
Help / Re: Few features I'd like to know how to make
October 17, 2019, 01:32:47 PM
namespace The_Legendary_Omni_Sword
{
public class CompBoostOnDeath : ThingComp
{
List<Tool> toolsList = new List<Tool>();
/*public CompBoostOnDeath()
{
} Without this rimworld log error is saying ,,default constructor cannot be found" but with it just doesn't change any power stat
*/
public CompBoostOnDeath(ref List<Tool> tool)
{
toolsList = tool;
}
public void changeAttack(Tool test)
{
test.power = 200f;
}
public override void PostSpawnSetup(bool respawningAfterLoad)
{

Log.Error("teteteeettt", false);
toolsList.ForEach( changeAttack );
}

}
public  class OmniSwordClass : ThingDef
{
public OmniSwordClass()
{

}
public override void PostLoad()
{
base.PostLoad();


CompBoostOnDeath tempThingComp = new CompBoostOnDeath(ref tools);

CompProperties tempCompProperties = new CompProperties();
tempCompProperties.compClass = typeof(CompBoostOnDeath);

comps.Add(tempCompProperties);
}
}
}


I've been trying to make stat change proceeded in comp class, because this is where PostSpawnSetup is declared so it's also the only place where I can use it.

Even if it's compiling correctly it throws error to me inside of the game.


I know it should have used constructor with one argument as it is what I did in the code(or at least I think I did) but it looks like it had just ignored argument and looked for basic constructor.

About your last advice, that was the next thing I wouldn't think about if someone hadn't told me about.
#4
Help / Re: Few features I'd like to know how to make
October 16, 2019, 04:57:35 PM

I am able to change ,,power" (flat damage of attack types?) but it yet gives me many errors.
public  class OmniSwordClass : ThingDef
{
public OmniSwordClass()
{

}
public void changeAttack(Tool test)
{
test.power = 200f;
}
public override void PostLoad()
{
tools.ForEach( changeAttack );
}
}


I am using this OmniSword name just as placeholder. I'm not going to name it before I would have finished the code.
Why are these ,,tools" having null ID and why is it talking about ID duplicate? (errors at the beggining of post)

Edit:
Also item icon disappeared.

.xml file is attached to the post, but I don't think it's something caused by it, I haven't touched  it for few hours. (but had open so maybe I did something accidentaly)
#5
Help / Re: Few features I'd like to know how to make
October 15, 2019, 03:22:06 PM
It wasn't like I wanted to know and didn't try to search through game code, I had already few hours spent on searching for it.(I'm very bad in searching through this)
I just needed some key word to search for in IlSpy.

For now I've finished that mod settings menu and I am searching for things I need with IlSpy.(first thing I tried to search is about that whole spawning, after that I'll try looking for stats with your advice)
#6
Help / Re: Few features I'd like to know how to make
October 15, 2019, 01:12:05 PM
I'd never expect dropping item to be ,,spawned". This advice is probably the best I could have got here, thank you. Also your idea of making a weapon with flat bonus based on settings is really nice. Simple (how didn't I think about it before...), fast, giving me some advice on how-to in final version and reusable.(This code can be easily modified to be a base for whole thing)

I was making few things in C# for rimworld before I stopped playing for around half of the year or longer last time. These mods had their own menu section in mod-settings. It wouldn't be any problem for me so I can almost immediately try myself in making that magical sword code.

I have read many tutorials already(long time ago as in few latest days) and wouldn't ask here if they helped me in bringing it to the end. (or even start) It came out with your latest message it was indeed great idea to ask here. Just one thing that I didn't know before doing so is that the item respawns itself with every drop of it.

I think I know everything I need except:
- how exactly am I supposed to change properties of that exact existing in game object in playing time,
- how to save this between loadings of game(or is it rimworld saves itself in the way that just ,,continues" the game state so I wouldn't need to think about it),
- that if there can be two persons with the same name(then if one is dead, item would get bonus just after first creation/spawn, probability is like none but some peoples are using character editor mod in colonist choosing menu, still nearly nobody makes two characters the same but still bug is a bug)
These things are probably something that I'll figure out later without any problem or help needed.

I am going to work now on it for some time, the next time you'll see me I'll probably have it done or got some new problem. For now I am satisfied with all the answers and tips I got there. Thanks to everyone.
#7
Help / Re: Few features I'd like to know how to make
October 14, 2019, 11:16:34 AM
I've found VerbProperties.meleeDamageBaseAmount. (probably it's something else than I think) I am not sure(read: I don't know) how to apply change to this one item object. (sword that is already made and exist in game)
Also as I said before I have no idea how to check if that exact colonist is dead already. (also how to get his ID(?) when he is equipping it for the first time to check later after item is dropped if it's owner has died)

For now I have only this fragment.

namespace The_PlaceholderName_Sword
{
public class BoostOnDeath
{
//public bool isEquipped = false;
//public string owner = "";
BoostOnDeath()
{
if()
{

}
}


}
}
#8
Help / Re: Few features I'd like to know how to make
October 13, 2019, 03:25:29 PM
Okay, as I am not familiar with XML and C#(honestly the only thing I can freely write in is C++) I have a few questions.

The thing I am working on as first is the sword that gets it's stats increased every time it's user dies. (optionaly in battle, or stats increasing only when character stats fits some conditions)
The first problem is that I am not sure how to merge XML and C# in the way that would allow me to write basic strength and multiplier/added stat in xml and let it modify item statistic through C#. Even if it wouldn't be hard, I am not sure how to manage item properties through C#.

It would be helpful to have some mod written with XML and C# to make sword/melee weapon that has stats modified in any way by C# script/program/dll, but I haven't heard about any mod like that or just I was searching wrong for it.

About just the sword idea, I have no name for it yet, also I know it may be easy to exploit(killing manualy your own people with it equipped) but still I think it may be awesome for making stories. (The Legendary Sword that allows you to revenge all previous topclass knights that wielded it before within their own power combined and provide safety to your land.)
Anyway I don't think about giving it any overpowered boost. Small boost that would be noticeable after many wielders defeated in battle.
Question about only one exsisting iteration of an item(to avoid making more of it) was also about this one idea. While still it will have huge cost in resources it may be easily reproduced in later phases of game.
Even though it is only for me (and maybe my friends) I don't want to let myself overuse it in any way.
In my actual one-death save I have one knight and all others with ranged weapon, and that knight has Uranium sword of the latest warrior that had been on his place before. That's why I came up with the idea of this. And I wouldn't play this save anymore until I'll make this idea real.

It was so much about just the idea, shortly said it's just for story purposes.
I was always slowly catching up C# and rimworld XML so I think it isn't the last question here.

Edit. As I think about it, I have to know how to trigger something in moment of moving weapon to the ground when character collapse and check if this character is dead. I'm starting to think it's beyond my searching capabilities.
#9
Help / Few features I'd like to know how to make
October 12, 2019, 04:02:48 PM
I was making just for myself some modded items and buildings and some ideas needed more information than I posess.

The first thing that I wanted to ask for is if it is possible to make item stat change triggered on it's user death with xml, because as I am able to do that with C# I would like to know first whether easier way exists or not.

Second problem: I've been trying to make weapon that damages it's user with each shot while also the projectile goes and do damage to enemy as well. It looked to me like there are only ways to damage your target with weapon, so I am asking here. Can I do that with usage of xml(which I think I should be able) or I need to go for C#?

I wanted one building to produce massive heat as it's downside, so, is that possible to make it less efficient(energy storing/battery) while it's outside? I've been trying to make it immediately exploding if rain touches it but as I saw I couldn't make explosion faster than it is on normal batteries or other machines in rain.

And the last one. Can I somehow limit spawn/creation of an item to one per save or one exist at a time on that world square/colony?

That's all for now. I'll appreciate any help or tips.
#10
Help / Re: Translating defs
May 03, 2018, 09:58:12 AM
Hey, I've tried it all and nothing changed in game.
Actual structure:
├───Defs
│   ├───GameConditionsDef
│   │       Game_conditions.xml
│   │
│   └───Incidents
│           Events.xml

├───Languages
│   ├───English
│   │   └───Keyed
│   │           Text_interface.xml
│   │
│   └───Polish
│       ├───DefInjected
│       │   ├───GameConditionsDef
│       │   │       Game_conditions.xml
│       │   │
│       │   └───Incidents
│       │           Events.xml
│       │
│       └───Keyed
│               Text_interface.xml

Im translating my mod, not game, probably it's why folder names in DejInjected can be any with the same result.
#11
Help / Translating defs
April 29, 2018, 11:59:49 AM
Hey, I have problem with translating my mod defs.
It looks fine but game didn't even notice DefInjected translation files.

├───Defs
│   ├───Cond
│   │       Game conditions.xml
│   │
│   └───Evs
│           Events.xml

├───Languages
│   ├───English
│   │   └───Keyed
│   │           Text_interface.xml
│   │
│   └───Polish
│       ├───DefInjected
│       │   ├───Cond
│       │   │       Game conditions.xml
│       │   │
│       │   └───Evs                          <- here is problem too
│       │           Events.xml
│       │
│       └───Keyed
│               Text_interface.xml

Original Game conditions.xml:
<?xml version="1.0" encoding="utf-8"?>
<Defs>
  <GameConditionDef>
    <defName>HeatApoCon</defName>
<conditionClass>Apocalypse.GameCondition_OverHeatWave</conditionClass>
    <label>Heat Apocalypse</label>
    <description>Apocalypse: Heat.</description>
    <endMessage>You survived the Apocalypse: Heat.</endMessage>
    <canBePermanent>true</canBePermanent>
  </GameConditionDef>

</Defs>

Translated:
<?xml version="1.0" encoding="utf-8" ?>
<LanguageData>
<HeatApoCon.label>Piekielna apokalipsa</HeatApoCon.label>
<HeatApoCon.description>Cała ludzkość jest zagrożona spaleniem żywcem, upewnij się że twoja kolonia jest chłodzona na tyle mocno aby to przetrwać.</HeatApoCon.description>
<HeatApoCon.endMessage>Przeżyliście apokalipsę! Teraz tylko musicie się upewnić że jesteście gotowi na następne wyzwania.</HeatApoCon.endMessage>
</LanguageData>


I'll be grateful for any help. It looks for me very fine and I really dont know what's not ok with this. I've tried all my ideas, everyone fail.
#12
Outdated / Re: [B18] Apocalyptic events
April 28, 2018, 06:09:00 PM
Tomasdav
Copy, paste, save at desktop as ,,great ideas by tomasdav".
Great ideas, but about temperature events, why shouldn't I do both types of them? (my original idea, and your rotation idea with switch in mod options, defaulty set on your) :)

Green revolution is nice idea to make caravans finally really useful. I really want make this, but im not sure that I can do this. (but I'll try) Im not sure too about this permament temperature effect, doesn't permament event/temperature modiffication blocking all other?

Actually I've got some problem with def translation. It looks good but, it doesn't work. If there is someone who know how to make def to def translation, I'll be grateful for help.
#13
Outdated / Re: [B18] Apocalyptic events
April 28, 2018, 01:46:27 PM
Im not good at rimworld, is there someone who like insane challenges? I need some advice/help in balancing. I will change it by myself for now but it'll still be littely unbalanced.
Actually im making it translate'able. Maybe later I'll start working on Apocalyptic Winter.

But still need better descriptions. If someone can send me ,,[description]" for some events, thanks you. (need for heat and winter apocalypse for now)

Tomasdav
It's not for me, it's for peoples who likes extreme dangerous gameplay with many challenges. And in scenario you can disable few events from list, if for example you want to play on ultra heat biome but nothing else, I saw once on reddit person who wants superheat planet mode.
#14
Outdated / Re: [B18] Apocalyptic events
April 28, 2018, 07:26:36 AM
Tomasdav
That's why it need balancing, and why it have public access debug mode.
#15
Outdated / Re: [B18] Apocalyptic events
April 27, 2018, 04:18:37 PM
undereastern
Im not sure that I understand you. Do you mean super cold weather? If yes, it will be added in next update. (,,Apocalyptic Winter" in ,,Soonest update info")