Hi there! You are currently browsing as a guest. Why not create an account? Then you get less ads, can thank creators, post feedback, keep a list of your favourites, and more!
Quick Reply
Search this Thread
Test Subject
Original Poster
#1 Old 5th Dec 2014 at 11:03 AM Last edited by tenmang : 5th Dec 2014 at 2:14 PM.
Default script mod: faster rowboat
I want to make a script mod for a rowboat. I'm following those tutors and mod examples
Pure Modding/Objects Modding
How to inject an interaction with a pure script mod
Nectar Glass Replacement mod by icarus_allsorts
Add Inventory Object using Pure Scripts
As far I can make a Object Mod, mean that I clone rowboat object then tie my script to it. and it worked fine.
But I want to make a pure script that modify the in game rowboat. I follow all tutor and check and check but I can't see where is my fault, what i'm missing. Please take a look at my code and point out what's wrong
Code:

using System;
using System.Collections.Generic;
using System.Text;
using Sims3.SimIFace;
using Sims3.Gameplay.Objects.Vehicles;
using Sims3.Gameplay.Actors;
using Sims3.Gameplay.Abstracts;
using Sims3.SimIFace.Enums;
//test add interaction
using Sims3.Gameplay.Interactions;
using Sims3.UI;
using Sims3.Gameplay.Autonomy;

namespace Sims3.Gameplay.Objects.Vehicles.s3gamememodifi
{
public class FastBoatRowBoat : BoatRowBoat
{
[Tunable]
protected static bool kInstantiator = false;
[Tunable]
public static Vehicle.CarTunables kFastRowBoatTuning = new Vehicle.CarTunables();

public FastBoatRowBoat()
{
}
//test add interaction
public sealed class TalktoMe : ImmediateInteraction<Sim, FastBoatRowBoat>
{
public static readonly InteractionDefinition Singleton = new Definition();
protected override bool Run()
{
base.Actor.ShowTNSIfSelectable("" + kFastRowBoatTuning.Speed + "", StyledNotification.NotificationStyle.kSimTalking);
return true;
}
[DoesntRequireTuning]
private sealed class Definition : ImmediateInteractionDefinition<Sim, FastBoatRowBoat, FastBoatRowBoat.TalktoMe>
{
protected override string GetInteractionName(Sim a, FastBoatRowBoat target, InteractionObjectPair interaction)
{
return "Talk To Me";
}
protected override bool Test(Sim a, FastBoatRowBoat target, bool isAutonomous, ref GreyedOutTooltipCallback greyedOutTooltipCallback)
{
return !isAutonomous;
}
}
}
public override void OnStartup()
{
base.OnStartup();
base.AddInteraction(TalktoMe.Singleton);
}

//IBoat Members
//getover IBoatNotUsuallyUsedForTransportation issue ship retune to shore if long distance
public override Sim.WalkStyle GetBoatWalkStyle(bool isSlow)
{
return Sim.WalkStyle.Sailboat;
}
public override bool IsSlaveRoute(ref List<GameObject> slaveRiders, ref bool bSlavesRoute, Route processedPath)
{
return false;
}
//faster rowboat? @no?
public override Vehicle.CarTunables CarTuning
{
get
{
return kFastRowBoatTuning;
}
}
/* whywhy
public override BoatType GetBoatType()
{
return BoatType.Paddleboat;
}*/
}
}

The tutors write about
Code:
World.OnWorldLoadFinishedEventHandler += new EventHandler(doingsomething);

but I dont think I need it and I also dont know how to use it in my case. The ingame rowboat dont know about my script.
Thanks for your help.

edit: here is xml tuning, id of it is namespace.class 64 hash. i'm carefully :-D
Code:
<?xml version="1.0" encoding="utf-8"?>
<base>
  <Current_Tuning>
    <kInstantiator value="True" />
    <kFastRowBoatTuning>
      <Speed value="67.5">
        <!-- 4/5 Car speed in meters / second (second = Sim minute).-->
      </Speed>
      <Acceleration value="18.75">
        <!-- 1/25 Car acceleration in meters / second^2 (second = Sim minute).-->
      </Acceleration>
    </kFastRowBoatTuning>
  </Current_Tuning>
</base>
Advertisement
Inventor
#2 Old 5th Dec 2014 at 1:12 PM Last edited by Arsil : 5th Dec 2014 at 2:03 PM.
You need the EventHandler. Try reading again the pure scripting mod tutorial.

There are currently other two threads going on that talk about this, check those
too, one was started by chazyra and the other by CrazySheep808 (maybe in this
one there's not what you need, but if you are getting started could be useful).

Out of curiosity, I took a quick look at the RowBoat code and didn't find anything
related to the speed. You said you were successful cloning the boat and using
your script, what did you change in the code to adjust the speed?
Test Subject
Original Poster
#3 Old 5th Dec 2014 at 2:05 PM Last edited by tenmang : 7th Dec 2014 at 3:10 AM.
Quote:
You need the EventHandler. Try reading again the pure scripting mod tutorial.

i dont think so. i dig into some example mods and i cant find this too. beside i dont know how to use this in my case. can you please explain more detail on how i use it in my case?

Quote:
There are currently other two thread that talk about this, check those too, one
was started by chazyra and the other by CrazySheep808.

is this thread Workout / Train other Sim costs Money by chazyra ? i cant find the thread by CrazySheep808

Quote:
Out of curiosity, I took a quick look at the RowBoat code and didn't find anything
related to the speed. You said you were successful cloning the boat, what did you
change in the code to adjust the speed?

Edited: so sorry the method is GetBoatWalkStyle
/*
public override Sim.WalkStyle GetBoatWalkStyle(bool isSlow)
{
return Sim.WalkStyle.Sailboat;
}
*/
This, will use for the boat routing + boat animation. So rowboat go fast like sailboat, sim just sit in boat hand on the paddle and do nothing. I have to do something to fix this issue. why do they do this stu***
At first, i see paddleboat, taxiboat can change speed in xml tuning, so i make one for rowboat. but rowboat dont use it
Inventor
#4 Old 5th Dec 2014 at 2:23 PM Last edited by Arsil : 5th Dec 2014 at 2:58 PM.
Quote: Originally posted by tenmang
i dont think so. i dig into some example mods and i cant find this too. beside i dont know how to use this in my case. can you please explain more detail on how i use it in my case?

It's needed to make a "pure scripting mod". Since your code is not "attached" to an object
through an OBJK resource that references your script, you have to somehow tell the game to
use your code. You better re-read carefully the tutorial, it explains that better than I can ever do.

is this thread Workout / Train other Sim costs Money by chazyra ?

Yes. It's a good thread if you are a beginner (I consider myself a beginner, so don't
get offended by that). You'll find also medium/advanced level stuff, but that has been
written using the spoiler tag, you can skip that if you are not interested in it at the moment.

public override BoatType GetBoatType()
{
return BoatType.Sailboat; // or some boat that go fast
}


I see. That probably doesn't change only the speed, but also other features of the boat,
maybe that's why you are getting those issues.

EDIT: before starting to make a mod for this, try to see if there's a way to change only
the speed, or you may do a lot of work for nothing.
Test Subject
Original Poster
#5 Old 7th Dec 2014 at 3:22 AM
@icarus_allsorts, someone know him please please tell him to take a look at this thread
because what i want to do is very similar to his Nectar Glass Replacement pure script mod
thank you
Field Researcher
#6 Old 7th Dec 2014 at 6:37 AM
The Nectar Glass Repacement mod works because as far as I could find there happens to be only ONE way nectar glasses are created in game, and that is when a sim uses the interaction to pour nectar from bottles, so I only had to change that interaction to create my custom object instead of the default ones.

To do something similar in your case you'd have to find every case in the code that would result in a rowboat being created in game, which would include one being bought in buy mode and the game creating one for npc routing and try changing those portions of code... which as far as I can tell is probably impossible without a core mod. So cloning the rowboat and making a scripted object with it like you originally tried is probably your best bet. As Arsil mentions it's likely changing the GetBoatType() method results in sims not rowing the boat while riding in it so try leaving that alone in your script and see how it goes.
Test Subject
Original Poster
#7 Old 7th Dec 2014 at 10:10 AM Last edited by tenmang : 7th Dec 2014 at 10:22 AM.
Quote:
The Nectar Glass Repacement mod works because as far as I could find there happens to be only ONE way nectar glasses are created in game, and that is when a sim uses the interaction to pour nectar from bottles, so I only had to change that interaction to create my custom object instead of the default ones

yea im missing this one so the ingame rowboat dont know about my pure script

Quote:
you'd have to find every case in the code that would result in a rowboat being... routing and try changing those portions of code... which as far as I can tell is probably impossible without a core mod

thank you for this information, im trying this first. but if it cant be done by pure mod then how can object mod do and i dont want core mod. pour me!
Test Subject
Original Poster
#8 Old 27th Dec 2014 at 3:05 AM
hello i'm again. i dont want to give up because i just want to use rowboat to travel around the island. im just a amateur so if someone interest plz help me create this mod :-D
Test Subject
Original Poster
#9 Old 27th Dec 2014 at 3:30 AM Last edited by tenmang : 30th Dec 2014 at 3:41 AM.
so far im trying new approach that create a new Boat (don't inherit from BoatRowBoat) to see if it can use a Speed tuning from xml like paddleboat or taxiboat
Code:
namespace Sims3.Gameplay.Objects.Vehicles
{
    public class FastBoatRowBoat : BoatMultipleOccupancy, IFishingCapableBoat, IBoat, IGameObject, IScriptObject, IScriptLogic, IHasScriptProxy, IObjectUI, IExportableContent
    {
        [Tunable]
        public static Vehicle.CarTunables kFastRowBoatTuning = new Vehicle.CarTunables();
        static FastBoatRowBoat()
        {
        }
        public override Vehicle.CarTunables CarTuning
        {
        }
        /* Testing Interaction to get the xml tuning speed */
        public sealed class TalktoMe : ImmediateInteraction<Sim, FastBoatRowBoat>
        {
        }
        public override void OnStartup()
        {
            base.OnStartup();
            base.AddInteraction(TalktoMe.Singleton);
        }

        /* Implement all BoatRowBoat functions */
        /* Implement all Boat functions */
    }
}

in game i can buy it, pick it up to inventory, set prefer boat interaction. but i can not use talktome interaction, boat here interaction. it generate script error System.NullReferenceException: A null value was found where an object instance was required.
so i create a object in static method
Code:
        static FastBoatRowBoat()
        {
            GlobalFunctions.CreateObjectOutOfWorld("FastBoatRowBoat", ProductVersion.EP10);
        }

and create NGMP resource in the package file for it
but it don't work. it still say object instance was required. i dont know where and how to put the create object function :-D

edit: sorry forget this. i change the name space as SimsMatthew suggest then no need to CreateObjectOutOfWorld
but this new Boat (don't inherit from BoatRowBoat) still dont use a xml Speed tuning
Instructor
#10 Old 27th Dec 2014 at 3:55 AM
1. Namespace: prefix with Sims3.Gameplay.Objects then your own unique name. Don't use EA class.
In my example: Sims3.Gameplay.Objects.Simsmatthew

2. You seem to mix up stuff with object mods and script mods. An object does not have the static method. Delete that.

3.
Code:
  public override Vehicle.CarTunables CarTuning
        {
            get
			{
				return FastBoatRowBoat.kFastRowBoatTuning;
			}
        }


You need to return something as your new Tuning. Then create the XML file, while changing the speed values, which the script reads.

4. There's no point for NGMP I think. You just clone your object in S3OC, add in the XML, and a script that calls for that XML, and change the OBJK resource to use that script for your new object only.

5.
Code:
public override Vehicle.CarTunables CarTuning

There's no point in writing {}.

6. Remove the TalkToMe interaction.

7. Try the following:
Code:
public class FastBoatRowBoat : RowBoat
{
        [Tunable]
        public static Vehicle.CarTunables kFastRowBoatTuning = new Vehicle.CarTunables();
        public override Vehicle.CarTunables CarTuning
        {
            get
			{
				return FastBoatRowBoat.kFastRowBoatTuning;
			}
        }
}     


Can it work by just overriding the Tuning file?
Test Subject
Original Poster
#11 Old 27th Dec 2014 at 6:38 AM
Quote: Originally posted by SimsMatthew
7. Try the following:
Code:
public class FastBoatRowBoat : BoatRowBoat
{
        [Tunable]
        public static Vehicle.CarTunables kFastRowBoatTuning = new Vehicle.CarTunables();
        public override Vehicle.CarTunables CarTuning
        {
            get
			{
				return FastBoatRowBoat.kFastRowBoatTuning;
			}
        }
}     

Can it work by just overriding the Tuning file?

it's long story. this is the first approach i tried but somehow it don't use the xml tuning (i can get the xml value). i think rowboat type don't use tuning speed. that why i try new approach that is in the newest post
Quote:
6. Remove the TalkToMe interaction.

it's just the testing interaction i add to get the xml tuning value in game. i will remove at last
Quote:
5.
Code:
public override Vehicle.CarTunables CarTuning

There's no point in writing {}.

sorry it just a code model. i dont post actual code because it's long
Quote:
1. Namespace: prefix with Sims3.Gameplay.Objects then your own unique name. Don't use EA class.
In my example: Sims3.Gameplay.Objects.Simsmatthew
2. You seem to mix up stuff with object mods and script mods. An object does not have the static method. Delete that.

yes im trying object mods with their own script
Quote:
3.
Code:
  public override Vehicle.CarTunables CarTuning
        {
            get
			{
				return FastBoatRowBoat.kFastRowBoatTuning;
			}
        }

You need to return something as your new Tuning. Then create the XML file, while changing the speed values, which the script reads.

sorry i dont understand you. i return kFastRowBoatTuning as new tuning which is already create in xml file
Quote:
4. There's no point for NGMP I think. You just clone your object in S3OC, add in the XML, and a script that calls for that XML, and change the OBJK resource to use that script for your new object only.

yep i think of NGMP when i try CreateObjectOutOfWorld. i will remove if it dont need then

long story. here is all approach i tried:
1/ object mod that inherit BoatRowBoat: worked
- do not use Speed in xml tuning
- can add interaction
- can change issue that rowboat don't go long distance
- can change boatType that use for speed + animation -> so it is useless
2/ pure mod: i failed
3/ object mod that create a Boat to see if it can use Speed tuning (in post #8) then to see if it can use rowing animation
phew i appreciate my patient. i admit im a amateur and think about giveup :-D. i appreciate if someone can create this. people will like a faster rowboat :-D
Instructor
#12 Old 27th Dec 2014 at 7:11 AM
You override the Vehicle.CarTunable but you didn't give a new XML back. You need to return something.

I'd say that you'd better start off from scratch. Question number 1: where is the rowboat speed controlled? In XML? In script? If so, where?
Instructor
#13 Old 27th Dec 2014 at 7:16 AM
Forgive me for double posting since I've got to make this clear:

the TalkToMe interaction doesn't contain any Run() method nor definition. That won't show up to be honest. There's no need to cut off code. It means others difficult to read and understand.
Test Subject
Original Poster
#14 Old 2nd Jan 2015 at 8:17 AM
Quote: Originally posted by SimsMatthew
Question number 1: where is the rowboat speed controlled? In XML? In script? If so, where?

1/ A boat use Speed xml tunning on method OnRouteStarted() which parent method Vehicle.OnRouteStarted() will call method SetCarSpeed(). But I only see PaddleBoat, TaxiBoat have xml tuning. I tried to create one for RowBoat but it dont Use this speed, can not identify why (i can get xml speed value in game but rowboat just dont use it)
3/ IsSlaveRoute () return false will make Rowboat go for long distance
2/ Method GetBoatWalkStyle() + IsSlaveRoute() (must have, otherwise change GetBoatWalkStyle will do nothing) will change boat speed + boat animation.
those are just the upper code i can find. i can not find the deeper code that actually do thing.
maybe you can help.
Instructor
#15 Old 9th Jan 2015 at 2:46 AM
Sorry didn't notice your reply.

Since I have a handful of projects ongoing I can't dig in deep with you.

Is any of the above method marked abstract, virtual, or override? If so, try overriding the method and replace the part you identified as marking the boat speed with one that calls your value.
Back to top