Fractal Softworks Forum

Starsector => Mods => Modding => Topic started by: Ranakastrasz on March 28, 2014, 03:18:43 PM

Title: Request info for Command point Alterations
Post by: Ranakastrasz on March 28, 2014, 03:18:43 PM
I am attempting to create a mod altering some aspects of combat, namely the command point system.

I need to be able to do several things and cannot currently locate any examples to work off of.
(If examples exist, would appreciate being pointed at them)

Need to be able to allow command point usage to be freely manipulated. There are a number of conditions for what cost what I want to alter, if possible.
~So as to allow all orders wanted to be issued on warping in, but not once battle is joined.

I need to be able to run a timer in battle to alter command points over time.
Want to also be able to get the timers remainder if a node is captured so as to allow it to be refreshed with the shorter duration.

I need to be able to detect command points being spent, as well as all ships involved, and the type of order.

I need to be able to determine which ship is currently the player/commander.

Want to be able to create a buff that disables a ships's AI while active. It will still continue flying and firing as is at the time.

Title: Re: Request info for Command point Alterations
Post by: dmaiski on March 28, 2014, 04:45:35 PM
http://fractalsoftworks.com/forum/index.php?topic=7164.0

all you need is there, get reading...

how2StarsectorModdingInOneWeekend
Spoiler
it can be done, but it will take at least a day or two of mad scientist level "must java, eat later, SLEEP LATER, COFFEE!!!!" if you want to get it to work as i imagine you do

searching the forums for answers to specific questions and borrowing ideas for how to do "X" from other mods also helps
(i play SOME mods mostly so i can pull their code and disect it for !!SCIENCE!!)

also get an IDE, i sudgest IDEA (http://www.jetbrains.com/idea/download/) just cause its java newbie friendly

once that is done, all thats left is to code what you want, pull a leaver and scream:
(http://www.sourballpython.com/blog/wp-content/uploads/2013/10/ItsAlive.jpg)
[close]


Title: Re: Request info for Command point Alterations
Post by: Tecrys on March 28, 2014, 04:57:26 PM
http://fractalsoftworks.com/forum/index.php?topic=7164.0

all you need is there, get reading...

how2StarsectorModdingInOneWeekend
Spoiler
it can be done, but it will take at least a day or two of mad scientist level "must java, eat later, SLEEP LATER, COFFEE!!!!" if you want to get it to work as i imagine you do

searching the forums for answers to specific questions and borrowing ideas for how to do "X" from other mods also helps
(i play SOME mods mostly so i can pull their code and disect it for !!SCIENCE!!)

also get an IDE, i sudgest IDEA (http://www.jetbrains.com/idea/download/) just cause its java newbie friendly

once that is done, all thats left is to code what you want, pull a leaver and scream:
(http://www.sourballpython.com/blog/wp-content/uploads/2013/10/ItsAlive.jpg)
[close]




Man, I'm glad you're back. I read a lot of the stuff you did so far, you crazy bugger. Really nice to actually see you on the forums.

@Ranakastrasz: You can try to bash code together like I do. Let's say I'm the cave man type of a modder, I put the square through the triangle in kindergarten and even succeed.
But beware, codebashing can be frustrating if stuff doesn't do what you want and you can't tell why which happens more often then not.
Title: Re: Request info for Command point Alterations
Post by: Ranakastrasz on March 28, 2014, 08:22:10 PM
Oh sure, I know it can be frustrating.
Spent tons of time in Warcraft 3 modding, back when it was more active.

Still, it takes a lot more effort when you don't have any existing examples or documentation on what something does already.
If you already have something related, altering it can get your close.

Already had that link, or knowledge of it, and it has been useful in the past. Still can't really figure out ever how the timer type effects work however, which is the largest problem i've had.

Most likely most of that is explained in there.
Title: Re: Request info for Command point Alterations
Post by: dmaiski on March 29, 2014, 04:46:34 AM
Code: java
public class AAA implements YYYPlugin{

    //declare you are using interval util
    private IntervalUtil XXXTimer = new IntervalUtil(Minimum interval, Maximum interval); //in seconds

    //is the timer on or off at the start of the game?
    condition ZZZ =true/false ;

    @Override
    public void advance(float amount){

        if (engine.isPaused()) //so it does not run while game is paused
        {
            return;
        }

        if (condition ZZZ == true) { //will only count time if some condition has been met
        XXXTimer.advance(amount); //will count the time using "amount" wich is basicly frame duration

        //in here also goes you code for while (condition ZZZ == true)
        }

        if (XXXTimer.intervalElapsed())  //timer has reached end
        {
        //your code when timer has ended
        condition ZZZ = false; //optional, ends timing of events untill it is once again set to true
        }

        //if you need it to detect when something has happened to trigger the timer event
        if (NNN = true) //condition that needs to be met for (condition ZZZ = true) only ocurs if (condition ZZZ == false)
        //your code when timer activates
        condition ZZZ = true; //activate timer
        }

    }
}

basics of how to use IntervalUtil