PDA

View Full Version : My first mod...


dlane2155
7th Dec 2011, 10:31 PM
So I would like to create a vampire mod of my own as I don't really like how the vampires are in the game and I don't really like the vampire mods that have been released. I have never made any of my own mods to sims 3 but there is a first for everything.

If anyone could help me out I would appreciate it. I have the game patched to 1.26.

Here is what will go into the mod... I hope.

Step 1. Lapis Lazuli (Gem from China WA expansion) will block heating up moodlet for vampires when in inventory.

Step 2. A custom plant will need to be created called "Vervain" or "Verbena." It will need to have a seed, be plant-able, and harvest-able.

Step 3. If a human has vervain in their inventory they will get a custom moodlet.

Step 4. If a human eats or drinks vervain they will get a different custom moodlet for 3 days.

Step 5. Vampires will not be able to read minds anymore.

Step 6. Vampires will be able to condemn humans. Condemning will be the same as convincing someone to do something like in the clubs. They will have this ability at all hours of the day and at any location. If the sim, the vampire is trying to condemn, is a human they will always do what the vampire says, unless the human sim has the moodlet in Step 3 or the moodlet in Step 4. If the human has either of those moodlets then the human will only do what the vampire says if they normally would. Additionally vampires may try to condemn other vampires but it will work the same way that if it's a human sim with either of the two custom moodlets.

Step 5. If a vampire bites a human with the moodlet in Step 4 they will get a custom moodlet of their own taking away their vampire speed and condemning ability. Additionally it will deplete their thirst and energy motives. Possibly their skin will sizzle like the too much sun buff, but for 30 sim minutes to an hour.

Step 6. Create a custom book/journal that once read by a human sim will make it so that if they are NPC they will get vervain placed in their inventory. Similar to the way NPC vampires receive plasma fruit in their inventory.

Step 7. Create another custom object (looks like a pocket watch) that when in anyone's inventory will show the map tags of all vampires. Theoretically with an on and off option.

Step 8. One more custom object that when in a certain range of vampires will make them pass out. The object must also be in a sims inventory and will have an on and off option as well. If the device is in a vampires inventory and turned on it will still make that vampire pass out.

I'm sure some have figured out that I'm trying to make the vampires in the game similar to the Vampire Diaries.

Current Phase: Step 1

Thanks in advance!

porkypine
8th Dec 2011, 05:49 PM
I don't have experience in this sort of modding but have you taken a look at the xml tuning?

dlane2155
8th Dec 2011, 06:46 PM
I don't have experience in this sort of modding but have you taken a look at the xml tuning?

Yes and I already understand how to tune the game. I just cannot find the part of the package that tells the game when to trigger what buffs.

I can easily make it so the heating up buff will never happen but I want to make it so it doesn't happen only if the vampire sim has a certain object in their inventory.

I am not even sure if that would be considered a tuning mod or maybe its a core mod?

dlane2155
8th Dec 2011, 08:53 PM
Okay I did some more poking around and in Sims3GamplaySystems.dll I found the following:

private class FlameFruitItemComponent : IngredientItemComponent
{
// Methods
public FlameFruitItemComponent();
public FlameFruitItemComponent(GameObject o, List<Type> validInventories);
public override void Dispose();
protected override void OnAddToInventory(Inventory inventory);
public override void OnRemoveFromInventory(Inventory inventory, bool bFromDispose);
public void UpdateCozyFireBuffCounter(Inventory inventory, int delta);
}


Expand Methods

How do I create something similar for when the "Lapis Lazuli" gem is added to the inventory?

cmasta
8th Dec 2011, 09:13 PM
Okay I did some more poking around and in Sims3GamplaySystems.dll I found the following:



How do I create something similar for when the "Lapis Lazuli" gem is added to the inventory?

If i'm not mistaken. You will probably need to hook the onobjectaddedtoinventory event or something along those lines then when that event is called check the object's name for the lapis lazuli. If it is the right gem then you can issue your script then and there.

dlane2155
9th Dec 2011, 04:34 PM
If i'm not mistaken. You will probably need to hook the onobjectaddedtoinventory event or something along those lines then when that event is called check the object's name for the lapis lazuli. If it is the right gem then you can issue your script then and there.

How do I do something like that? That would not be considered an xml mod would it?

cmasta
9th Dec 2011, 08:05 PM
How do I do something like that? That would not be considered an xml mod would it? Yeah its much more than xml, however its not very hard to script. The scripting tutorial on here basically tells you how to hook events. Which is what you need to do.

dlane2155
9th Dec 2011, 09:04 PM
Yeah its much more than xml, however its not very hard to script. The scripting tutorial on here basically tells you how to hook events. Which is what you need to do.

Okay thanks. I will look into it. I don't think I'll be able to figure it out though. I have no knowledge of programing. Hopefully I can pick it up fairly easily though, as this isn't the first time I could have used that knowledge.

dlane2155
10th Dec 2011, 12:05 AM
Okay I think I am making some progress... maybe. Here is the coding I have made so far.

using System;
using System.Collections.Generic;
using System.Text;
using Sims3.SimIFace;

namespace dlane2155
{
public class Lapuzi : Gem
{
// Fields
private const uint kFootprintHash = 0x19015316;

// Methods
static Lapuzi();
public Lapuzi();
public override void Dispose();
protected override void DoReset(GameObject.ResetInformation resetInformation);
private void OnAddToIventory(IGameObject objAdded, Inventory inventory)
{
if (base.CutName != null)
{
Sim owner = inventory.Owner as Sim;
if (owner != null)
{
if (inventory.FindAll<Lapuzi>(false).Count == 1)
{
owner.BuffManager.RemoveElement(BuffNames.HeatingUp);
}
}
}
}
private void OnRemoveFromInventory(IGameObject objAdded, Inventory inventory)
{
if (base.CutName != null)
{
Sim owner = inventory.Owner as Sim;
if ((owner != null) && !inventory.ContainsType(typeof(Lapuzi), 1))
{
if (owner.BuffManager.GetElement(BuffNames.HeatingUp) == null)
{
owner.BuffManager.AddElement(BuffNames.HeatingUp);
}
}
}
}
public override void OnStartup();
}



}


Basically all I have done is taken a combination of the flame fruit and tiberium and removed what I did not think was necessary like tiberium growth and the benefits for flame fruit.

Visual C# 2008 is saying I have 9 errors. I'm not sure what I need to do to fix them, but it's saying the following:

Error 1 'object' does not contain a definition for 'CutName'
Error 2 The type or namespace name 'Sim' could not be found (are you missing a using directive or an assembly reference?)
Error 3 The type or namespace name 'Sim' could not be found (are you missing a using directive or an assembly reference?)
Error 4 The name 'BuffNames' does not exist in the current context
Error 5 'object' does not contain a definition for 'CutName'
Error 6 The type or namespace name 'Sim' could not be found (are you missing a using directive or an assembly reference?)
Error 7 The type or namespace name 'Sim' could not be found (are you missing a using directive or an assembly reference?)
Error 8 The name 'BuffNames' does not exist in the current context
Error 9 The name 'BuffNames' does not exist in the current context

I realize some of these are repetative.

Here are my new questions. How do I make this applicable to the Lapis Lazuli gem? Preferably the gem must be cut, but it can be any cut. The only thing I found for the Lazuli using reflector is Lazuli = 0x398a0028a65fa9f3L. I have no idea what this means.

Also what does "null" in these cases mean?

For the one below I'm assuming it means all sims... is that correct?

Sim owner = inventory.Owner as Sim;
if (owner != null)

If so can I replace "null" with "vampire"?

Another thing is what is kFootPrintHash?

Also how do I fix the other errors?

I apologize for sounding like a noob, but I am one.

Again thanks for any help!

Buzzler
10th Dec 2011, 12:27 PM
Visual C# 2008 is saying I have 9 errors. I'm not sure what I need to do to fix them, but it's saying the following:{...}Your code is lacking using directives, so the compiler doesn't know what you're talking about.

Take error 2 for example: "Sim" should be underlined in red in the related code. Right-click on it, click on "Resolve" and then "using Sims3.Gameplay.Actors" (or something the like). "using Sims3.Gameplay.Actors" should be added to the using directives at the top of your code and the compiler will now know what you mean when you say "Sim". :)

Also what does "null" in these cases mean?Null basically means "no value" in C#. So "if (owner != null)" basically means "if the variable 'owner' contains something".

Another think is what is kFootPrintHash?Probably the instance id of the resource containing the object's footprint, but I don't know for sure and would need to investigate as well.

dlane2155
10th Dec 2011, 03:06 PM
Thanks Buzzler. I have some of it figured out now. Now when I attempt to build it some new errors are showing up. Here is my code:

using System;
using System.Collections.Generic;
using System.Text;
using Sims3.SimIFace;
using Sims3.Gameplay.Actors;
using Sims3.Gameplay.ActorSystems;
using Sims3.Gameplay.Objects.Spawners;
using Sims3.Gameplay.Abstracts;
using Sims3.Gameplay.Interfaces;
using Sims3.Gameplay;

namespace dlane2155
{
public class Lazuli : Gem
{
// Fields
private const uint kFootprintHash = 0x19015316;

// Methods
static Lazuli();
public Lazuli();
public override void Dispose();
protected override void DoReset(GameObject.ResetInformation resetInformation);
private void OnAddToIventory(IGameObject objAdded, Inventory inventory)
{
if (base.CutName != null)
{
Sim owner = inventory.Owner as Sim;
if (owner != null)
{
if (inventory.FindAll<Lazuli>(false).Count == 1)
{
owner.BuffManager.RemoveElement(BuffNames.HeatingUp);
}
}
}
}
private void OnRemoveFromInventory(IGameObject objAdded, Inventory inventory)
{
if (base.CutName != null)
{
Sim owner = inventory.Owner as Sim;
if ((owner != null) && !inventory.ContainsType(typeof(Lazuli), 1))
{
if (owner.BuffManager.GetElement(BuffNames.HeatingUp) == null)
{
owner.BuffManager.AddElement(BuffNames.HeatingUp);
}
}
}
}
public override void OnStartup();
}
}


The new errors are:

'dlane2155.Lazuli.Lazuli()' must declare a body because it is not marked abstract, extern, or partial
'dlane2155.Lazuli.Dispose()' must declare a body because it is not marked abstract, extern, or partial
'dlane2155.Lazuli.DoReset(Sims3.Gameplay.Abstracts.GameObject.ResetInformation)' must declare a body because it is not marked abstract, extern, or partial
'dlane2155.Lazuli.OnStartup()' must declare a body because it is not marked abstract, extern, or partial

I have underlined the errors (this time they are underlined in purple.) What do they mean and how do I fix them?

Besides this and the footprinthash I think I may have figured this out.

Thanks!

Odistant
11th Dec 2011, 07:19 AM
You might be better off at making a clone of the gem and then making a script instead of trying to change the exisiting one. This can be done by deriving from the Lazuli class and overriding some of the methods and implementing your own. Right now it seems like you are trying to copy and paste and hope it works.

dlane2155
11th Dec 2011, 04:18 PM
You might be better off at making a clone of the gem and then making a script instead of trying to change the exisiting one. This can be done by deriving from the Lazuli class and overriding some of the methods and implementing your own. Right now it seems like you are trying to copy and paste and hope it works.

Yes you are correct I have mostly copied and pasted. I have tried to find the gems in s3oc but all I can find are the gem spawners. If it was in there I think if would be simple. All I would have to do is add the on add to inventory and on remove from inventory and all should work fine. I wouldn't have to have all the other lines... I think.

I'm not really sure how to do all this.

Buzzler
11th Dec 2011, 05:50 PM
'dlane2155.Lazuli.Lazuli()' must declare a body because it is not marked abstract, extern, or partial
'dlane2155.Lazuli.Dispose()' must declare a body because it is not marked abstract, extern, or partial
'dlane2155.Lazuli.DoReset(Sims3.Gameplay.Abstracts.GameObject.ResetInformation)' must declare a body because it is not marked abstract, extern, or partial
'dlane2155.Lazuli.OnStartup()' must declare a body because it is not marked abstract, extern, or partialUm, you don't actually know what a (method) body is, do you? If that's the case, I'd strongly recommend to learn basic syntax and semantics of C# before you continue.

I have underlined the errors (this time they are underlined in purple.) What do they mean and how do I fix them?That public override void OnStartup();is a method declaration without implementation. A "head" (signature) without a body. Methods that aren't marked abstract, extern or partial need a body: public override void OnStartup()
{
// Some code here
}Why do you even override methods like DoReset() and Dispose()? No offense, but it may still be a bit until you figured out, you know?

This can be done by deriving from the Lazuli class and overriding some of the methods and implementing your own.Gem is *the* actual class for all gems except Tiberium. No point in searching for any other derived classes. There aren't any.

dlane2155
11th Dec 2011, 06:40 PM
I'd strongly recommend to learn basic syntax and semantics of C# before you continue.

I'd have to agree with you as I think I am more confused now than before.

Would this be easier to create my own object and make it so when that is placed in the inventory it triggers the buff, or is it about just as complicated as changing an object already in the game?