Jump to content

Photo

Enemy Weapon Types

Enemies Editor Weapons Scripts?

  • Please log in to reply
9 replies to this topic

#1 Tree

Tree

    Everything must go away

  • Members
  • Real Name:Mundy Fumple McStroodlestein
  • Location:The Milky Way Galaxy

Posted 30 June 2016 - 04:38 PM

Hello everyone, and welcome to another post of mine!

 

Today, I'm wondering if it's possible to create a new enemy weapon type, (Fireballs, swords, arrows, rocks, etc.) I want Stalfos to throw bones instead of swords, but I don't know how to do that without simply changing the sword sprite to a bone sprite. Changing the sprite would work for Stalfos, but I don't want Lynels and other enemies to throw bones as well, and I didn't see an option to create new enemy weapon types. Would I possibly need to script them in, or am I just missing something blatantly obvious here?

 

Thanks for any help~!



#2 Russ

Russ

    Caelan, the Encouraging

  • Administrators
  • Location:Washington

Posted 30 June 2016 - 04:45 PM

ffc script SpriteSwap{
	void run(int originalweapon, int sprite){
		while(true){
			for(int i=0; i<=Screen->NumEWeapons(); i++){
				eweapon e=Screen->LoadEWeapon(i);
				if(e->ID==originalweapon){
					e->UseSprite(sprite);
				}
			}
		Waitframe();
		}
	}
}
While I haven't tested this, it should work. This script will replace the sprite of all weapons of a specific type on the screen with a new sprite. For example, if you have your stalfos set to shoot sword beams, you can place this on the screen to turn all sword beams into bone sprites. The limitation is you wouldn't be able to put, say, a stalfos and a lynel down on the same screen. D0 is the type of eweapon to look for. The list is std.zh, but I've copied it below for reference. D1 is the sprite to replace it with.

Weapon values

  • Mani Kanina likes this

#3 Tree

Tree

    Everything must go away

  • Members
  • Real Name:Mundy Fumple McStroodlestein
  • Location:The Milky Way Galaxy

Posted 30 June 2016 - 04:50 PM

Hmmm. That's one way to do it. I don't think I'll ever pair up enemies like Stalfos and Lynels on the same screen, so it shouldn't be a problem. I'll see if I can test it out tonight, or possibly tomorrow, since I don't have access to Zquest right now.


Edited by Tree, 30 June 2016 - 04:52 PM.


#4 Tree

Tree

    Everything must go away

  • Members
  • Real Name:Mundy Fumple McStroodlestein
  • Location:The Milky Way Galaxy

Posted 01 July 2016 - 01:18 AM

UPDATE: I tried compiling my scripts after inserting your sprite changer script into my file, and got this error.

 

LINE 460: SYNTAX ERROR, UNEXPECTED $END, EXPECTING RBRACE, ON TOKEN

FATAL ERROR P00: CAN'T OPEN OR PARSE INPUT FILE!

 

Here's my entire script file just so you know exactly which line is messed up. 

 

Spoiler


#5 Russ

Russ

    Caelan, the Encouraging

  • Administrators
  • Location:Washington

Posted 01 July 2016 - 09:14 AM

Doh, I'm an idiot. I forget a closing brace. Seems like I'm always making really dumb typos when I answer script requests. Should be fixed now, grab the edited script from my first post.

#6 Tree

Tree

    Everything must go away

  • Members
  • Real Name:Mundy Fumple McStroodlestein
  • Location:The Milky Way Galaxy

Posted 01 July 2016 - 03:31 PM

Hey, at least you know what even a script is, and how it scripts. If I knew things, I'd do it myself, but alas, like Jon Snow, I know nothing...

 

...Anyways. I'll try it out when I can. Hopefully my keyboard comes in the mail soon...


Edited by Tree, 01 July 2016 - 03:31 PM.


#7 SaijeNode

SaijeNode

    Newbie

  • Members

Posted 15 March 2018 - 07:18 PM

Hey man was going to try out this script of yours for the ice wizzrobe mob.  however  is there a better way to create a new enemy weapon?

What I am trying to do with the Ice Wizzrobe mob I created. for it's Weapon I altered the sprites for Fire 2 / Flame 2 enemy weapon so that it looks like ice, but i cant find where to customise the sound effects. there is a ice magic sfx already.

What I cant figure out is how I can add a new Enemy weapon based off of an already existing enemy weapon but be able to change the sprite and sound effect. sfx.

 

ffc script SpriteSwap{
	void run(int originalweapon, int sprite){
		while(true){
			for(int i=0; i<=Screen->NumEWeapons(); i++){
				eweapon e=Screen->LoadEWeapon(i);
				if(e->ID==originalweapon){
					e->UseSprite(sprite);
				}
			}
		Waitframe();
		}
	}
}
While I haven't tested this, it should work. This script will replace the sprite of all weapons of a specific type on the screen with a new sprite. For example, if you have your stalfos set to shoot sword beams, you can place this on the screen to turn all sword beams into bone sprites. The limitation is you wouldn't be able to put, say, a stalfos and a lynel down on the same screen. D0 is the type of eweapon to look for. The list is std.zh, but I've copied it below for reference. D1 is the sprite to replace it with.

Weapon values

 



#8 Russ

Russ

    Caelan, the Encouraging

  • Administrators
  • Location:Washington

Posted 15 March 2018 - 08:53 PM

Changing the sound effect, believe it or not, is a lot trickier than changing the sprite. Because the sprite can be changed the instant the weapon's created, we can do a trick like the one I posted up there and change it before anyone notices. But because enemies are hard coded to play a certain sound effect when firing a certain weapon, it gets trickier. The best way to do it, honestly, would be to just script an ice wizzrobe enemy. However, that gets tricky because, while rescripting most enemies would be trivial, wizzrobes are a bit more complex.

There's potentially other hackish ways of doing it, but they all have their own problems. Really, rescripting wizzrobes would be the easiest way to make the ice SFX play, and that's hardly an easy thing. Not impossible by any means, but probably more effort than it's worth for the sound effect.

#9 dr_henke

dr_henke

    Recipient of Ways

  • Members
  • Real Name:Henrik
  • Location:Uppsala, Sweden

Posted 03 March 2020 - 02:33 PM

Sorry for bothering about this old script...

It works really good for me and is extremly easy to use, however the orientation of the weapons dosen't seem to work, but might be some errors on my side also, if I change swords or arrows to new sprites the new sprites just stay in upright position ( like the first tile ) and don't rotate according to throw direction.



#10 Timelord

Timelord

    The Timelord

  • Banned
  • Location:Prydon Academy

Posted 09 March 2020 - 09:05 AM

If you use the 2.55 builds, enemies now allow you to set a weapon sprite to use, for their attacks in the Enemy Editor. You can also assign a  weapon script to their attack if you want custom movement properties.





Also tagged with one or more of these keywords: Enemies, Editor, Weapons, Scripts?

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users