|
Thread: A problem giving artifacts | |
|
Nimrandir
Tavern Dweller
|
posted November 24, 2004 04:16 PM |
|
|
A problem giving artifacts
Please, help!
I've made a script in which the hero must receive random artifact from #7 to #11. But when I must take this artifact, the spellbook is given to me! What's wrong?
This is a part of a script:
......
!!VRv17:S1T5;
!!VRv17:+6;
......
!!HE-1&v5>=0:Av17;
......
v17 is used only in this part.
____________
Do not meddle in the affairs of wizards, for they are subtle and quick to anger.
|
|
fnord
Promising
Famous Hero
|
posted November 25, 2004 02:39 AM |
|
|
Quote: Please, help!
I've made a script in which the hero must receive random artifact from #7 to #11. But when I must take this artifact, the spellbook is given to me! What's wrong?
This is a part of a script:
......
!!VRv17:S1T5;
!!VRv17:+6;
......
!!HE-1&v5>=0:Av17;
......
v17 is used only in this part.
I don't know, but I suggest the following:
Add a "debug" line just before the "!!HE-1&v5>=9:Av17;" line that shows you the value of v17. If the value is not what you expect, then you can check the script further to find out why not.
The debug line should be something like:
!!IF&v5>=0:M^v17=%V17^;
Also, note that you don't actually need to use two commands to generate your random number between 7 and 11. Delete the second line and change the first line to:
!!VRv17:S7T5;
One further note--instead of using the HE:A command, which will just put the artifact into the hero's backpack (in most cases), it would probably be better to use the auto-equip command: HE:A4, but this is of course your choice.
____________
|
|
Nimrandir
Tavern Dweller
|
posted November 25, 2004 12:22 PM |
|
|
I've done all what you've told, but everything is unchanged. In v17 there is 0, though after assigning to it a random number, I do nothing with it. I've tried to change the variable number to 5, but it is 0 too. Maybe these two variables are reserved by other scripts and at the end of the battle they become 0?
____________
Do not meddle in the affairs of wizards, for they are subtle and quick to anger.
|
|
fnord
Promising
Famous Hero
|
posted November 26, 2004 02:09 AM |
|
|
Quote: I've done all what you've told, but everything is unchanged. In v17 there is 0, though after assigning to it a random number, I do nothing with it. I've tried to change the variable number to 5, but it is 0 too. Maybe these two variables are reserved by other scripts and at the end of the battle they become 0?
v17 is used by the Forgotten Shrine script (script60.erm) although offhand I have no idea when exactly it's used or what for.
However, regardless of whether another script is using it or not, if all your code occurs in one place (following a single trigger after the battle, for example), another script wouldn't be able to change it until after your script finishes executing. That is, unless you call some function that's also used by another script.
I think I would have to see the entire code you use to know why the variable is still 0, but it seems that at some point it must be being set to 0, whether in your script or in a function that you inadvertently call, or if your script spans more than one trigger (say, a start of battle AND end of battle trigger), then it could indeed be the use in script60.erm as you suggest.
If you want to post the complete code of your script here, I might have a better idea.
____________
|
|
Nimrandir
Tavern Dweller
|
posted November 26, 2004 12:01 PM |
|
|
Here is a complete script:
ZVSE
!#OB10/12/0:T49;
!#OB10/12/0:S;
!#VRz123:S^Battle Arena^;
!#OB10/12/0:Hz123;
!#VRz101:S^Who are you?^;
!#VRz102:S^Squire^;
!#VRz103:S^Knight^;
!#VRz104:S^Lord^;
!#VRz105:S^For weak players^;
!#VRz106:S^For strong players^;
!#VRz107:S^For real heroes^;
!?OB10/12/0;
!!VRv10:S0T9;
!!VRv10:*14;
!!VRv11:S0T9;
!!VRv11:*14;
!!VRv11:+7;
!!VRv12:S0T9;
!!VRv12:*14;
!!VRv12:+13;
!!VRv17:S7T11;
!!VRv18:S13T17;
!!VRv19:S19T24;
!!VRv20:S25T30;
!!VRv21:S128T143;
!!IF:Q3^This is battle arena. Here you can fight the creatures for the reward. Do you want to fight?^;
!!IF&31/z123//z101/////z102/z103/z104//z102/z103/z104/;
!!IF&3:F1/z105/z106/z107//0;
!!IF&3:E101/1;
!!FU7997&v101=10;
!!FU7998&v101=20;
!!FU7999&v101=30;
!?FU7997;
!!IF:M^Prepare for battle!^;
!!HE-1:T10/12/0/v10/1000;
!!HE-1?v4;
!!IF&v17>=0:M^v17=%V17^;
!!HE&v4>=0:Av17;
!!HE&v4>=0:Av18;
!!IF&v4>=0:Q22/8/v17/8/v18/1^You are good! Here is your reward:^;
!!VRv4:C-1;
!?FU7998;
!!IF:M^Prepare for battle!^;
!!HE-1:T10/12/0/v11/300;
!!HE-1?v4;
!!HE&v4>=0:Av17;
!!HE&v4>=0:Av18;
!!HE&v4>=0:Av19;
!!HE&v4>=0:Av20;
!!IF&v4>=0:Q22/8/v17/8/v18/1^Excellent performence! Here is your reward:^;
!!IF&v4>=0:Q22/8/v19/8/v20/1^^;
!!VRv4:C-1;
!?FU7999;
!!IF:M^Prepare for battle!^;
!!HE-1:T10/12/0/v12/50;
!!HE-1?v4;
!!HE&v4>=0:Av17;
!!HE&v4>=0:Av18;
!!HE&v4>=0:Av19;
!!HE&v4>=0:Av20;
!!HE&v4>=0:Av21;
!!IF&v4>=0:Q22/8/v17/8/v18/1^You are a true hero! You deserve the best artifacts we have!^;
!!IF&v4>=0:Q22/8/v19/8/v20/1^^;
!!IF&v4>=0:Q22/8/v21/1^^;
!!VRv4:C-1;
____________
Do not meddle in the affairs of wizards, for they are subtle and quick to anger.
|
|
Mitzah
Promising
Supreme Hero
of the Horadrim
|
posted November 30, 2004 09:36 AM |
|
|
|
Nimrandir
Tavern Dweller
|
posted November 30, 2004 12:24 PM |
|
|
Quote: So, does it work ???
Yes and no! In general, it works, but when it is time to give an artifact (v17) it gives a spellbook (#0), though it must give #7-#11! What is it?!
|
|
fnord
Promising
Famous Hero
|
posted December 01, 2004 04:00 AM |
|
|
Quote: Here is a complete script:
Okay, it appears the problem is that v17 is used by Forgotten Shrine and Protection from the Elements, and they both set it at the start of a battle. So if either script is enabled when you WoGify, the battle that's called in your script will change the value of v17.
Try disabling those two scripts and see if it works.
In order to correct this, you'll likely have to choose a completely unused v variable.
____________
|
|
Nimrandir
Tavern Dweller
|
posted December 02, 2004 11:16 PM |
|
|
|
|
|