Jump to content

Photo

Simple improved candle script

Item

  • Please log in to reply
3 replies to this topic

#1 Mitsukara

Mitsukara

    Ara?

  • Members
  • Real Name:Jennifer
  • Gender:Female

Posted 26 October 2013 - 12:14 PM


Simple improved candle script

 
Description

This is a very small item script that lets you make a better version of the candle weapon (for a level 3 candle upgrade, or similar idea), without needing to use any global scripts. It shoots three flames in a straight line from where Link faces (similar to the regular candles), and they travel farther than the normal red and blue candle's flames (see the setup for how to adjust that). 
 
Also, if the player taps the button quickly, additional flames can be fired to create a lot of fire at once (which gets pretty dangerous unless the rule "Link isn't hurt by own fire weapons" is checked... but that's up to the quest designer.).
 

Screenshots and Demo

9by.gif9eae.gif1yh.gif

Example Quest

 

Code

item script ShootBetterFire{

void run(int flamesprite, int speedone, int speedtwo, int speedthree, int damage, int soundeffect){

//D0 - weapon sprite to use for the flames; the usual flame sprite is 12
//D1 - speed of first flame; I recommend 140
//D2 - speed of second flame; I recommend 90 
//D3 - speed of third flame; I recommend 40
//D4 - damage caused by flames
//D5 - what sound to play; the usual sound for fire is 13

        //The first flame.
lweapon fireone = NextToLink(LW_FIRE,0);
Game -> PlaySound (soundeffect);
fireone->Dir = Link->Dir;
fireone->Step = speedone;
fireone->UseSprite(flamesprite);
fireone->Damage = damage;
        //The second flame.
lweapon firetwo = NextToLink(LW_FIRE,0);
firetwo->Dir = Link->Dir;
firetwo->Step = speedtwo;
firetwo->UseSprite(flamesprite);
firetwo->Damage = damage;
        //The third flame.
lweapon firethree = NextToLink(LW_FIRE,0);
firethree->Dir = Link->Dir;
firethree->Step = speedthree;
firethree->UseSprite(flamesprite);
firethree->Damage = damage;
        //The above format for each flame can be imitated for more flames, or removed for fewer flames.

}

}

Setup

(the basic stuff, for new scripters:)
Save the above code as a script  ("shootbetterfire.z") with notepad or a similar text program. Then, on your script buffer, type
import "shootbetterfire.z"
(or whatever you named your script file). As always, make sure to keep the line "import std.zh" at the top of your buffer. Next, hit compile, and if it says success, add it to your item scripts. Then, make a custom candle item (or whatever class of item you want to use; you could also attach it to an existing one, like Candle 2 (Red)). Go to the item's scripts tab and select shootbetterfire.z for the Action script.

 

(the specifics for this script:)

Under the item's scripts tab, input these numbers:
 
D0 - The weapon sprite to use for the fires; ZC's default flame sprite is 12.
D1 - Speed of first flame; I recommend 150.
D2 - Speed of second flame; I recommend 60.
D3 - Speed of third flame; I recommend 120.
D4 - How much damage the flames do.
D5 - What sound the item makes while used; ZC's default fire sound is 13.
 
Note: The speed of D1, D2, and D3 affect not only how fast the flames travel, but how far they go. Make them go faster and they'll shoot farther, or slower for not so far. The default candle fire speed for the built in Blue and Red candles seems to be 40; adding increments of 50 move it ahead by about 16 pixels or so.
 

Resources

None needed.

 

Other notes

This script can be attached a candle class item or a custom item class item and will still have mostly the same effects, but I recommend a candle item. If you want to, you could also attach it to a sword or wand or some other type of item, and they would shoots flames the same way (in addition to whatever they normally do). 
 
If you put it on a custom item class item instead of an existing item class, you may want to add the line
Link->Action = LA_ATTACKING;
right before "//The first flame", so that Link will animate like he's using an item. That's optional, however.
 
If you do just use a candle-type item, however, it should also be noted that the regular built-in candle supports animations for stabbing and slashing (but the latter is only if you check 'slash' on the properties, and if Link learns the slash in your quest), so you could use that to show Link shooting the fires with a weapon animation if you're so inclined. The example quest demonstrates this feature. This makes candles handy for things like a wand, flamethrower, seed shooter, a poor person's pseudo-Cane of Somaria, etc.


#2 Three Pendants

Three Pendants

    Recipient of Ways

  • Members
  • Gender:Unspecified

Posted 10 December 2013 - 09:47 PM

This is a very simple to utilize and neat idea you put together! One question though, is this tied to the Candle item or can it theoretically be put on any item. Like a sword swing that spawns fire, for instance?



#3 MoscowModder

MoscowModder

    Still fighting the inevitable

  • Members
  • Gender:Male
  • Location:Wisconsin (WHAT)

Posted 11 December 2013 - 12:08 AM

This script can be attached a candle class item or a custom item class item and will still have mostly the same effects, but I recommend a candle item. If you want to, you could also attach it to a sword or wand or some other type of item, and they would shoots flames the same way (in addition to whatever they normally do).


#4 Three Pendants

Three Pendants

    Recipient of Ways

  • Members
  • Gender:Unspecified

Posted 11 December 2013 - 08:48 AM

And there goes my reading comprehension... I blame it on this awful illness giving me 3 hours of sleep a night. Heh, thanks for clarifying in any case.





Also tagged with one or more of these keywords: Item

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users