Jump to content

Photo

Anyone have a Candle script lying around?


  • Please log in to reply
9 replies to this topic

#1 Anthus

Anthus

    Lord of Liquids

  • Members
  • Location:Ohio

Posted 08 June 2017 - 07:26 PM

Is there anyone out there who has an item script for the candle that allows A) you to have more than 2 fires on screen (Bonus points if you can set the amount) and that B) Can fire multiple flames at once (no more than 3)? If someone has this, I want to play with it. I'm toying with an idea where the candle is one of your main weapons, and can be upgraded beyond the red candle. The things I listed here would be for the 3rd and 4th tiers respectively. This can't be a global script cause I'm already using one, and I don't know how to combine them, and it is not something I'm willing to learn.

 

Thanks.



#2 grayswandir

grayswandir

    semi-genius

  • ZC Developers

Posted 08 June 2017 - 09:31 PM

If you're not using a global script, that means that the script can only operate during the frame you press the button. That means (assuming I'm remembering correctly):
- You won't be able to add in a cooldown, so you can use the candle as fast as you can press the button, and Link will keep his shield out.

- You can mess with the fires' positioning, speed, sprite, and damage when you make them, but fire always stops after a set amount of time and you won't be able to change that.

- You can count the fires on screen and prevent the candle from being used if there are too many.

 

So with no global you're limited to something like that, but that also means it'll be dead easy to write the script (like, 5 minutes?). So, if you want to list out exactly what you want (like 3-way, or 3 in a row, and how many fires on screen at once) I can write something up real quick for you.

 

Other cool stuff that would be possible:
- Make the first fire purple and stronger, and then if any fires already exist you shoot a normal, weaker flame.

- Fire one big fire forwards and two smaller ones diagonally forwards.

- Add a bit of randomness to the fire's speed and direction if there's already one on screen, so if you repeatedly tap the button you get something like a cone area flamethrower effect.


  • Anthus likes this

#3 Anthus

Anthus

    Lord of Liquids

  • Members
  • Location:Ohio

Posted 08 June 2017 - 10:09 PM

If you're not using a global script, that means that the script can only operate during the frame you press the button. That means (assuming I'm remembering correctly):
- You won't be able to add in a cooldown, so you can use the candle as fast as you can press the button, and Link will keep his shield out.

- You can mess with the fires' positioning, speed, sprite, and damage when you make them, but fire always stops after a set amount of time and you won't be able to change that.

- You can count the fires on screen and prevent the candle from being used if there are too many.

 

I appreciate the reply :) Hm, so, let me think here. The lack of a cooldown is okay (since this is really only for testing) and it is also fine if I can limit the number of flames. Here's the 4 tiers I had in mind:

  • Flame 1: Works like the red candle, you can only have two flames on screen at a time.
  • Flame 2: Same, but let's you have up to 4 flames on screen
  • Flame 3: Fires 3 flames out in a 'cone', and can be used twice, for a total of six on screen flames.
  • Flame 4: Same as above, but allows for 4 uses (up to 12 flames on screen).

But, with what you say below (if I'm reading correctly, can be done without a global)...

 

Other cool stuff that would be possible:

- Make the first fire purple and stronger, and then if any fires already exist you shoot a normal, weaker flame.

- Fire one big fire forwards and two smaller ones diagonally forwards.

- Add a bit of randomness to the fire's speed and direction if there's already one on screen, so if you repeatedly tap the button you get something like a cone area flamethrower effect.

 
If it is easy, then, they could be tweaked to work like this:
 
  • Flame 1: Works like the red candle, same as above.
  • Flame 2: Adds a third flame, which is 2x stronger than the first two. Only three on screen at a time.
  • Flame 3: Fires 3 flames per press, in a cone, but with slightly varying degrees. The third shot makes them 2x as strong, so only 9 may be on screen at a time.
  • Flame 4: This would basically be a 'flamethorwer' which can have up to 9 on screen at a time, with random shots doing 2x damage.
  • All 2x damage shots could be a different color.

 

If that is too much, then something that functions like the first list would be adequate. The candle also still uses magic, but it replenishes over time. Not all enemies are vulnerable to fire/ in front so it shouldn't be too OP. Thanks again. :)

 

I guess, for testing purposes, I'd be willing to consider a global variant. If I ever turn it into anything, I suppose I could quit being a lazy sack of ZC ideas, and just get help combining them. :P



#4 Binx

Binx

    Formerly Lineas

  • Members
  • Real Name:Brian
  • Location:Lancaster, CA

Posted 08 June 2017 - 10:20 PM

Combining globals is generally fairly easy, albeit potentially confusing if you have too many things going on. That being said, I know a lot of things that would normally be done via global can be done with an FFC, although I'm not 100% sure if that would be the case, here.


Edited by Binx, 08 June 2017 - 10:21 PM.


#5 grayswandir

grayswandir

    semi-genius

  • ZC Developers

Posted 09 June 2017 - 09:41 AM

Here it is. I set up a test quest with all the items you described so you can see how to set them up. Let me know if you have any questions.

 

(This is making me miss IotM...)

 

Script: https://pastebin.com/zm8YD6Qy

Test Quest (script in buffer): https://app.box.com/...sudii36wn2zade8

 

Setup:

 

item script PowerCandle

// Fires flames out in front of Link.
// D0 :: flame step speed
// D1 :: flame damage
// D2 :: number of times you can use this item in succession
// D3 :: basic flame sprite
// D4 :: power flame sprite. leave as 0 to disable
// D5 :: number of flames per activation
// D6 :: degrees between flames
// D7 :: randomness in flame angle
 

item script Flamethrower

// Fires a single flame forwards with a random chance to be stronger.
// D0 :: max number of flames on screen
// D1 :: base damage of flame
// D2 :: basic flame sprite
// D3 :: power flame sprite
// D4 :: Percent chance to be stage 2.
// D5 :: flame step speed
// D6 :: random variance in step speed
// D7 :: random variance in angle


Edited by grayswandir, 09 June 2017 - 09:44 AM.

  • Anthus, Twilight Knight and Rastael like this

#6 Anthus

Anthus

    Lord of Liquids

  • Members
  • Location:Ohio

Posted 09 June 2017 - 07:01 PM

Wow, thanks this is more than I could have expected. It looks pretty simple to set up too. I'll try it out tomorrow, I'm not at my computer tonight, thanks again. :)

Edit: what's the range of usable numbers in the random rates?

#7 Saffith

Saffith

    IPv7 user

  • ZC Developers

Posted 09 June 2017 - 07:23 PM

It's in degrees, plus or minus. 180 would cover a full circle.
  • Anthus likes this

#8 grayswandir

grayswandir

    semi-genius

  • ZC Developers

Posted 09 June 2017 - 08:28 PM

Yeah. All angles are in degrees, and all "random" arguments are a +/- range, so 0 means no randomness. For the flamethrower in the test quest I gave it 75 step speed, with a randomness of 25, meaning it goes from 50 to 100. (50 is the default candle speed). The flamethrower stage2 chance (D4) is in percentage, so 50 means half the flames will be stronger.

 

Also, I forgot to mention that you'll need to turn your own flames hurting you off, as otherwise the angled flames actually spawn just barely touching you. It's not too hard to fix but I didn't want to work out the math if it wasn't needed.

 

But yeah, just take a look at the quest. I made the items Flame1, Flame2, Flame3, Flame4, Flame2Adv, Flame3Adv, and Flame4Adv according to your list, so you can just copy the arguments there if you want.


  • Anthus likes this

#9 Timelord

Timelord

    The Timelord

  • Banned
  • Location:Prydon Academy

Posted 10 June 2017 - 01:55 PM

A bt off-topic, but because Dimentio brought it up in chat, this would be similar to the internal candle. The flame may not move in precisely the same manner, but it would otherwise be suitable for a quick candle script. I wrote it merely to see how long it would be, as i guessed ~10 lines, but the check for using it only once per screen doubled that.

item script scriptcandle{
    void run(int useonce){
        int q[8]; lweapon flame[2];
        if ( useonce ) {
            //seek a marker
            for ( q[0] = Screen->NumLWeapons(); q[0] > 0; q[0]-- ) {
                flame[1] = Screen->LoadLWeapon[q[0]];
                if ( flame[1]->ID != LW_SCRIPT10 ) continue();
                if ( flame[1]->Misc[15] = 1 ) Quit();
            }
            flame[1] = Screen->CreateLWeapon(LW_SCRIPT10);
            flame[1]->DeadState = -10;
            flame[1]->DrawYOffset = -900;
            flame[1]->Misc[15] = 1;
        }
        Link->Action = LA_ATTACKING;
        flame[0] = NextToLink(LW_FLAME, 16);
        Game->PlaySound(this->UseSound);
        flame[0]->Damage = this->Power;
        flame[0]->UseSprite(12);
    }
}
          

Edited by ZoriaRPG, 10 June 2017 - 04:51 PM.


#10 Anthus

Anthus

    Lord of Liquids

  • Members
  • Location:Ohio

Posted 25 June 2017 - 07:34 PM

Thanks again guys. And yeah, Link's own fire doesn't hurt in this quest. :)




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users