API Feedback and Suggestions

Discussion in 'Empyrion API' started by Jascha, Mar 8, 2017.

  1. LiftPizzas

    LiftPizzas Rear Admiral

    Joined:
    Sep 28, 2015
    Messages:
    1,434
    Likes Received:
    2,573
    How do I make a console request? The wiki is for the legacy stuff and I can't find anything in the forums here either.

    if (modApi.Application.LocalPlayer.BodyTemp > 50.0)
    {
    //kill the player
    }
     
    #381
  2. Taelyn

    Taelyn Guest

    With the old api (legacy). Dont think the new api has it added. Not yet atleast.

    I'll look it up tomorrow

    Quickly got this.

    If you need to execute on another player, a mod that creates the RemoteEx request for you.
     
    #382
  3. Mortlath

    Mortlath Commander

    Joined:
    Jul 26, 2017
    Messages:
    49
    Likes Received:
    26

    Can you share the console command?
     
    #383
  4. Mortlath

    Mortlath Commander

    Joined:
    Jul 26, 2017
    Messages:
    49
    Likes Received:
    26
    Is there a way to spawn NPCs via console command?
     
    #384
  5. Taelyn

    Taelyn Guest

    Type help give if you out a - confront of the number it removes rad, hp etc etc

    No. The NPCs cant be controlled in any way
     
    #385
  6. LiftPizzas

    LiftPizzas Rear Admiral

    Joined:
    Sep 28, 2015
    Messages:
    1,434
    Likes Received:
    2,573
    The code sample in the wiki (for console requesst) just gives me a null reference on GameAPI. (I can't figure out how to initialize it.)
    GameAPI.Game_Request(CmdId.Request_ConsoleCommand, (ushort)CmdId.Request_InGameMessage_AllPlayers, new Eleon.Modding.PString("destroyme"));

    (Also fails with Request_InGameMessage_SinglePlayer)

    I don't know what you're talking about with RemoteEx.
     
    #386
  7. Taelyn

    Taelyn Guest

    GameAPI.Game_Request(CmdId.Request_ConsoleCommand, (ushort)CmdId.Request_ConsoleCommand, new PString("remoteex cl=" REST OF CODE

    Thats how I use it in a mod, works flawless

    CL is the player CLIENT ID


    remoteex: Sends a console command to either a player or a playfield
    Command: remoteex
    Use pf=<process id> or cl=<client id> to send console command to
     
    #387
    Last edited by a moderator: Jun 21, 2019
  8. Jascha

    Jascha Administrator

    • Moderator
    Joined:
    Jan 22, 2016
    Messages:
    1,141
    Likes Received:
    713
    Hey, I will write it down, should be no problem.
     
    #388
  9. LiftPizzas

    LiftPizzas Rear Admiral

    Joined:
    Sep 28, 2015
    Messages:
    1,434
    Likes Received:
    2,573
    Again, I can't get gameapi to init so I just get a null reference. The Game_Start function doesn't seem to ever get called.
     
    #389
  10. Taelyn

    Taelyn Guest

    Do you try it in SP? Old API doesnt work there

    Only works in MP
     
    #390
  11. LiftPizzas

    LiftPizzas Rear Admiral

    Joined:
    Sep 28, 2015
    Messages:
    1,434
    Likes Received:
    2,573
    Ah that would be why.
     
    #391
  12. Taelyn

    Taelyn Guest

    :D it will be requested to add it to the new API, the New API does work in SP :)
     
    #392
  13. LiftPizzas

    LiftPizzas Rear Admiral

    Joined:
    Sep 28, 2015
    Messages:
    1,434
    Likes Received:
    2,573
    Ya the ability to do console commands would be wonderful.
     
    #393
    Taelyn likes this.
  14. Mortlath

    Mortlath Commander

    Joined:
    Jul 26, 2017
    Messages:
    49
    Likes Received:
    26

    I have working examples of some console commands in the mod wrapper I maintain: https://github.com/MichaelGoulding/...tedMods/search?q=remoteex&unscoped_q=remoteex

    I'd love to add more if I could get some more examples. Thanks.
     
    #394
    Taelyn likes this.
  15. Taelyn

    Taelyn Guest

    Ill look at IT tomorrow and see if i Can give you more
     
    #395
    Mortlath likes this.
  16. LiftPizzas

    LiftPizzas Rear Admiral

    Joined:
    Sep 28, 2015
    Messages:
    1,434
    Likes Received:
    2,573
    Read/write access to NPC properties (HP, damage, model type, behavior type, etc) would be useful.
     
    #396
  17. Taelyn

    Taelyn Guest

    Thats something we wont open up for now. Maybe in the future
     
    #397
  18. Jascha

    Jascha Administrator

    • Moderator
    Joined:
    Jan 22, 2016
    Messages:
    1,141
    Likes Received:
    713
    Check out this help:

    -----------------
    Command: remoteex
    -----------------
    Send ingame console commands to a player or playfield

    Player example: remoteex cl=xyz sector Akua (replace xyz with your player client ID)

    Playfield example: remoteex pf=13012 destroy 26035 / remoteex pf=13012 regenerate 34
    replace 13012 with the Playfield Proccess ID
    The other number is the entity ID of the ship/poi

    ----------------------
    So remoteex just uses the ingame console commands. With this you could just use most of them that you see in the console with "help"

    Examples:
    String.Format("remoteex pf={0} undock {1}", Prozess.ID, Struct.ID)
    String.Format("remoteex pf={0} regenerate {1}", Prozess.ID, Struct.ID)
    String.Format("remoteex cl={0} pda clr {1}", Player.CurrentClientID, PDAChapter)
    String.Format("remoteex cl={0} pda clr {1}", Player.CurrentClientID, PDAChapter)
    String.Format("remoteex cl={0} marker add name={1} pos={2:F0},{3:F0},{4:F0} W WD expire={5}", Player.CurrentClientID, MarkerName, Coordinates.EW, Coordinates.Height, Coordinates.NS, ExpireIn)
    String.Format("remoteex cl={0} detach", Pilot_CurrentClientID)
     
    #398
    Mortlath likes this.
  19. Taelyn

    Taelyn Guest

    #399
    Mortlath likes this.
  20. Kenny_66

    Kenny_66 Lieutenant

    Joined:
    May 3, 2018
    Messages:
    19
    Likes Received:
    0
    In the new API,

    I see there is IPlayfield.IsPvP but it's read only.

    Can we get that so it can be set as well?
    I want to write a mod for a different kind of PvP that involves switching the playfield PvP status but I want to do it without having to kick everyone and restart the server.

    Kicking everyone out of the playfield and restarting the playfield would be ok, just don't want to have to restart the server.
     
    #400

Share This Page