1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Hey Guest, is it this your first time on the forums?

    Visit the Beginner's Box

    Introduce yourself, read some of the ins and outs of the community, access to useful links and information.

    Dismiss Notice

Fun kag scripts and codes

Discussion in 'General Discussion' started by an_obamanation, May 4, 2017.

  1. an_obamanation

    an_obamanation The boss Donator

    Messages:
    392
    Hey, recently i've been having fun screwing around with kag codes and scripts and I thought it'd be nice to have a catalog of these commands and what they do for people to use on their own servers or in singleplayer.
    Code:
    /rcon CBlob@ a=getPlayerByUsername('username').getBlob();CBlob@ b=server_CreateBlob('entity',1,a.getPosition());b.server_SetPlayer(a.getPlayer());a.server_SetPlayer(null);a.server_Die(); - Will turn you into whatever entity you put in for "entity" so a trader will turn you into a trader.
    
    /rcon getPlayerByUsername('player1').getBlob().server_AttachTo( getPlayerByUsername('player2').getBlob(), 0 ); - Will put player1 in the hands of player2, can be used as a way of teleporting players to you
    
    /rcon server_CreateBlob ('entity', 0, getPlayerByUsername('username').getBlob().getPosition()).AddScript('script.as');  Will spawn whatever you put for "entity" on whomever you put for "username" and add whatever you put for "script.as" to said entity. CheapFakeRolling for example will make compatible entities spin. I recommend bisons, they're quite fun.
    
    /rcon getPlayerByUsername('username').getBlob().AddScript('script.as'); - Will add whatever you put in for "script.as" to whomever you put in "username" Lantern.as for example will make that player illuminate dark areas.
    
    /rcon getPlayerByUsername('username').getBlob().server_SetHealth(1000.0f); - Will give whomever you put in for "username" 1000 health. The number can be changed for different health values.



    Note, this is not a complete list of everything you can do with scripts and such, so if you know any that aren't listed here i'd appreciate posting it in the thread so I can add it. (If general discussion isn't the type of place for this I apologize.)
     
    Last edited: May 4, 2017
    Blubahub, Pineapple, PUNK123 and 3 others like this.
  2. epsilon

    epsilon Assonist THD Team Forum Moderator Donator Tester
    1. Gather Oceania
    2. KAG World Cup 2018

    Messages:
    505
    Now I just need a list of entities to use.
     
  3. Monkey_Feats

    Monkey_Feats Ballista Bolt Thrower Tester

    Messages:
    211
    You should use the insert code option, so it's easy too read, like so.

    Code:
    CBlob@ a = getPlayerByUsername('Monkey_Feats').getBlob();
    CBlob@ b = server_CreateBlob('shark',0,a.getPosition());
    b.server_SetPlayer(a.getPlayer());
    b.Tag('Invincible');
    b.RemoveScript('Shark.as');
    b.AddScript('StandardControls.as');
    b.AddScript('StandardPickup.as');
    b.AddScript('ActivateHeldObject.as');
    b.getSprite().AddScript('DefaultActorHUD.as');
    b.getSprite().RemoveScript('SeatsGUI.as');
    b.AddScript('ArcherLogic.as');
    b.AddScript('FireMagicOrb.as');
    b.server_setTeamNum(3);
    b.getShape().SetGravityScale(0.7f);
    b.getAttachments().AddAttachmentPoint("PICKUP", true);
    b.getAttachments().AddAttachmentPoint("SEAT", true);
    AttachmentPoint@ ap = b.getAttachments().getAttachmentPointByName("SEAT");
    ap.offset = Vec2f(0.0f,-12.0f);
    b.getMovement().AddScript('FaceAimPosition.as');
    CBlob@ c = server_CreateBlob('chicken',0,b.getPosition());
    c.AddScript('SeatHop.as');
    c.Tag('Invincible');
    b.server_AttachTo(c, "SEAT");
    a.server_SetPlayer(null);
    a.server_Die();
    
    Turns player into an invicible purple shark that fires purple orbs, has an invisible grapple, lower gravity, facing directions, controls, can pickup/throw things and a chicken riding on it's back.

    Note: This code only works in a local host server.
     
    Last edited: May 5, 2017
  4. an_obamanation

    an_obamanation The boss Donator

    Messages:
    392
    Go into your base folder and then go to entities. Everything in there should be compatible including the buildings. Note that not all can be controlled (Bisons and chickens for example move on their own)
     
    epsilon likes this.
  5. Asu

    Asu THD Team THD Team Forum Moderator

    Messages:
    1,578
    I'm certainly wrong, but maybe disabling their brain might be enough.
    aka blob.getBrain().server_SetActive(false);
     
    BarsukEughen555 likes this.
  6. an_obamanation

    an_obamanation The boss Donator

    Messages:
    392
    I tried it out and it works, only thing is that you can't turn around, moonwalking bisons and chickens are quite lovely though.
    Love this command but I haven't been able to get it working through rcon, only in singleplayer entering the command without it allowed me to get
    [​IMG]

    Sad times when you're denied your face sitting chickens.
     
  7. Asu

    Asu THD Team THD Team Forum Moderator

    Messages:
    1,578
    I gave a look at the chicken script, and it's probably this way on other (land?) animal scripts. Apparently, the velocity affects the blob facing. Unfortunately, I don't think you can fix this easily with a simple command.
    The culprit looks to be :
    Code:
        if (Maths::Abs(x) > 1.0f)
        {
            this.SetFacingLeft(x < 0);
        }
    This is awkward because I don't see why the velocity should go wrong
    Code:
    // ...
        else
        {
            if (this.isKeyPressed(key_left))
            {
                this.SetFacingLeft(true);
            }
            if (this.isKeyPressed(key_right))
            {
                this.SetFacingLeft(false);
            }
        }
    considering I don't see a reason why this could go wrong
     
  8. Monkey_Feats

    Monkey_Feats Ballista Bolt Thrower Tester

    Messages:
    211
    Oh yeah, forgot about the problems with trying to do these commands on a dedicated server, got your hopes up sorry ::(: I'll edit my post now.
     
    an_obamanation likes this.
  9. FunATuns

    FunATuns Builder Carry Donator

    Messages:
    114
    /rcon /quit makes your computer run faster
     
    asger75, Vamist and BarsukEughen555 like this.
  10. an_obamanation

    an_obamanation The boss Donator

    Messages:
    392
    Hosting a small 4 slot server with rcon access for people like @Monkey_Feats who may want to test if certain commands run on dedicated servers. Rcon password is Terri, as it says in the description. Server name is "Scripting Sandbox"

    UPDATE: I've also now discovered that you can use certain scripts that normally wouldn't work through addscript on players by turning yourself into a new entity. For example, I've managed to get cheapfakerolling to work by doing this
    Code:
    /rcon CBlob@ a = getPlayerByUsername('an_obamanation').getBlob();
    CBlob@ b = server_CreateBlob('knight',0,a.getPosition());
    b.server_SetPlayer(a.getPlayer());
    b.AddScript('CheapFakeRolling.as');
    
    
    This does leave a clone of yourself which is half annoying and half funny if you're running playerheads, but it actually gets the command to function when it normally doesn't. (I'm just getting into this sorta thing so if i'm speaking nonsense I apologize in advance)
     
    Last edited: May 10, 2017
    l3afysamz and epsilon like this.
  11. Monkey_Feats

    Monkey_Feats Ballista Bolt Thrower Tester

    Messages:
    211
    You know, if you have access to the server files, you may as well just do this stuff in ChatCommands.as and load it up. I could write you up a little bit of code if you want..

    also
    a.server_Die();
     
    an_obamanation likes this.
  12. an_obamanation

    an_obamanation The boss Donator

    Messages:
    392
    Ah so thats how that works i see now lol, my bad. I do have FTP access but what is it that I should put in chatcommands exactly? (I apologize if it should be obvious, currently running on no sleep.)
     
  13. Monkey_Feats

    Monkey_Feats Ballista Bolt Thrower Tester

    Messages:
    211
    Well, if you did write this stuff into chat commands you could pretty much do whatever you want, Given you have some starter code to go by, which I'm offering to write for you.
    Then you could make your own chat commands, like "!purpleshark Monkey_Feats" or "!dobackflips an_obamanation".

    I'll do up some code tomorrow and try to explain it, then you can just add all the stuff.
     
    Last edited: May 11, 2017
    an_obamanation likes this.
  14. l3afysamz

    l3afysamz Arsonist

    Messages:
    64
    Yay
     
  15. Monkey_Feats

    Monkey_Feats Ballista Bolt Thrower Tester

    Messages:
    211
    Alright, was easier than I thought, all the stuff was all ready to go. Anyway it's pretty simple just have a read through of it, I have pointed out some things in it, all you'll really need to do copy paste and such.
     
    an_obamanation likes this.
  16. an_obamanation

    an_obamanation The boss Donator

    Messages:
    392
    Really nice, I popped it on the server but i've been having issues using it, it works sometimes and then after a little while just stops.

    [​IMG]

    It's still on the server though if you wanna screw around with it. Thank you very much. :up:::)::thumbs_up:
     
  17. Monkey_Feats

    Monkey_Feats Ballista Bolt Thrower Tester

    Messages:
    211
    Alright found the problem (pretty sure), if you set the player to anything other than a player type blob and don't add the script EmoteBubble.as, you will get bad snapshot errors.
    Also changed some things to avoid further problems and fixed the sounds.
     
  18. an_obamanation

    an_obamanation The boss Donator

    Messages:
    392
    Sounds work now, but it still breaks after a little bit and will only work again for a little while once I reset the server. Not getting errors in console either. In fact it seems that every command just stops working.
     
  19. Monkey_Feats

    Monkey_Feats Ballista Bolt Thrower Tester

    Messages:
    211
    No errors, wtf ;;
    --- Double Post Merged, May 12, 2017, Original Post Date: May 11, 2017 ---
    fingers crossed :X3:
     

    Attached Files:

    an_obamanation likes this.
  20. an_obamanation

    an_obamanation The boss Donator

    Messages:
    392
    Could anyone post a command for changing someones speed? I've tried setvelocity but I haven't gotten that to work.

    Code:
    /rcon CBlob@ a = getPlayerByUsername('an_obamanation').getBlob();
    CBlob@ b = server_CreateBlob('knight',0,a.getPosition());
    b.server_SetPlayer(a.getPlayer());
    b.AddScript('CheapFakeRolling.as');
    a.server_Die();
    b.server_setTeamNum(-1);
    b.setVelocity(Vec2f(0,0));
    This is what i'm trying to do but the only thing that happens is that the message goes through without any errors or anything, my velocity remains unchanged. I'm most likely making a very basic mistake as i'm still learning c++ (I know kag uses angelscript but they're essentially the same language.) Any help with this would be appreciated, would be fun to move around at super speeds.