Jump to content

Photo

How to make a sword do no damage


  • Please log in to reply
55 replies to this topic

#1 Ventus

Ventus

    Legend

  • Members

Posted 04 July 2011 - 12:18 PM

I don't know if this is noob question but..
okay in my game i have 3 swords the 1st and second sword will be normal swords
okay the thing is i want my 3rd sword to only do damage when i have magic available
is there any way to do that?
----EDIT-----
thanks site staff for moving this topic icon_biggrin.gif

Edited by linktopower, 04 July 2011 - 01:27 PM.


#2 Mero

Mero

    Touch Fluffy Tail

  • Banned
  • Real Name:Tamamo No Mae
  • Location:Rainbow Factory

Posted 04 July 2011 - 01:54 PM

First create 3 items, the sword you pick up, one that does damage, and one that doesn't. Second you need a script. The one below needs to put in the global active slot.
CODE
const int SWORD3 = ?; //This should be set to the id of the item Link picks up.
const int SWORD3A = ?; //this should be set to the id of the sword that does damage
const int SWORD3B = ?; //and this should be set to the id of the sword that doesn't

global script itemswap{
    void run(){
        while(true){
            if(Link->Item[SWORD3] == true){
                if(Link->MP > 0){
                    Link->Item[SWORD3A] = true;
                    Link->Item[SWORD3B] = false;
                }
                else{
                    Link->Item[SWORD3A] = false;
                    Link->Item[SWORD3B] = true;
                }
            }
                       Waitframe();
        }
    }
}

What this does is check if he has picked up sword 3 and if so it checks if you have magic. If so it gives you the sword that does damage and takes away the sword that doesn't. It does the opposite if you don't have magic.

EDIT: Oh, and the level of the items should be the same except for the one you pick up. It should be one less.

Edited by blackbishop89, 04 July 2011 - 08:11 PM.


#3 Ventus

Ventus

    Legend

  • Members

Posted 04 July 2011 - 02:12 PM

could you explain a bit more
swap the them with a script?


#4 Mero

Mero

    Touch Fluffy Tail

  • Banned
  • Real Name:Tamamo No Mae
  • Location:Rainbow Factory

Posted 04 July 2011 - 02:13 PM

QUOTE(linktopower @ Jul 4 2011, 01:12 PM) View Post

could you explain a bit more
swap the them with a script?

Edited my first post, take a look.

#5 Ventus

Ventus

    Legend

  • Members

Posted 04 July 2011 - 02:52 PM

hey blackbishop89
since you seem like you know what you're doing
do you think if pm you a link to my qst file
where you can do it for me because i'm not that good with scripting?

#6 Mero

Mero

    Touch Fluffy Tail

  • Banned
  • Real Name:Tamamo No Mae
  • Location:Rainbow Factory

Posted 04 July 2011 - 03:02 PM

QUOTE(linktopower @ Jul 4 2011, 01:52 PM) View Post

hey blackbishop89
since you seem like you know what you're doing
do you think if pm you a link to my qst file
where you can do it for me because i'm not that good with scripting?


Neither was I until about four days ago when I said. "To hell with my sanity I'm learning how to do this s***!" If you keep a open mind, and positive thoughts you can learn it. And I would rather you NOT send me a private message, but I can walk you through the process of creating the items and scripts. How's that sound?

#7 Ventus

Ventus

    Legend

  • Members

Posted 04 July 2011 - 03:11 PM

that's sound's okay i guess

#8 Mero

Mero

    Touch Fluffy Tail

  • Banned
  • Real Name:Tamamo No Mae
  • Location:Rainbow Factory

Posted 04 July 2011 - 03:31 PM

First let me say that I'm using 2.50 build RC2

Okay, let's start by creating the actual item. Create the sword and give it the graphic and check the equipment item box. Let's name it something cool like Mana Sword. Just for fun, you can name it what you want but I'll be calling it Mana Sword since we already have a magic sword by default. Set it's level to 3. Since there are two sword levels before it.

Now for creating the swords used by Link.

Mana SwordA
Set up the item as you want and set it's level to 4. Why 4? Because we want the player to use this sword and not the other one we just created, and confusion is caused when there is more then one equipment item of the same level. Well sometimes that is. This one will do damage. so let's set the damage to what we want it to inflict. Take note of the items number, that's it's id.

Mana SwordB
Same as before except set damage to 0. Basically Mana Sword A & B are identical except for damage.

When you've got that done let me know, and we'll move on to getting the script working. icon_wink.gif

#9 Ventus

Ventus

    Legend

  • Members

Posted 04 July 2011 - 03:46 PM

okay i think i got it all done i have
3 swords
Mana sword
then Mana sword A
And mana sword B

#10 Mero

Mero

    Touch Fluffy Tail

  • Banned
  • Real Name:Tamamo No Mae
  • Location:Rainbow Factory

Posted 04 July 2011 - 03:58 PM

QUOTE(linktopower @ Jul 4 2011, 02:46 PM) View Post

okay i think i got it all done i have
3 swords
Mana sword
then Mana sword A
And mana sword B


Okay open notepad and copy paste this code.
CODE
const int SWORD3 = ?; //This should be set to the id of the item Link picks up.
const int SWORD3A = ?; //this should be set to the id of the sword that does damage
const int SWORD3B = ?; //and this should be set to the id of the sword that doesn't

global script itemswap{
    void run(){
        while(true){
            if(Link->Item[SWORD3] == true){
                if(Link->MP > 0){
                    Link->Item[SWORD3A] = true;
                    Link->Item[SWORD3B] = false;
                }
                else{
                    Link->Item[SWORD3A] = false;
                    Link->Item[SWORD3B] = true;
                }
            }
        }
    }
}

Then save it as .z file and import it in zquest. Compile it and the add the script to the active slot under global scripts.

#11 Ventus

Ventus

    Legend

  • Members

Posted 04 July 2011 - 04:09 PM

okay tried to compile but had a error here's the error

PASS 1 : PARSING
SCANNER: LEXICAL ERROR '?'.^
LINE 1: SYNTAX ERROR, UNEXPECTED SEMICOLON, EXPECTING NUMBER OR MINUS, ON TOKEN
FATAL ERROR P00: CAN'T OPEN OR PARSE INPUT FILE!
-- PRESS A KEY --

#12 Mero

Mero

    Touch Fluffy Tail

  • Banned
  • Real Name:Tamamo No Mae
  • Location:Rainbow Factory

Posted 04 July 2011 - 04:14 PM

QUOTE(linktopower @ Jul 4 2011, 03:09 PM) View Post

okay tried to compile but had a error here's the error

PASS 1 : PARSING
SCANNER: LEXICAL ERROR '?'.^
LINE 1: SYNTAX ERROR, UNEXPECTED SEMICOLON, EXPECTING NUMBER OR MINUS, ON TOKEN
FATAL ERROR P00: CAN'T OPEN OR PARSE INPUT FILE!
-- PRESS A KEY --


Put import "std.zh" in the first line and replace the question marks with the ids of item ids of the swords.

#13 Ventus

Ventus

    Legend

  • Members

Posted 04 July 2011 - 04:19 PM

Okay got it compiled icon_biggrin.gif

#14 Mero

Mero

    Touch Fluffy Tail

  • Banned
  • Real Name:Tamamo No Mae
  • Location:Rainbow Factory

Posted 04 July 2011 - 04:20 PM

QUOTE(linktopower @ Jul 4 2011, 03:19 PM) View Post

Okay got it compiled icon_biggrin.gif


Awesome, scripting's easier then it looks. Just need to know how to get the damn thing to compile. icon_razz.gif
Now you should be set to go. Give it a test and tell me if it works. If not we'll need to experiment some more.

Edited by blackbishop89, 04 July 2011 - 04:25 PM.


#15 Ventus

Ventus

    Legend

  • Members

Posted 04 July 2011 - 04:26 PM

i have a Question do i have to combine my other script with this one?
and set the script to active
---oh whoops--
forgot to tell you i have another script in my game already and it is set to active

Edited by linktopower, 04 July 2011 - 04:29 PM.



0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users