Jump to content

Photo

Something nifty I just whiped up...


  • Please log in to reply
1 reply to this topic

#1 Xiion

Xiion

    Senior

  • Members

Posted 23 July 2008 - 05:42 PM

Had an idea, made it happen. Not sure if I'm going to use it myself, so I figured I'd put it here.

I wrote up an item alternator script. Basically, the purpose of this script is to allow for some weapon variations... For example, I set up two swords, attach this script to both, have have them reference each other. One sword is set to stab only, the other is set to slash. Now, when link attacks, he randomly gets either a slash -or- a stab. For kicks, I tweaked the stab to do more damage than the slash, to compensate for reduced attack area. Pretty nifty. The rate at which they swap can also be tweaked. I'm sure someone can think of some nifty things to do with this... I know I've already thought of a few...

Anyways, heres the script.
CODE
//Sword strike alternator Item script
//This script causes a weapon to randomly change to the input item number when used, and remove the current item from links inventory
//for best use, attatch to two weapons and cycle between them (but thats not the only use ^^)
//Script by Xiion
item script alternator
{
    void run(int new_item, int current_item, int rand_rate)
    // new_item: this is the item number of the item you want to switch to
    // current_item: this is the item number of the item that will be removed when the script is triggered
    // rand_rate: gives a 1:rand_rate rate of change. higher values make the change less frequent
    {
        if (Rand(rand_rate)<=1) // alter values to adjust frequency of change
        {
            Link->Item[current_item] = 0;
            Link->Item[new_item] =1;
        }
    }
}


Anyways, there you go. Ask if you have questions, let me know if you see an improvement. Have fun!

#2 Gleeok

Gleeok

    It's dangerous to dough alone, bake this.

  • Members
  • Real Name:Pillsbury
  • Location:Magical Land of Dough

Posted 25 July 2008 - 07:16 PM

Giving the player a random sword attack sounds like a horrible Idea to me... However, using this on something like bombs, arrows, brangs, and other items might be pretty useful.

I just hate the slash ability.

Edited by Gleeok, 25 July 2008 - 07:17 PM.



1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users