Need help with basic stuff

Die_In_Fire

Well-known member
I’m very rusty, I need help with a few things.

1. First, it seems I don’t quite understand the jump frame landframe, as I can’t get the desired result on this animation.
I want the high point of the jump to be on frame #22, so I set landframe at frame #23 (counting from 0. The 17.gif frame), but the character starts de descending much before that. Probably at frame #20.

This is the code:
(Sorry for any typos. I typed it from my phone so there’s probably some mistake)
Code:
anim freespecial13
fastattack 1
loop 0
delay 2
jumpframe 0 3 1
landframe 23
offset 43 75
hitfx data/sounds/kbeatko1.wav
frame data/chars/kunio/18.gif
attack3 39 47 31 21 0 1 0 0 20 8
dropv 2 1 0
frame data/chars/kunio/44.gif
delay 3
attack4 0
frame data/chars/kunio/45.gif
attack3 39 47 31 21 0 1 0 0 20 8
dropv 2 1 0
frame data/chars/kunio/45.gif
attack4 0
frame data/chars/kunio/44.gif
move 4
attack3 39 47 31 21 0 1 0 0 20 8
dropv 2 1 0
frame data/chars/kunio/45.gif
attack4 0
frame data/chars/kunio/44.gif
attack3 39 47 31 21 0 1 0 0 20 8
 dropv 2 1 0
frame data/chars/kunio/44.gif
 attack4 0
frame data/chars/kunio/45.gif
attack3 39 47 31 21 0 1 0 0 20 8
 dropv 2 1 0
frame data/chars/kunio/44.gif
        attack 0
frame data/chars/kunio/45.gif
attack3 39 47 31 21 0 1 0 0 20 8
dropv 2 1 0
frame data/chars/kunio/45.gif
Attack4 0 0 0 0
frame data/chars/kunio/44.gif
attack3  40  58  30  17  0  1 0 0 15
dropv 2 1 0
frame data/chars/kunio/45.gif
attack4  0  0  0  0  0  0
frame data/chars/kunio/44.gif
attack3 39  47  31  21  0  0 0 0 0 15
dropv 2 1 0
frame data/chars/kunio/44.gif
attack4  0  0  0  0  0  0
frame data/chars/kunio154.gif
Delay 15
bbox 37 44 13 31
attack3  39  47  31  21  0  1 0 0 0 15
dropv 2 1 0
frame data/chars/kunio/155.gif
 dropv -3 1 0
attack  0  0  0  0  0  0
Delay 4
frame data/chars/kunio/155.gif
frame data/chars/kunio/15.gif
Delay 10
frame data/chars/kunio/16.gif
frame data/chars/kunio/15.gif
Delay -1000
frame data/chars/kunio/16.gif
Delay 15
frame data/chars/kunio/17.gif

2. I have a coin which is type item that gives 60 score points. It’s subtype touch and has a sound in the middle of his idle animation. When I touch it, it works as intended giving the 60 points and disappearing, but it still keeps playing the idle sound effect (until lifespan finish) . Again, typed from my phone so I skipped bbox numbers and others...
Code:
Name coin60
Health 0
score 60
type item
subtype touch
Shadow 0
icon data/ blabla
lifespan 8
palette blabla

Anim idle
loop 1
offset 43 75
bbox blabla
Delay 4
frame etc
bbox etc
frame etc
bbox etc
frame etc
bbox etc
frame etc
bbox etc
frame etc
bbox etc
frame etc
bbox etc
frame etc
bbox etc
frame etc
bbox etc
sound data/sounds/rcr9.wav
frame etc
bbox etc
frame etc
bbox etc
frame etc
bbox etc
frame etc
bbox etc
frame etc
bbox etc
frame etc
bbox etc
frame etc
bbox etc
frame etc
bbox etc
frame etc


anim death
loop 0
offset 43 75
bbox etc
delay 3
frame etc
 
Hi Die_in_Fire,

You can maybye use an higher jumpframe y value in order to play all the intermediate frames.
Here is an example how I use jumpframe and landframe for one of my enemy:
Code:
anim freespecial #JUMPATTACK
	landframe 3 0
	range 40 80
	rangea 0 100
	fastattack 1
	jugglecost 10
	forcedirection -1
	loop	0
	delay	30
	offset	21 86
	bbox 8 0 25 60
	jumpframe 0 2.9 2	
	hitfx	data/sounds/sf/HighKick.wav
	sound	data/sounds/sf/HighAttack.wav
	attack1 0 29 60 35 8 1 0 0 10 12
	frame	data/chars/sid/jumpatk00.gif
	sound	data/voices/signal/signal1.wav
	frame	data/chars/sid/jumpatk00.gif
	offset	16 71
	delay 	-1000
	frame	data/chars/sid/jumpland00.gif
	delay	20
	frame	data/chars/sid/jumpland00.gif

You can just add
Code:
death 1
in your coin header if you wish to activate the anim death.
The body box should be declared only one time in your coin idle animation, unless your item grows bigger or smaller.
 
Thanks for the help kimono
You can maybye use an higher jumpframe y value in order to play all the intermediate frames.

I was afraid it was gonna have to be like that... already tried with higher value and played more frames before descending, but I don’t want to increase the jump more. I think I’ll break the animation in two and make it a followcond for the second part.
I use jumpframe on enemies and never had a problem. I had never used jumpattack because never liked how the AI use it, so I thought I was used to jumpframe but this time the animation has lot of frames, so been trying different numbers and nothing fits.

You can just add death 1
in your coin header if you wish to activate the anim death.
The body box should be declared only one time in your coin idle animation, unless your item grows bigger or smaller.
Adding death1 doesn’t change anything. It keeps playing the sound until the entity lifespan finish...
Ohh I my bbox changes a few pixels because the coin is bouncing in place. And the sound file is played when the coin touch the floor. (Just like in river city ransom).
 
I use freespecial + jumpframe for the enemies too. the counterpart is that the animation needs more precise settings to give the illusion that the enemy jumps and attacks.
You can try to kill the entity by script if you still have sound problems.
 
try using a velocity script inside the animation

Code:
void velo001(float fX, float fZ, float fY){
     
    //velo001
	//Damon Vaughn Caskey
	//05/06/2007
	//
	//Replicates movement effect.
	//
	//fX: X axis speed.
	//fZ: Z axis speed.
	//fY: Y axis speed.
	
	void vSelf = getlocalvar("self"); //Get calling entity.
	
	if (getentityproperty(vSelf, "direction")==0){ //Is entity facing right?                 
     
         fX = -fX; ////Reverse X direction to match facing.
         
    }         
	
	changeentityproperty(vSelf, "velocity", fX, fZ, fY); //Apply movement.

}

like

Code:
@cmd   velo001 0 0 10

above the frame you wanna hang in the air a little longer

as for the coin, i'd spawn an entity from the touch with an empty frame not looped with a sound effect that kills itself
 
Die_In_Fire : When you set an entity to jump, to need to match jumping height with total delay from start of the jump to end of jump.

For instance, if you set jumpframe 0 3 0 0, entity will be airborne for 3x20 centiseconds at least. That's from start of jump to land.
In example you quoted above, Kunio takes 92 centiseconds before he enters landing phase (frame with -1000 delay). Excluding -1000 delay, that's way more than 60, that explains why Kunio drops to ground before entering landing phase.
You need to shorten Kunio's action if you don't want to increase jumping height.

BTW I see repeated frames in this animation, is Kunio performing cyclone kick in this animation?
If yes, I suggest using floating effect to make Kunio hover in mid air while he kicks then let him drop to ground after he finishes kicking. Yes, that's similar to Billy and Jimmy Lee's cyclone kick from Double Dragon 2 :).
This is the function needed for floating:
Code:
void floater( int Time )
{// Floats in Time centiseconds
    void self = getlocalvar("self");
    int eTime = openborvariant("elapsed_time");

    changeentityproperty(self, "tosstime", eTime + 2*Time);
}

Setiing @cmd floater 30 will make entity defies gravity for 30 centiseconds.

You are free to declare that anytime in the animation but I suggest declaring it after jumping 30 centiseconds to let Kunio reach peak of his jump.
 
danno said:
as for the coin, i'd spawn an entity from the touch with an empty frame not looped with a sound effect that kills itself
Uhmmm maybe declaring a silent wav as the coin death sound would do 🤔

Thanks Danno and Bloodbane , I’ll try both vel001 and floater and compare which one give best results.

  BTW I see repeated frames in this animation, is Kunio performing cyclone kick in this animation?
It’s a multi kick like Robert Garcia in art of fighting, but while jumping. So with the dropv I’m pushing the enemy upwards and continue hitting him. The idea is that in the high point of the jump, Kunio change the attack and drops the enemy to the floor. Similar as some people do with some jump grabs.
 
Ok I got problem 1 kinda solved... I used floater function as advised by Bloodbane . I tried velo001 by Danno but I didn’t have that script (I couldn’t copy/paste the function Danno wrote because I don’t have internet connection, only on my phone) I could try searching the function on another mod script though.
Anyways I changed some delays, removed some stuff and now the animation plays full but I got another problem: most of the times I miss hitting the enemy on those last frames 😅
I’ve been tweaking dropv etc. it seems I need to learn from other mods...
Probably I’ll use those last frames for a slam move instead, as that’s guaranteed to hit 100%.
You can see the animation in the video below. The only time it worked with the enemy, is when you hear a different sound and you see the enemy falling with a special animation, near the end of the video at 1:07 mark.

2. I still don’t solve this. Been busy with number 1 problem. Still think adding silent wav at death animation will override the other wav. You can see this problem in the video too.

Here’s the video with the coin and the freespecial. I don’t have time to go to a Internet cafe so I just grabbed a video with my phone instead:

3. I have a problem with another move.
When I do a particular free special, I use spawn001 to get the some red kanjis appear. But when the character is facing left, the kanji entity is mirrored.
Character facing right: 熱血 appears. Correct
Character facing left: 血熱 appears, bad.

Flip 1 doesn’t solve the problem.

I’ll share the entity text tomorrow.

The movement I’m talking about is in this video:


 
2. I've been looking for a really easy way to create this effect but apparently there's no really easy way.
The best solutions I have for now are these :
a. Use itembox for the coin and use didhitscript to play SFX.
b. Use attackbox for the coin and use didhitscript to add the score.

Example of itembox:
Code:
name		Money
score		1000
type		item
gfxshadow	1
icon		data/chars/misc/monicon.gif


anim	idle
	delay	1000
	offset	7 14
	itembox	0 0 16 16
	frame	data/chars/misc/money.gif

SFX is played when this money is touched but it's the regular one when item is picked up.
I'll post example of didhitscript later after I made simpler one.

3. Have you tried setting facing 1 to kanji text?
 
Bloodbane said:
SFX is played when this money is touched but it's the regular one when item is picked up.
That sound works as intended. My problem is with another sound I use on the idle animation that keeps sounding for a few seconds even after item was picked/touched.

3. Have you tried setting facing 1 to kanji text?
Thanks. Worked!
 
@Die_in here is the velo001 script
Code:
void velo001(float fX, float fZ, float fY){
     
    //velo001
	//Damon Vaughn Caskey
	//05/06/2007
	//
	//Replicates movement effect.
	//
	//fX: X axis speed.
	//fZ: Z axis speed.
	//fY: Y axis speed.
	
	void vSelf = getlocalvar("self"); //Get calling entity.
	
	if (getentityproperty(vSelf, "direction")==0){ //Is entity facing right?                  
     
         fX = -fX; ////Reverse X direction to match facing.
         
    }         
	
	changeentityproperty(vSelf, "velocity", fX, fZ, fY); //Apply movement.

}
 
Thanks Ilu, but I will not be able to copy that function for a few days. (Not internet at home so until I go to a cyber cafe I can’t copy/download stuff).

Is there another mod with money item with sound on idle animation?
I want to check if this is an engine issue or my coding issue. Definitely is not normal for the sound to continue sounding even after the entity dies/its touched.

 
When I'm in Italy I stay in a mountain region and there's no WiFi, I have to use my mobile for everything, so here's a Pro tip from me hahahaha download a notepad app on your phone, copy the code into the notepad app and then transfer that file from your phone to your laptop/computer via USB or Bluetooth that's how I have to do things when I have no internet.
 
Die_In_Fire said:
I want to check if this is an engine issue or my coding issue. Definitely is not normal for the sound to continue sounding even after the entity dies/its touched.

Die_In_Fire,

If your item has a sound in its animation, it's actually quite normal. There's a delay of the static engine's internal GAME_SPEED value (200 at time of writing) * 3 before item kills itself. IOW, the item is out of sight, but still in play for ~6 seconds after you pick it up.

DC
 
danno said:

Thanks for the advice. I use iphone so every time I connect to USB it starts that awful time consuming synch stuff. To avoid that I bought a lexar i to use as USB memory, but the phone doesn’t detect it at all :(
I haven’t tried using bluetooth, but I tried to share internet from the phone to the laptop to do text files small transactions and the laptop doesn’t recognize the internet signal from the phone.

IOW, the item is out of sight, but still in play for ~6 seconds after you pick it up.
Thanks for clarifying this Damon Caskey 

Next question:
On enemy death animation I’m spawning a type none entity. I have 6 different entities of those I would like to be spawned at random. I think I saw a script to do that but just cannot find it again so after I’ve been browsing the forum looking for it, I’d like if someone can point me to the script/thread. Thanks.
 
Die_In_Fire said:
Is there another mod with money item with sound on idle animation?

I don't put SFX on IDLE animation. I did either use attackbox with money hitfx +didhitscript to add score or itembox with score + didhitscript to play the SFX.

I have 6 different entities of those I would like to be spawned at random

You can use something like this:
Code:
    int r = rand()%6+6;

    if(r >= 0 && r < 2){
      spawn01("item1", 0, 0, 0);
    } else if(r >= 2 && r < 4){
      spawn01("item2", 0, 0, 0);
    } else if(r >= 4 && r < 6){
      spawn01("item3", 0, 0, 0);
    } else if(r >= 6 && r < 8){
      spawn01("item4", 0, 0, 0);
    } else if(r >= 8 && r < 10){
      spawn01("item5", 0, 0, 0);
    } else {
      spawn01("item6", 0, 0, 0);
    }
 
Bloodbane i tried the script. It doesn’t crash but I can’t see anything spawned either...

This was my previous death animation. It spawned the entity perfectly but it was always the same entity:

Code:
Anim death
Loop 0
Subentity wasted1
Summonframe 0 10 242 0 1
Delay 13
Offset 43 75
Frame data/etc .gif
Frame data/etc .gif

Forgot to mention that the entity was “relative to screen” because I wanted to always be spawned in the same part of the screen, no matter where the enemy died.

This is one of the entity txt:
Code:
Name wasted1
Type none
Shadow 0
Setlayer 1000
Facing 1
Offscreenkill 100

Anim idle
Loop 0
Delay 70
Offset 1 242
Bbox 0
Frame data/etc .png
Frame data/etc blank.gif

And this is how I changed with your script:
Code:
Anim death
Loop 0
Delay 13
Offset 43 75
Frame data/etc .gif
  int r = rand()%6+6;

    if(r >= 0 && r < 2){
      spawn01("wasted1", 0, 242, 10);
    } else if(r >= 2 && r < 4){
      spawn01("wasted2", 0, 242, 10);
    } else if(r >= 4 && r < 6){
      spawn01("wasted3", 0, 242, 10);
    } else if(r >= 6 && r < 8){
      spawn01("wasted4", 0, 242, 10);
    } else if(r >= 8 && r < 10){
      spawn01("wasted5", 0, 242, 10);
    } else {
      spawn01("wasted6", 0, 242, 10);
    }
Frame data/etc .gif

But I don’t know if it’s spawning offscreen, or not spawning at all...
 
spawn01("wasted1", 0, 242, 10);

That's really high spot to spawn this wasted entity. That script means that wasted1 is spawned 242 pixels above spawner and 10 pixels in front of spawner in z axis.

FYI spawn01 function has different parameter than summonframe/spawnframe.
Code:
spawnframe	{frame}	{x}	{z}	{a}	{relative}
summonframe	{frame}	{x}	{z}	{a}	{relative}

Code:
spawn01(void vName, float fX, float fY, float fZ)

So if you declared Summonframe 0 10 242 0 1, function declaration should be @cmd spawn01 10 0 242 .

Just a minute, if you set last parameter of summonframe to 1, you might need to use spawn06 function instead.
Here's the function if you don't have it yet.
Code:
void spawn06(void vName, float fX, float fY, float fZ)
{
	//Spawns entity based on left screen edge and z axis
	//Auto adjust with camera's position
	//vName: Model name of entity to be spawned in.
	//fX: X distance relative to left edge
	//fY: Y height from ground
      //fZ: Z coordinate

	void self = getlocalvar("self"); //Get calling entity.
	void vSpawn; //Spawn object.
	int Direction = getentityproperty(self, "direction");
        int XPos = openborvariant("xpos"); //Get screen edge's position
        int YPos = openborvariant("ypos"); // Get camera position
        int Screen = openborvariant("hResolution"); // Get screen width

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

   if (Direction == 0){ //Is entity facing left?                  
      fX = Screen-fX; //Reverse X direction to match facing and screen length
   }

	vSpawn = spawn(); //Spawn in entity.

	changeentityproperty(vSpawn, "position", fX + XPos, fZ + YPos, fY); //Set spawn location.
	return vSpawn; //Return spawn
}

It doesn’t crash but I can’t see anything spawned either...

Have you loaded all wasted entities? at least in this enemy's header text?
 
Die_In_Fire
if the animation loop is happening too fast (repeats animation before the audio sample finishes) it will tell the engine to play the .wav file so many times it will repeat for a bit even after death etc.  So you would need to make the animation longer or break the sample up into parts.

If you don't really need looping audio, for example if you just need to make the sound of the coin dropping like the original game you can break the sound into parts, then play the sounds on the exact frame the coin hits the ground.  Then when the coin is actually idle only loop the final frames so it doesn't repeat, for example loop 1 4 6 will only loop frames 4 to 6.

I remember having to use didhit scripts in my mod so I could have custom sound effects playing for picking up items that were using subtype touch. didhit is built in, so it's pretty easy to make the script, it's just loading and playing a sound file.
 

Ohh I see. I had the parameters wrong as I was using these

Code:
spawn01(Name, dx, dy, 0); 

Thanks a lot. I’ve been busy so I still don’t try the spawn06, but I’ll let you know if it worked out with that one.

BeasTie  oh man it’s been a very long time!!!
You and Bloodbane both mentioned the didhitscript. I still don’t understand what’s that script for. I want the sound to play during idle animation, not when the player touch the item. Just the same like in river city ransom, so I don’t need a script to play a sound file when player touch the item (in this case).
The wav file don’t even last one second, so the loop doesn’t repeat before the audio sample finish.
I’ll upload the coin entity later as I’m in a friend’s place with internet connection and I have the mod on a USB memory.

Unrelated question:
Is there a shooter mod that plays like Axelay, 1942? Vertical scrolling.
Maybe I’ll need help later with some enemies for that style of mod.
 
Back
Top Bottom