Solved projectile palette script

Question that is answered or resolved.

AkuShadow

Member
I have been toying with mugen for a long time and recently moved to openbor. As my name suggests, I'd rather edit an existing mod and eat lasagna as opposed to creating my own. Anyway, I was editing the Return of the Double Dragon by Mr.Q and I eventually learned to add characters and attack. I couldnt find a way to make characters throw a projectile and have the said object share the pal. For example billy wears blue and throws a white knife. I want the knife's color to depend on what pal I selected on the select screen. Do I need to learn scripting to accomplish this?

-P.S. I am new to the forum, so this is my hello. ;D
 
Welcome!

I want the knife's color to depend on what pal I selected on the select screen. Do I need to learn scripting to accomplish this?

The answer is yes, though you can just use scripts from other mods who has similar feature
 
I haven't seen this done before, which mod are you referring to?
I looked over the scripting on that site. It seems simple enough but it will take me a while to understand.......anything.
All I really "get" at this point is that scripting "is" required. I dont even know where to put the script once its been created or what all is needed for scripting to work.
Also I noticed my hitflash is facing the wrong way.
 
set this in the flash entity
Code:
toflip {bi}

    ~Used for hitflashes.
    ~If {bi} is 0, this hitflash will always face the same direction when spawned. If set to 1, the hitflash will flip when the attack comes from the other side.

BTW, Sprites should always face to the right by default in openbor
image.png
 
BeasTie said:
set this in the flash entity
Code:
toflip {bi}

    ~Used for hitflashes.
    ~If {bi} is 0, this hitflash will always face the same direction when spawned. If set to 1, the hitflash will flip when the attack comes from the other side.

BTW, Sprites should always face to the right by default in openbor
image.png

Worked like a charm.....I saw this line in the manual for experts....Had no idea how to use it. Thank you sir.
 
Welcome to the forum. It's good to see another mugen coder getting into OpenBor - I am a mugen coder myself.

OpenBor and Mugen are two different animals, and many things are done in a different way -  for good and for bad.

I can give you two suggestions :

Read the manual linked on the previous post

Read this topic I made about conversion between the engines  http://www.chronocrash.com/forum/index.php?topic=817.0
 
That is good info, thanks. The problem I'm having though is that in mugen, you can simply add the projectiles color to the character pal and it will change when you select a new color. It doesn't work the same way in openbor.
 
I found this on an old thread from this site:
Code:
@script

	void self       = getlocalvar("self");
	int pindex 	= getentityproperty(self,"playerindex");
	void moveright 	=  playerkeys(pindex, 0, "moveright");
	void moveleft 	=  playerkeys(pindex, 0, "moveleft");
	void moveup 	=  playerkeys(pindex, 0, "moveup");
	void movedown 	=  playerkeys(pindex, 0, "movedown");

	changeentityproperty(self, "velocity", 0,0,0);

	if (moveright)
	{
	changeentityproperty(self, "velocity", 0.5,NULL(),NULL());
	}
	if (moveleft)
	{
	changeentityproperty(self, "velocity", -0.5,NULL(),NULL());
	}

	if (moveup)
	{
	changeentityproperty(self, "velocity", NULL(),-0.5,NULL());
	}

	if (movedown)
	{
	changeentityproperty(self, "velocity", NULL(),0.5,NULL());
	}
	@end_script
Its meant to allow your character to move while in an animation.
I put it at the start of a standard blocking animation but the character wont move while blocking. Am I doing something wrong or missing something.
 
I have another script for this.  But what exactly do you want to make?

Because moving while blocking will look weird.
 
BeasTie said:
I have another script for this.  But what exactly do you want to make?

Because moving while blocking will look weird.

lol. I know it will look out of place. I just wanted to test and see if it worked.
I'm trying to make a new move for my shadow jimmy that allows him to move and be invulnerable to attacks but also not allow him to attack. like the capcom vs snk2 dodge but while moving.
 
GarMod, do this:

Do you have a file with your scripts? if no, you will need one. OpenBOR can do things in two ways - by the using shortcuts to functions hard coded into the engine (kinda like when you use "throwframe" to shoot a "knife", the engine spawns a new entity - what we call Helper in Mugen - and use it as a projectile, without any line of code); Or OpenBOR can use a C-based language scripts to expand and even create features not possible in other way. Mugen can't do this (well, it can by using Lua scripts, but there is no documentation about it yet. Some developers doesn't like to document things *joke*, lol)

1- create a file called, for example, "myscripts.c" and place it under the "scripts" folder.
2- put this code on that file and save it - its a function I've adpated from Damon Caskey

Code:
void spawn01map(void vName, float fX, float fY, float fZ)
{
	//spawn01 (Generic spawner)
	//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.
	int  iMap = getentityproperty(self, "map"); // Get caller's remap.
	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.
	}

      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.
	changeentityproperty(vSpawn, "map", iMap); //Set map.
    
	return vSpawn; //Return spawn.
}

Dunno how much you understand from coding logic, so just focus on this line:

void spawn01map(void vName, float fX, float fY, float fZ)

This means that we will call a function named spawn01map (its CASE SENSITIVE) which will wait for 4 values - "vName" is the name of the entity who will be called (the name should be between quotes), fX is the the X position (related to the caller,like "pos = p1" in Mugen), fY is the Y position related to the caller (the engines uses the Y value in different ways) and fZ is the Z position related to the caller (we don't have Z anymore in mugen, as you may know).

3 - at your character header, put this:

animationscript data/scripts/myscript.c
If the character already have a "animationscript", just copy that code I gave  and paste into the animationscript file the character is using.

Usage:
@cmd spawn01map "vfree" 0 0 0

So I am calling the function to spawn the "vfree" entity, at 0 0 0  positions - in other words, in the same position the caller is. The function will change the map (palette) of the entity to the same palette its caller is using. But for this to work, both need to have the same palettes at the same positions on their headers, like this:

in Vision.txt header
palette data/chars/vision/palnew1.png
alternatepal data/chars/vision/original.png
alternatepal data/chars/vision/white.png
alternatepal data/chars/vision/VISION_SMARTPAL_V5_PAL_EURTH.png
alternatepal data/chars/vision/BEASTIE_MAP2.png
alternatepal data/chars/vision/palwc.png
alternatepal data/chars/vision/freeze.png
alternatepal data/chars/vision/venon.png

in vfree.txt header
palette data/chars/vision/palnew1.png
alternatepal data/chars/vision/original.png
alternatepal data/chars/vision/white.png
alternatepal data/chars/vision/VISION_SMARTPAL_V5_PAL_EURTH.png
alternatepal data/chars/vision/BEASTIE_MAP2.png
alternatepal data/chars/vision/palwc.png
alternatepal data/chars/vision/freeze.png
alternatepal data/chars/vision/venon.png

This is how I used that code:

anim freespecial2
loop 0
delay 7
offset 243 270
fastattack 1
Energycost 10 1 0
hitflash flash3
hitfx data/sounds/robohit1.wav
jumpframe 12 2 1 0
frame data/chars/vision/att401.png
bbox 0 0 0 0
attack 0 0 0 0 0 0 0 0 0 0
@cmd spawn01 "sdust" 0 0 0
frame data/chars/vision/fall200.png
bbox 0 0 0 0
@cmd spawn01map "vfree" 0 0 0
delay 40
move 10
sound data/chars/vision/sound/phase1.wav
frame data/chars/vision/blast/empty.png

Sorry for my crap english, I hope you understand what I said :)
 
O Ilusionista said:
GarMod, do this:

Do you have a file with your scripts? if no, you will need one. OpenBOR can do things in two ways - by the using shortcuts to functions hard coded into the engine (kinda like when you use "throwframe" to shoot a "knife", the engine spawns a new entity - what we call Helper in Mugen - and use it as a projectile, without any line of code); Or OpenBOR can use a C-based language scripts to expand and even create features not possible in other way. Mugen can't do this (well, it can by using Lua scripts, but there is no documentation about it yet. Some developers doesn't like to document things *joke*, lol)

1- create a file called, for example, "myscripts.c" and place it under the "scripts" folder.
2- put this code on that file and save it - its a function I've adpated from Damon Caskey

Code:
void spawn01map(void vName, float fX, float fY, float fZ)
{
	//spawn01 (Generic spawner)
	//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.
	int  iMap = getentityproperty(self, "map"); // Get caller's remap.
	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.
	}

      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.
	changeentityproperty(vSpawn, "map", iMap); //Set map.
    
	return vSpawn; //Return spawn.
}

Dunno how much you understand from coding logic, so just focus on this line:

void spawn01map(void vName, float fX, float fY, float fZ)

This means that we will call a function named spawn01map (its CASE SENSITIVE) which will wait for 4 values - "vName" is the name of the entity who will be called (the name should be between quotes), fX is the the X position (related to the caller,like "pos = p1" in Mugen), fY is the Y position related to the caller (the engines uses the Y value in different ways) and fZ is the Z position related to the caller (we don't have Z anymore in mugen, as you may know).

3 - at your character header, put this:

animationscript data/scripts/myscript.c
If the character already have a "animationscript", just copy that code I gave  and paste into the animationscript file the character is using.

Usage:
@cmd spawn01map "vfree" 0 0 0

So I am calling the function to spawn the "vfree" entity, at 0 0 0  positions - in other words, in the same position the caller is. The function will change the map (palette) of the entity to the same palette its caller is using. But for this to work, both need to have the same palettes at the same positions on their headers, like this:

in Vision.txt header
palette data/chars/vision/palnew1.png
alternatepal data/chars/vision/original.png
alternatepal data/chars/vision/white.png
alternatepal data/chars/vision/VISION_SMARTPAL_V5_PAL_EURTH.png
alternatepal data/chars/vision/BEASTIE_MAP2.png
alternatepal data/chars/vision/palwc.png
alternatepal data/chars/vision/freeze.png
alternatepal data/chars/vision/venon.png

in vfree.txt header
palette data/chars/vision/palnew1.png
alternatepal data/chars/vision/original.png
alternatepal data/chars/vision/white.png
alternatepal data/chars/vision/VISION_SMARTPAL_V5_PAL_EURTH.png
alternatepal data/chars/vision/BEASTIE_MAP2.png
alternatepal data/chars/vision/palwc.png
alternatepal data/chars/vision/freeze.png
alternatepal data/chars/vision/venon.png

This is how I used that code:

anim freespecial2
loop 0
delay 7
offset 243 270
fastattack 1
Energycost 10 1 0
hitflash flash3
hitfx data/sounds/robohit1.wav
jumpframe 12 2 1 0
frame data/chars/vision/att401.png
bbox 0 0 0 0
attack 0 0 0 0 0 0 0 0 0 0
@cmd spawn01 "sdust" 0 0 0
frame data/chars/vision/fall200.png
bbox 0 0 0 0
@cmd spawn01map "vfree" 0 0 0
delay 40
move 10
sound data/chars/vision/sound/phase1.wav
frame data/chars/vision/blast/empty.png

Sorry for my crap english, I hope you understand what I said :)

I don't have a scripts folder if that's what you mean but I can just make one.
I havent yet done anything and I will follow this to the T though you didnt mention what this is supposed to do.
 
The function spawn an entity (an helper, in mugen) at the desired position and changes its palette to match the palette of the caller. kinda like you wanted to do :)
 
Works great but now the projectile hits and keeps going. Only supposed to hit once.

The other question is: what is this line?

@cmd  spawn01 "sdust" 0 0 0
 
@cmd is a command that is called from the animationscript. O Ilusionista has explained all about using animation scripts. For example, as O mentioned about the void ones, like, the void name (vName or character/entity name), that "sdust" right there is an entity/model name (or vName) as a projectile or something else. spawn01 is a type of name for animation script to be called. Check that type of name in your .c of that animation script if you have it. The reason he puts spawn01 is because he has that name in his animation script (myscript.c or whatever) which he added animationscript in the header for his character. Also, for the three 0's, they are for position and it appears from the ground or base (because, ALL 0's). It's like using coords (x z y) for non-player entities on their positions in stage making, but it's mostly for characters with any entity types being summoned (except players I think). Imagine your character has an animation or something which lands on the ground. You can use that dust entity to be summoned for falling on the sand or wherever.
 
maxman said:
@cmd is a command that is called from the animationscript. O Ilusionista has explained all about using animation scripts. For example, as O mentioned about the void ones, like, the void name (vName or character/entity name), that "sdust" right there is an entity/model name (or vName) as a projectile or something else. spawn01 is a type of name for animation script to be called. Check that type of name in your .c of that animation script if you have it. The reason he puts spawn01 is because he has that name in his animation script (myscript.c or whatever) which he added animationscript in the header for his character. Also, for the three 0's, they are for position and it appears from the ground or base (because, ALL 0's). It's like using coords (x z y) for non-player entities on their positions in stage making, but it's mostly for characters with any entity types being summoned (except players I think). Imagine your character has an animation or something which lands on the ground. You can use that dust entity to be summoned for falling on the sand or wherever.

I see, so I could use the sdust to add an effect like a dbz blast dust or even on the character and not the spawned projectile....Thanks for all the help guys. I still had that other issue with it not stopping after it hits the enemy. Is the solution to this in the scripting?
 
GarMod said:
I still had that other issue with it not stopping after it hits the enemy. Is the solution to this in the scripting?

If it's hardcoded or non-scripted, and you're talking about projectiles, it can work by using remove 1 in the header for your projectile.

remove {bool}

Only works for projectiles. Defaults to 1.

1 = the projectile will be destroyed when it hits an enemy.
0 = the projectile continues flying even after hitting an enemy.

Example:

name  Hadoken
health 1
nolife  1
type  enemy
candamage enemy player
gfxshadow 1
speed 8
remove 1
alpha 1

anim idle
attack 13 0 63 49 25 0 1 0 0 0
loop 1
delay 5
hitflash hadohit
offset -20 22
frame data/chars/misc/hadoken/0700000000.gif
offset -19 24
frame data/chars/misc/hadoken/0700000001.gif
offset -18 28
frame data/chars/misc/hadoken/0700000002.gif
offset -15 28
frame data/chars/misc/hadoken/0700000003.gif
frame data/chars/misc/hadoken/0700000004.gif
offset -10 28
frame data/chars/misc/hadoken/0700000005.gif
offset -13 27
frame data/chars/misc/hadoken/0700000006.gif
offset -9 26
frame data/chars/misc/hadoken/0700000007.gif
offset -8 23
frame data/chars/misc/hadoken/0700000008.gif
offset -8 22
frame data/chars/misc/hadoken/0700000009.gif
 
maxman said:
GarMod said:
I still had that other issue with it not stopping after it hits the enemy. Is the solution to this in the scripting?

If it's hardcoded or non-scripted, and you're talking about projectiles, it can work by using remove 1 in the header for your projectile.

remove {bool}

Only works for projectiles. Defaults to 1.

1 = the projectile will be destroyed when it hits an enemy.
0 = the projectile continues flying even after hitting an enemy.

Example:

name  Hadoken
health 1
nolife  1
type  enemy
candamage enemy player
gfxshadow 1
speed 8
remove 1
alpha 1

anim idle
attack 13 0 63 49 25 0 1 0 0 0
loop 1
delay 5
hitflash hadohit
offset -20 22
frame data/chars/misc/hadoken/0700000000.gif
offset -19 24
frame data/chars/misc/hadoken/0700000001.gif
offset -18 28
frame data/chars/misc/hadoken/0700000002.gif
offset -15 28
frame data/chars/misc/hadoken/0700000003.gif
frame data/chars/misc/hadoken/0700000004.gif
offset -10 28
frame data/chars/misc/hadoken/0700000005.gif
offset -13 27
frame data/chars/misc/hadoken/0700000006.gif
offset -9 26
frame data/chars/misc/hadoken/0700000007.gif
offset -8 23
frame data/chars/misc/hadoken/0700000008.gif
offset -8 22
frame data/chars/misc/hadoken/0700000009.gif

I tried adding "remove 1" and it didnt work. Then I changed type to enemy and it started moving around the screen. I changed it pshot and none and it still stays after hitting the enemy.
 
Back
Top Bottom