Giter Club home page Giter Club logo

Comments (10)

dbaldan avatar dbaldan commented on July 18, 2024

@whitedragon0000 take a look at this too :)

from openbor.

whitedragon0000 avatar whitedragon0000 commented on July 18, 2024

I know that the recursive spawning is not enabled for a protection crtieria.
It's right, if you use a recursive spawn it becomes useless and you will enter in a loop freeze.
So you need to spawn ANOTHER entity.
You function has 2 issues.
First check for fx,fz,fy NULL() values...
Example: if ( fX == NULL() ) fX = 0; etc....
then perform an attack with reset flag like:
performattack(vSpawn, openborconstant(Ani), 1);
Then is you have some issues you try to call performattack(vSpawn, openborconstant(Ani), 1); from frame with index >= 1
Byeeee

from openbor.

dbaldan avatar dbaldan commented on July 18, 2024

@whitedragon0000 So it's impossible to do without using another entity?

About my function, why I need to check for null first? And that part was not my code.

from openbor.

DCurrent avatar DCurrent commented on July 18, 2024

@dbaldan look at the date, I whipped that function up as a test over ten years ago when OpenBOR first gained script functionality. It was never meant to be used in production, and yet still floats around to this day, lol. It's always best practice to sanitize arguments - otherwise you can get undefined results.

Lets make sure we're on the same page. I'm assuming by "entity" you meant "model", and no, you don't need a second model. Like WD said, you just need to use the reset flag when you set the second entity's initial animation. You should also reset its position once spawned too - don't rely on the spawner to do it for you.

from openbor.

dbaldan avatar dbaldan commented on July 18, 2024

@DCurrent hehehe when I started, the scripting documentation was almost absence. So I learnt by looking at other people works. The code works anyway, lol.

I got the reset flag for the animation, but not about the positions. If I will set all the positions of the second model, why I need to reset it?

from openbor.

whitedragon0000 avatar whitedragon0000 commented on July 18, 2024

@dbaldan You need to reset animation tu avoid animation bugs and stucks.

from openbor.

dbaldan avatar dbaldan commented on July 18, 2024

@whitedragon0000 @DCurrent I've modified my code to include the animation reset and the check for the x,y,z NULL() values but it still doesn't work.

The entity, "Lurker", should spawn a copy of itself, on a specific animation and where I call it.

here is the code:

void spawnAniR(void vName, float fX, float fY, float fZ, void Ani, float Vx, float Vy, float Vz)
{
	//spawnB (Generic spawner) + Specific animation + velocities + reset
	//Damon Vaughn Caskey + Douglas Baldan
	//07/06/2007
	//
	//Spawns entity next to caller.
	//
	//vName: Model name of entity to be spawned in.
	//fX: X location adjustment.
	//fZ: Y location adjustment.
      //fY: Z location adjustment.

	void self = getlocalvar("self"); //Get calling entity.
	void vSpawn; //Spawn object.
	int  iDirection = getentityproperty(self, "direction");

	clearspawnentry(); //Clear current spawn entry.
      setspawnentry("name", vName); //Acquire spawn entity by name.

	if (iDirection == 0){ //Is entity facing left?                  
          fX = -fX; //Reverse X direction to match facing.
	}
	if ( fX == NULL() ) fX = 0;
	if ( fY == NULL() ) fY = 0;
	if ( fZ == NULL() ) fZ = 0;
	//if ( Vx == NULL() ) Vx = 0;
	//if ( Vy == NULL() ) Vy = 0;
	//if ( Vz == NULL() ) Vz = 0;
	
      fX = fX + getentityproperty(self, "x"); //Get X location and add adjustment.
      fY = fY + getentityproperty(self, "a"); //Get Y location and add adjustment.
      fZ = fZ + getentityproperty(self, "z"); //Get Z location and add adjustment.
	
	vSpawn = spawn(); //Spawn in entity.

	changeentityproperty(vSpawn, "position", fX, fZ, fY); //Set spawn location.
	changeentityproperty(vSpawn, "direction", iDirection); //Set direction.
    performattack(vSpawn, openborconstant(Ani), 1); 
	changeentityproperty(vSpawn, "velocity", Vx, Vy, Vz);

	return vSpawn; //Return spawn.
}

Them I call it:
@cmd spawnAniR "Lurker" 0 0 1 "ANI_RISE" 0 0 0

It spawns a copy of itself, but not on the animation I set and it spawns the entity at position 0 of the stage, not where the parent is.

What I am doing wrong and how I can fix it?

from openbor.

dbaldan avatar dbaldan commented on July 18, 2024

@DCurrent can you take a look at this?

from openbor.

DCurrent avatar DCurrent commented on July 18, 2024

@dbaldan I will, but no guarantees. It's pretty low on my priority list until I can get other things cleaned up.

from openbor.

DCurrent avatar DCurrent commented on July 18, 2024

Closing this for now. I think this is more of a module support issue for the forum. Otherwise I'd like to get bug fixes and large projects off my plate first.

from openbor.

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.