Jump to content

Photo

Bomb Slug doesn't show the correct tiles any more


  • Please log in to reply
10 replies to this topic

#1 Rastael

Rastael

    Wizard

  • Members
  • Real Name:Raphael
  • Location:Austria

Posted 27 April 2024 - 07:39 AM

Heyho :)

 

 

It's a long time, since I worked on my ZC-Quest, but today I wanted start again and play through the finished part of my quest.

 

Everything worked so fine, but the Bomb-Slug Enemy had incorrect tiles.

I chose tile 57420 as the Bomb-Slug tile. But for some odd reason, the Down-, Left- and Right-animations are shown as tiles 62184 to 62199. The Up-animation are some random invisible tiles (can't figure the number out).

 

I guess, this happened, when I updated ghost.zh to Version 2.8, but I'm not sure, when the script started to act strange.

 

 

Does anyone have an idea, why this happens?

 

 

 

 

This is the Bomb Slug script:

//Size 1x1
//Enemies Used 1
//Combos Used GH_INVISIBLE_COMBO

//Type Other.
//Animation Anything you want really, but I prefer 4 frame 4 direction.
//All Data on data tab 1 except hunger is used. They effect as if it's a walker.
//Attribute 1 Is the weapon/misc sprite to used for placed bombs.
//Attribute 2 Is the time before a bomb explodes.
//Attribute 11 This must be = to GHF_INVISIBLE COMBO for it to work right.
//Attribute 12 This is the script slot number that contains the following scripts.


ffc script EnemieBombSlug{
    void run(int enemyID){
        npc ghost = Ghost_InitAutoGhost(this, enemyID, GHF_STUN | GHF_CLOCK);
        float counter = -1;        
        int step = ghost->Step;
        int rate = ghost->Rate;
        int homing = ghost->Homing;
        int haltrate = ghost->Haltrate;
        while(true){
            counter = Ghost_HaltingWalk4(counter, step, rate, homing, 0, haltrate, 48);
            ghost->Dir = Ghost_Dir;
            if(counter == 16){
                eweapon e = FireEWeapon(EW_SCRIPT1, Ghost_X, Ghost_Y, 0, 0, 0, ghost->Attributes[0], SFX_PLACE, EWF_NO_COLLISION);
                SetEWeaponLifespan(e, EWL_TIMER, ghost->Attributes[1]);
                SetEWeaponDeathEffect(e, EWD_EXPLODE, ghost->WeaponDamage);
            }
            Ghost_Waitframe(this, ghost, true, true);
        }
    }
}

 

 



#2 Russ

Russ

    Caelan, the Encouraging

  • Administrators
  • Location:Washington

Posted 27 April 2024 - 03:02 PM

As far as I can tell, this ghost script is using the enemy itself for the tile draws, so the problem wouldn't be with the script, but with the enemy. Off the top of my head, it could be an issue with the animation type set in the enemy editor, or something to do with rules about old vs new enemy tiles.


  • Rastael likes this

#3 Rastael

Rastael

    Wizard

  • Members
  • Real Name:Raphael
  • Location:Austria

Posted 28 April 2024 - 04:44 AM

Thanks for yourn reply. ^^

 

 

 

Those are the settings in the enemy editor:

 

 

 

Editor1.jpg

 

Editor2.jpg

 

 

 

 

 

 

 

 

 

 

Those are the tiles, it SHOULD use:

 

Tiles1.jpg

 

Tiles2.jpg

 

 

 

 

 

 

 

 

 

 

Those are the down-, left- and right-tiles, it actually uses (still don't know, where it takes the up-tiles from):

 

Tiles3.jpg



#4 Rastael

Rastael

    Wizard

  • Members
  • Real Name:Raphael
  • Location:Austria

Posted 30 April 2024 - 07:31 AM

I tried everything, but can't figure out, how to solve it. :(

 

Is there maybe a simple way to change the script to use specific enemy-tiles instead of the enemy-editor-tiles? :)



#5 Taco Chopper

Taco Chopper

    protector of the darn forum

  • Administrators
  • Pronouns:He / Him
  • Location:South Australia

Posted 30 April 2024 - 08:25 AM

Using Ghost_Data will determine the combo value. You can animate them too.

If I wasn't on holiday in another country, I'd edit and test the script myself - but I also can't view the screenshots (presuming more to do with where I am staying and what the internet provider may or may not have blocked tbh).

On the other hand, ghost functions are good to know! This is all stuff that's in the ghost documentation in the docs folder that comes with ZQ. It can be intimidating to look at if you don't know what you're after! These are some of the functions I'd use to call the combos.
 
const int BOMB_SLUG_COMBO_INDEX = 10; //this calls the value in the enemy attribute slot 11 (i.e. the invisible combo in the original script). the value will be whatever the combo number is for your enemy.


//put these in the ffc script itself

int combo = Ghost_GetAttribute(ghost, BOMB_SLUG_COMBO_INDEX, 0); //this calls the combo value in the enemy attribute slot 11.

Ghost_Data = combo; //this will set the slug's graphics to whatever the combo is. Using combo+1 or combo+2 would be ideal for a firing animation! You'd want to put a firing animation in the if(counter==16) section of the script.

Ghost_Data = combo + Ghost_Dir; //this should set the combo to be whatever direction the enemy is facing. You want to set your combos in order of up, down, left and right. You'd want to put this in the while(true) section of the script.
See how you go putting these functions in, but this might be the best workaround if the enemy editor and the tiles aren't working.
  • Twilight Knight and Rastael like this

#6 Jambu

Jambu

    Junior

  • Members
  • Pronouns:He / Him, They / Them

Posted 30 April 2024 - 08:48 AM

Hey Rastael, do you just need a walker enemy to place bombs? If so I have an alternative solution as I've written a simple eweapon script for placed bombs. Would you like me to post it?


Edited by Jambu, 30 April 2024 - 08:49 AM.

  • Twilight Knight and Rastael like this

#7 Rastael

Rastael

    Wizard

  • Members
  • Real Name:Raphael
  • Location:Austria

Posted 30 April 2024 - 10:56 AM

@ Tacco Chopper:

 

Thanks a lot, I will try it. :)

 

 

@Jambu:

 

Yes, that's exactly, what i need and I would be glad, if you post it here. This will be a great plan B, if I can't get Chopper's functions to work or if another error appears. :)


  • Taco Chopper likes this

#8 Jambu

Jambu

    Junior

  • Members
  • Pronouns:He / Him, They / Them

Posted 30 April 2024 - 11:09 AM

eweapon script PlacedBomb{
	void run(int fuse, bool superbomb){
		this->CollDetection = false;
		for(int i; i < fuse; ++i)
			Waitframe();
		eweapon boom;
		if(superbomb){
			boom = Screen->CreateEWeapon(EW_SBOMBBLAST);
		}
		else{
			boom = Screen->CreateEWeapon(EW_BOMBBLAST);
		}
		npc owner = this->Parent;
		boom->X = this->X;
		boom->Y = this->Y;
		boom->Damage = owner->WeaponDamage;
		this->Remove();
	}
}

Use with CustomWeapons1-10


Edited by Jambu, 30 April 2024 - 11:10 AM.

  • Rastael likes this

#9 Rastael

Rastael

    Wizard

  • Members
  • Real Name:Raphael
  • Location:Austria

Posted 01 May 2024 - 02:50 AM

@Taco Chopper:

 

The script works now, thank you! :)

 

 

 

@Jambu:

 

Thanks for the Plan B script. :)


  • Taco Chopper likes this

#10 Taco Chopper

Taco Chopper

    protector of the darn forum

  • Administrators
  • Pronouns:He / Him
  • Location:South Australia

Posted 01 May 2024 - 03:36 AM

No problem! I'm glad it worked. It's a good way to learn how to script when you're just editing minor things like enemy graphics :)


  • Rastael likes this

#11 Rastael

Rastael

    Wizard

  • Members
  • Real Name:Raphael
  • Location:Austria

Posted 02 May 2024 - 09:56 AM

I can do easy things, but something like this is still too difficult for me. I'll learn it all step by step. ^^


  • Taco Chopper likes this


0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users