PDA

View Full Version : [SOLVED] Help with ReactionBroadcaster tuning


MDM
23rd May 2012, 6:36 PM
So, I recently added Reactions to my 'Insane Sims Madness' mod and everything works fine, but I'm not satisfied with its default parameters (ReactionBroadcasterParams) and I would like to change 2 specific values, but only for my interactions.

I tried a few combinations but I can't get it to work. Mainly I tried to create my own class with the changed values, which is something like this :

public class InsaneBroadcasterParams
{
public float PulseRadius = 8f;
public int PulseRepeatTime = 60;
}
But after this, I don't know what to do, because it gives me tons of errors since I'm doing it wrong.
It probably is something very simple but I can't figure it out :(

Can someone please help me with this?

Cherry92
24th May 2012, 7:04 AM
May be you should inherit your params class from the original one, and override the instance field/properties/methods that you want to change,
then in your interaction, you should use InsaneBroadcasterParams at anywhere you used ReactionBroadcasterParams,
I'm not quite sure, but I've did something very similar in my mods, hope that will work for you too :)

MDM
24th May 2012, 11:29 AM
May be you should inherit your params class from the original one, and override the instance field/properties/methods that you want to change,
then in your interaction, you should use InsaneBroadcasterParams at anywhere you used ReactionBroadcasterParams,
I'm not quite sure, but I've did something very similar in my mods, hope that will work for you too :)

That is exactly what I did at first but the game is not using them. So I tried a workaround, I made a copy of the InsaneBroadcasterParams class with my values inside after inheriting it from the original one and VS told me that those values are note being used.
This means that I'm failing to implement it properly.

this.InsaneBroadcaster = new ReactionBroadcaster(this.Actor, kInsaneBroadcasterParams, new ReactionBroadcaster.BroadcastCallback(OnWitnessInsaneInteraction));

This is what I use to call it, the problem being that I have no clue how to assign something to kInsaneBroadcasterParams, should I focus on the OnWitnessInsaneInteraction method instead?

Cherry92
24th May 2012, 12:34 PM
I've looked around your code, I think one of the dirty tricks would be changing the value inside directly...? Something like that?

public static ReactionBroadcasterParams kInsaneBroadcasterParams = new ReactionBroadcasterParams();
... blah blah blah
kInsaneBroadcasterParams.PulseRadius = 8f;
kInsaneBroadcasterParams.PulseRepeatTime = 60;
However, I don't know when the tunable value would be applied, and I'm not familiar with this kind of coding, I just do it by trials and error :faceslap:

MDM
24th May 2012, 12:54 PM
I've looked around your code, I think one of the dirty tricks would be changing the value inside directly...? Something like that?

public static ReactionBroadcasterParams kInsaneBroadcasterParams = new ReactionBroadcasterParams();
... blah blah blah
kInsaneBroadcasterParams.PulseRadius = 8f;
kInsaneBroadcasterParams.PulseRepeatTime = 60;
However, I don't know when the tunable value would be applied, and I'm not familiar with this kind of coding, I just do it by trials and error :faceslap:

Yeah, that's what I do too cos I'm not that familiar as well, I just started :P

Anyway, when I do that, VS gives me a warning that those values are not being used (like I said in the previous post).
Now I'm in the process of optimizing the script code, so I'll keep trying with different solutions.
Thanks for the tips, I hope something can be done to solve this :)

Cherry92
24th May 2012, 1:13 PM
Ooops, then I can't help :P

I don't know if that's also exactly what you did,
I thought this would work :rolleyes:


public class InsaneBroadcasterParams : ReactionBroadcasterParams {
public InsaneBroadcasterParams () {
blah blah blah....
}
}

public class Tuning {
public static InsaneBroadcasterParams kInsaneBroadcasterParams = new InsaneBroadcasterParams();
}

MDM
24th May 2012, 3:37 PM
Ooops, then I can't help :P

I don't know if that's also exactly what you did,
I thought this would work :rolleyes:



Nope, it doesn't, VS gives no errors but changes aren't visible ingame. It's probably ignoring them and using its own instead, so there must be something else I must add to make it work.

If I inherit I get warnings about inherited members being hidden and changes aren't visible ingame.
If I try to make a new class with my new values assigned, no warnings but changes aren't visible ingame.
If I directly force my values inside the ReactionBroadcaster class, I get warnings that those values aren't being used and changes aren't visible ingame.

As far as my knowledge goes, no other options come to mind :(

MDM
24th May 2012, 6:26 PM
YES! YES!

I got it working, my code was perfect as it was, all it needed was a XML with changed values and now it works great :beer:

Thanks for your help anyway, I appreciated it :)