Jump to content

Photo

Offset eWeapon Spawn Location


  • Please log in to reply
3 replies to this topic

#1 kurt91

kurt91

    Follower of Destiny

  • Members
  • Real Name:Kurtis
  • Location:Eastern Washington University

Posted 20 June 2021 - 12:18 AM

I made a 2-tall Zora, but once I fixed the various offsets so that it emerged from water correctly, it's pretty much spitting fireballs from it's gut instead of it's head. So, I need a script to offset the fireballs by 16 pixels when they're spawned, so they fire from the correct location.

 

Since I'm trying to re-learn scripting at the moment (not that I was much good at it originally), I'd appreciate if the script was commented thoroughly, so I can read how it works. I'd like to learn how to identify individual eWeapons the moment they're spawned to be able to manipulate them individually. I've skimmed through the various topics in Scripting Discussion, but still don't quite understand how it's done. The way that I thought it would work, I'm realizing would teleport every fireball 16 pixels every single time that a new fireball was spawned. (An interesting idea, but limited in usefulness since it's a per-screen script rather than specifically tied to the eWeapon itself.)



#2 Moosh

Moosh

    Tiny Little Questmaker

  • ZC Developers

Posted 20 June 2021 - 02:18 AM

eweapon script SpawnOffset{
	void run(int xOff, int yOff){
		this->X += xOff;
		this->Y += yOff;
	}
}

You'd be surprised how easy this is in 2.55. Enemies have two script slots, one for the enemy itself and one for the weapon it fires. In this case all the script does is move the weapon on the first frame. D0 is the X offset and D1 is the Y offset.


  • Twilight Knight and P-Tux7 like this

#3 kurt91

kurt91

    Follower of Destiny

  • Members
  • Real Name:Kurtis
  • Location:Eastern Washington University

Posted 21 June 2021 - 12:08 AM

Huh... I guess that's another thing that's changed since I messed with ZC last. The older topics I looked through talked about having to loop through every single eWeapon on the screen for every frame, and somehow stopping at the specific one you wanted, and I couldn't understand how they managed to pick individual ones out consistently. You had mentioned it being a simple script, and I was starting to feel bad that I couldn't figure out how to do it that way. Really was rather simple.

 

Thanks for the help. I've really got to get down all the differences between old ZC and 2.55. Probably ought to see if the Wiki's got any updated information. The documentation being spread across multiple NotePad .TXT files makes it a bit tricky to track specifics down.



#4 Emily

Emily

    Scripter / Dev

  • ZC Developers

Posted 21 June 2021 - 12:30 AM

Huh... I guess that's another thing that's changed since I messed with ZC last. The older topics I looked through talked about having to loop through every single eWeapon on the screen for every frame, and somehow stopping at the specific one you wanted, and I couldn't understand how they managed to pick individual ones out consistently. You had mentioned it being a simple script, and I was starting to feel bad that I couldn't figure out how to do it that way. Really was rather simple.

 

Thanks for the help. I've really got to get down all the differences between old ZC and 2.55. Probably ought to see if the Wiki's got any updated information. The documentation being spread across multiple NotePad .TXT files makes it a bit tricky to track specifics down.

The wiki is most certainly not updated, and is not a reliable source of information.

For scripting information, the base zscript features are all documented between `zscript.txt` and `ZScript_Additions.txt`; the former being 2.50.2, the latter being everything new in 2.55. Aside from that, the std header is at 'include/std_zh', with its documentation in the docs folder as 'std.txt'. Frankly I've never read the std docs, I just read the code itself to figure out what I need to know.

 

Also, I would highly recommend using Notepad++ instead of notepad. It is FAR superior, with much better 'Ctrl+F' functions.




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users