Jump to content

Photo

Adding a little spice to the Raft Item


  • Please log in to reply
11 replies to this topic

#1 Peteo

Peteo

    Back in Business!

  • Members
  • Real Name:Pete
  • Location:Finland

Posted 16 January 2020 - 03:24 PM

Hey guys,

 

The Raft at its normal state is pretty boring and uneditable (without scripts that is).

 

All I want though is to add a sprite when using the Raft. Since this item won't actually be a raft in my upcoming quest, I'd like the item's tile (that's on the subscreen) and the effect when using a dock tile to be different. In it's default state the raft just uses the item tile instead of a sprite effect.

 

I also would like to add a sound effect when the raft is active/when using a raft path.

 

I assume this is something really easy to script but I just have no time to figure this stuff out if I'm ever to finish this quest. (No worries though, I've already added most of Moosh's scripts and some other awesome scripts to my quest without much trouble)

 

As always, any help is greatly appreciated.


Edited by Peteo, 16 January 2020 - 03:30 PM.


#2 Emily

Emily

    Scripter / Dev

  • ZC Developers

Posted 16 January 2020 - 04:35 PM

So, changing the tile is fairly simple; edit the tile it uses. For a sound, that's a tiny bit more complicated; but not too bad. Not gonna try writing it out on mobile though; I can get you something after class today.

#3 Russ

Russ

    Caelan, the Encouraging

  • Administrators
  • Location:Washington

Posted 16 January 2020 - 09:21 PM

So, changing the tile is fairly simple; edit the tile it uses.

That wouldn't work, since, as he said, he wants the tile to be different than the one on the subscreen.

But, there is a nonscripted solution to the problem. When you give the player the raft, you could give them a dummy item at the same time. The dummy item's tile is set to what you want the raft to look like on the subscreen. You edit the subscreen to have this item display with other passive items and get rid of the raft from the subscreen. Then, you change the raft's tile to whatever you want it to look like while rafting.

If you wanted a more complex-looking raft attack, that'd need to be scripted, but you'd still wanna do this method and just have the raft not have any tile. That way, all the drawing could be handled via script.
  • ShadowTiger and Jared like this

#4 Emily

Emily

    Scripter / Dev

  • ZC Developers

Posted 16 January 2020 - 09:23 PM

Ah, missed that. Really should just not read posts when I'm half asleep.

#5 Peteo

Peteo

    Back in Business!

  • Members
  • Real Name:Pete
  • Location:Finland

Posted 16 January 2020 - 10:40 PM

That wouldn't work, since, as he said, he wants the tile to be different than the one on the subscreen.

But, there is a nonscripted solution to the problem. When you give the player the raft, you could give them a dummy item at the same time. The dummy item's tile is set to what you want the raft to look like on the subscreen. You edit the subscreen to have this item display with other passive items and get rid of the raft from the subscreen. Then, you change the raft's tile to whatever you want it to look like while rafting.

If you wanted a more complex-looking raft attack, that'd need to be scripted, but you'd still wanna do this method and just have the raft not have any tile. That way, all the drawing could be handled via script.

 

That actually solves the graphical problem. Should have figured this out by myself, thanks Russ. Though now I have to figure out how to give the player the raft and the dummy item at the same time.

 

The second question still stands though. Would love to add a little SFX to Link's raft usage (the moment he's on a raft path.


Edited by Peteo, 16 January 2020 - 10:40 PM.


#6 Emily

Emily

    Scripter / Dev

  • ZC Developers

Posted 16 January 2020 - 10:49 PM

So, scripts:

typedef const int DEFINE;

itemdata script giveDummyItem
{
	void run(int dummyID)
	{
		Hero->Item[dummyID] = true;
	}
}

global script Active_RaftSFX
{
	DEFINE RAFT_SFX_REPEAT = 10;
	DEFINE RAFT_SFX = 0;
	void run()
	{
		int raft_sfx_clk;
		while(true)
		{
			if(RAFT_SFX)
			{
				if(Hero->Action == LA_RAFTING)
				{
					raft_sfx_clk = (raft_sfx_clk + 1) % RAFT_SFX_REPEAT;
					unless(raft_sfx_clk) Audio->PlaySound(RAFT_SFX);
				}
				else raft_sfx_clk = -1;
			}
			Waitframe();
		}
	}
} 

The itemdata script should be assigned as a `Pickup` script to the raft (or anything else you want to give a dummy item). Literal 1-line scripts are always easy.

The global script needs to be merged with your existing global script (if you have one); else you can just use it out-of-the-box.



#7 Russ

Russ

    Caelan, the Encouraging

  • Administrators
  • Location:Washington

Posted 16 January 2020 - 11:12 PM

Though now I have to figure out how to give the player the raft and the dummy item at the same time.

There's a couple of different ways, depending on how you give the item. Simplest way is probably just with this script.

item script GiveDummy{
	void run(int itemid){
		Link->Item[itemid] = true;
	}
}
Put that in the pickup slot for one of the items, and set D0 to the be the other item, and there you go. Picking up one will give you the other. Alternatively, if you're using some sort of pickup message script, you could give the other item via string control codes.

#8 Emily

Emily

    Scripter / Dev

  • ZC Developers

Posted 16 January 2020 - 11:14 PM

... just posted basically the same script...

#9 Peteo

Peteo

    Back in Business!

  • Members
  • Real Name:Pete
  • Location:Finland

Posted 17 January 2020 - 09:46 AM

Decided to go with string control codes and managed to solve the dummy item issue with those. Thanks for the tip. However, I completely forgot the damn raft doesn't animate even though you set its animation up in the item editor. >_< I wonder if there's an easy fix for that...?

 

Also, venrob's Raft SFX code gives me an error on this line:

 

typedef const int DEFINE;

 

SYNTAX ERROR, UNEXPECTED IDENTIFIER, EXPECTING $END, ON TOKEN TYPEDEF

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



#10 Emily

Emily

    Scripter / Dev

  • ZC Developers

Posted 17 January 2020 - 08:20 PM

Decided to go with string control codes and managed to solve the dummy item issue with those. Thanks for the tip. However, I completely forgot the damn raft doesn't animate even though you set its animation up in the item editor. >_< I wonder if there's an easy fix for that...?

 

Also, venrob's Raft SFX code gives me an error on this line:

 

typedef const int DEFINE;

 

SYNTAX ERROR, UNEXPECTED IDENTIFIER, EXPECTING $END, ON TOKEN TYPEDEF

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

Oh, are you in 2.53? Crap, assumed 2.55. (Always put version in the first post in a thread! The script request subforum says specifically: "Script Requests

Suck at scripting, or just too busy to really learn it? It's okay, we understand. This is the forum for you. Anything you wanna know, just ask. No guarantees it'll be answered but hey, that's how it goes. Please specify what version of ZC you're using!")

This should work for 2.53

item script giveDummyItem
{
	void run(int dummyID)
	{
		Link->Item[dummyID] = true;
	}
}

global script Active_RaftSFX
{
	const int RAFT_SFX_REPEAT = 10;
	const int RAFT_SFX = 0;
	void run()
	{
		int raft_sfx_clk;
		while(true)
		{
			if(RAFT_SFX)
			{
				if(Link->Action == LA_RAFTING)
				{
					raft_sfx_clk = (raft_sfx_clk + 1) % RAFT_SFX_REPEAT;
					if(!raft_sfx_clk) Audio->PlaySound(RAFT_SFX);
				}
				else raft_sfx_clk = -1;
			}
			Waitframe();
		}
	}
} 


#11 Peteo

Peteo

    Back in Business!

  • Members
  • Real Name:Pete
  • Location:Finland

Posted 20 January 2020 - 10:13 AM

Sorry about that, venrob. In the future I'll be sure to post the ZC version.

 

Still getting similar errors with the raft SFX script when using ZC 2.53... But I did get the script to work on ZC 2.55 and that's where I'll be moving my quest's development in the near future so no reason to bang heads against the wall with this script anymore. Thanks for the help.



#12 Emily

Emily

    Scripter / Dev

  • ZC Developers

Posted 20 January 2020 - 11:50 AM

Still getting similar errors with the raft SFX script when using ZC 2.53... 

The one I posted 2 posts up? That shouldn't have such errors....

 

But, aye, moving to 2.55 is smart, as 2.55 has many a nice new feature




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users