Modding Questions: Are these functions available?

Started by jeeplaw, October 15, 2015, 08:03:34 AM

jeeplaw

So I'm diving back into modding and so far have created a new faction, and a "license to kill" which rewards extra money and xp by the factions for killing pirates.

Now, I'm on to quality of life improvements in the game :)

The first mod is one in which I'm not sure i can even do since it may be hard coded. One of the guys here made a voice mod that replaces the stock game .ogg files with a female named victoria. Love the mod, but it get's too..repetitive. What i want to do is have a randomizer function that picks a random number and chooses from one of several .ogg files associated into an array. That way, she (or any voice really) can be selected from several sayings for that action. That would go along way to making the game seem less static. As of right now, the only way I see to edit the sound file call-out is to change the localization file which specifies the name of the .ogg file.

Is this function possible?

The second mod i want to work on may actually be doable. Because we can monitor (or have objects monitor for on_frame)

"OnEnterFrame"
input:
double: multiplier - time in seconds passed since last frame
Called every frame on server. NOTE: Can be manipulated with scope-script - to make it work not every frame, but every timer interval or definite frames per second.

What I'd like to do is have random "space" chatter come over comms for our ship. So in passing a trader, the system will determine how (dist) from my ship, and within (10) and then "on enter frame), do one of the following (if allowable)-

1) Play from a selection of different .ogg files
or
2) Display on screen a message from the passing trader

and last but not least, a third mod -

Hire a Mercenary.

This mod will be a device based. A Comms Unit that you can purchase. Basically when used it will spawn a random ship type that will follow your ship and be 100% aggressive to anything that is attacking your ship.

I think it's easy to spawn a ship. Not sure yet.

There is one script in the AI folder that I can sort of modify - traderfollower.js ..but i woudn't ever want that ship to dock in a base and disappear :)

-----------------

So 3 different types of mod ideas, and although i'm not asking the dev's here to make them for me, please point me in the direction of saying "yes" it's possible and here are some possible sub routines that you might want to utilize. :)

jeeplaw

Ok, honing in on the Mercenary Hire Mod..think i'll get it done tonight.

Using the following :)

SpawnHelper();



// spawn merc
function SpawnHelper()
{
    //spawn right outside of base
    var id = generator.AddNPCShipToSystem($i0001, "Mercenary", 50, "special_merc_ship", srcSystem, 1000, 1000, {}); // Rocket cruiser

    //set directives
    storage.Set("_system_mercs", "merc_" + id, {
        owner: PLAYER_SHIP,
        command: "follow",
    });

    relations.SetShipFaction(id, "order");
    // make spawned ship to like the player
    relations.SetPersonalDisposition(id, PLAYER_SHIP, 1000);
    generator.DockShipToBase(id, srcBase);
    npc.LeaveBase(id);

 
}

I guess my question is when the device gets used, there is no srcBase if you're out in space. What would be a good way to just generate it within a couple feet of your ship?