Announcement

Collapse
No announcement yet.

Script Docu v1

Collapse
This is a sticky topic.
X
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • #16
    Added player.weapondata, this.weapondata, Server.getconfig, added the description in the first post :-)
    Also known as Daddy and bomber
    Avalonia Facebook Avalonia iOS Avalonia Android
    Corleone Facebook Corleone Online Download

    Comment


    • #17
      Testing the new functions 😁
       

      Comment


      • #18
        Client-Scripting It cannot do a lot yet, but you can open popups and check which button the user has clicked and send it to the server :-)

        Click image for larger version

Name:	Bildschirmfoto 2018-10-21 um 21.32.17.png
Views:	1
Size:	278.2 KB
ID:	4594Click image for larger version

Name:	clientscripting_small.png
Views:	1
Size:	827.2 KB
ID:	4595
        Also known as Daddy and bomber
        Avalonia Facebook Avalonia iOS Avalonia Android
        Corleone Facebook Corleone Online Download

        Comment


        • #19
          New functionality:
          - this.shoot([weaponitemid]) - shoots with the current weapon or the specified weapon item
          - this.dir = dir / this.setdir(dir) - you can now change the direction (1..4)
          - this.triggerclient(player or id, action [, ...params]) - sends a trigger to the client script of the NPC

          Example:
          PHP Code:
          function onPlayerTouchsMe(pl) {
              
          this.triggerclient(pl"showgui""Hello 123");

          Client-Script:
          PHP Code:
          function onServerShowGUI(pltext) {
              echo(
          "trigger: " text);


          - Clientside:
          - this.image = image / this.setimg(image)
          - this.head, this.body, this.hat can be changed
          - this.chat and player.chat can be changed (not sent to the server, not seen by other players)
          - this.color = [1,1,1,0.5] -> set the color of NPCs or players on client-side, it's [red, green, blue, alpha] in a range from 0 to 1
          - this.nonblocking, this.drawunder
          - this.settimeout and this.scheduleevent are also working on clientside now
          Last edited by Stefan; 11-01-2018, 11:05 PM.
          Also known as Daddy and bomber
          Avalonia Facebook Avalonia iOS Avalonia Android
          Corleone Facebook Corleone Online Download

          Comment


          • #20
            New script events on both server and client:
            - onPlayerAttacks(player) - Player uses a melee attack on the NPC
            - onPlayerHammers(player) - Player uses a hammer or pick axe on the NPC
            - onPlayerPicks(player) - Player uses the trashpick on the NPC
            - onMouseDown(player) - Player clicks on the NPC (now only mouse clicks or tap, previously this event was also fire when attacking with melee weapon)
            Also known as Daddy and bomber
            Avalonia Facebook Avalonia iOS Avalonia Android
            Corleone Facebook Corleone Online Download

            Comment


            • #21
              Great!! Thank you 🤗

              Comment


              • #22
                Another big script update:
                Some weirdness when calling other functions have been fixed: you can now access the this. object correctly and also call functions by this.functionname.
                Additionally you can now change this.hp and this.maxhp. Once you set this.hp, the object can be attacked by player, it's automatically calculating the damage based on the players weapon, the NPC hp and the NPC armor/body level as defined in items.json. An example of a barrel which can be shot:

                PHP Code:
                function onUpdated() {
                    
                this.onRespawn();
                }
                function 
                onMouseDown() {
                    
                this.say("HP: " this.hp "/" this.maxhp3);
                }
                function 
                onDeath(pl) {
                    
                this.chat "killed by " pl;
                    
                this.ani "explode";
                    
                this.scheduleevent(1"respawn");
                }
                function 
                onRespawn() {
                    
                this.image "barrel.png";
                    
                this.chat "";
                    
                this.hp this.maxhp 50;

                Also known as Daddy and bomber
                Avalonia Facebook Avalonia iOS Avalonia Android
                Corleone Facebook Corleone Online Download

                Comment

                Working...
                X