Giter Site home page Giter Site logo

DL FCNPC_SetVelocity about fcnpc HOT 11 CLOSED

c0dz3r avatar c0dz3r commented on June 2, 2024
DL FCNPC_SetVelocity

from fcnpc.

Comments (11)

ziggi avatar ziggi commented on June 2, 2024

I've test this, and everything looks good:

public FCNPC_OnInit()
{
  npcs[0] = FCNPC_Create("test1");
  FCNPC_Spawn(npcs[0], 1, 85.2381, -232.6194, 1.5781);

  foreach (new npcid : FCNPC) {
    FCNPC_SetVelocity(npcid, 0.1, 0.1, 0.2, true);
  }

  SetTimer("timer", 1000, 1);

  return 1;
}

forward timer();
public timer()
{
  foreach (new npcid : FCNPC) {
    new Float:x, Float:y, Float:z;
    FCNPC_GetPosition(npcid, x, y, z);

    printf("npc %d: %.2f, %.2f, %.2f", npcid, x, y, z);
  }
}
npc 999: 89.03, -228.81, 9.17
npc 999: 92.73, -225.11, 16.57
npc 999: 96.53, -221.31, 24.17
npc 999: 100.33, -217.51, 31.77
npc 999: 104.13, -213.71, 39.37
npc 999: 107.93, -209.91, 46.97

from fcnpc.

c0dz3r avatar c0dz3r commented on June 2, 2024

Set a position that throws the NPC into the air or raises them into the air and they will return to their previous position

from fcnpc.

ziggi avatar ziggi commented on June 2, 2024

Show me your code and video.

from fcnpc.

c0dz3r avatar c0dz3r commented on June 2, 2024

error 017: undefined symbol "FCNPC_InitMapAndreas"

from fcnpc.

c0dz3r avatar c0dz3r commented on June 2, 2024
CMD:bt(playerid, params[])
{
    new Float:x, Float:y, Float:z;
    GetPlayerPos(playerid, x, y, z);
    npppcid = FCNPC_Create("BOT");
    
    FCNPC_Spawn(npppcid, 100, x, y, z);
    SetTimer("timerdebug", 1000, 1);
    return 1;
}

CMD:btvelo(playerod, params[])
{
    new Float:X, Float:Y, Float:Z;
    FCNPC_GetVelocity(npppcid, Float:X, Float:Y, Float:Z);
    /* repeat pos infinite */
    FCNPC_SetVelocity(npppcid, Float:X, Float:Y, Float:Z + 0.00050, true);
    return 1;
}

/* NPC bug doesn't fall in the air */
CMD:btstop(playerod, params[])
    return FCNPC_SetVelocity(npppcid, Float:0.0, Float:0.0, Float:0.0, true);    

Logs

npc 99: 2734.02, 1252.56, 106.53
npc 99: 2734.02, 1252.56, 106.53
npc 99: 2734.02, 1252.56, 106.53
npc 99: 2734.02, 1252.56, 106.53
npc 99: 2734.02, 1252.56, 106.53
npc 99: 2734.02, 1252.56, 106.53
[CMD] [HashHatake]: /btvelo
npc 99: 2734.02, 1252.56, 106.55
npc 99: 2734.02, 1252.56, 106.62
npc 99: 2734.02, 1252.56, 106.68
npc 99: 2734.02, 1252.56, 106.75
npc 99: 2734.02, 1252.56, 106.81
npc 99: 2734.02, 1252.56, 106.87
npc 99: 2734.02, 1252.56, 106.94
npc 99: 2734.02, 1252.56, 107.01
npc 99: 2734.02, 1252.56, 107.08
npc 99: 2734.02, 1252.56, 107.15
npc 99: 2734.02, 1252.56, 107.22
npc 99: 2734.02, 1252.56, 107.29
npc 99: 2734.02, 1252.56, 107.36
npc 99: 2734.02, 1252.56, 107.43
Inpc 99: 2734.02, 1252.56, 107.49
npc 99: 2734.02, 1252.56, 107.56
npc 99: 2734.02, 1252.56, 107.63
npc 99: 2734.02, 1252.56, 107.70
npc 99: 2734.02, 1252.56, 107.76
npc 99: 2734.02, 1252.56, 107.82
[CMD] [HashHatake]: /btstop
npc 99: 2734.02, 1252.56, 107.89
npc 99: 2734.02, 1252.56, 107.89
npc 99: 2734.02, 1252.56, 107.89
npc 99: 2734.02, 1252.56, 107.89
npc 99: 2734.02, 1252.56, 107.89
npc 99: 2734.02, 1252.56, 107.89
npc 99: 2734.02, 1252.56, 107.89
npc 99: 2734.02, 1252.56, 107.89

https://www.youtube.com/watch?v=2rld0zMkRqU

from fcnpc.

ziggi avatar ziggi commented on June 2, 2024

I can see the position changing, but slowly.

from fcnpc.

ziggi avatar ziggi commented on June 2, 2024

https://www.youtube.com/watch?v=UuhjiW-PsJ4

#include <a_samp>
#include "foreach"
#include "FCNPC"

new npcs[2];

main() {

}

public OnGameModeInit() {
  AddPlayerClass(1, 85.0, -232.0, 1.6, 0.0, 31, 999, 0, 0, 0, 0);

  return 1;
}

public FCNPC_OnInit()
{
  npcs[0] = FCNPC_Create("test1");
  FCNPC_Spawn(npcs[0], 1, 85.2381, -232.6194, 1.5781);

  npcs[1] = FCNPC_Create("test2");
  FCNPC_Spawn(npcs[1], 1, 84.2381, -231.6194, 1.5781);

  return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
  if (strcmp(cmdtext, "/velocity", true) == 0) {
    foreach (new npcid : FCNPC) {
      FCNPC_SetVelocity(npcid, 0, 0, 0.02, true);
    }

    return 1;
  }

  return 0;
}

from fcnpc.

c0dz3r avatar c0dz3r commented on June 2, 2024

Up they go well, the problem is making them fall to the ground

from fcnpc.

ziggi avatar ziggi commented on June 2, 2024

Set negative velocity and reset to 0 when they reach ground

from fcnpc.

c0dz3r avatar c0dz3r commented on June 2, 2024

Set negative speed and reset to 0 when they hit the ground

How to detect soil?

from fcnpc.

ziggi avatar ziggi commented on June 2, 2024

You can use MapAndreas or ColAndreas

from fcnpc.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.