Heroes of Might and Magic Community
visiting hero! Register | Today's Posts | Games | Search! | FAQ/Rules | AvatarList | MemberList | Profile


Age of Heroes Headlines:  
5 Oct 2016: Heroes VII development comes to an end.. - read more
6 Aug 2016: Troubled Heroes VII Expansion Release - read more
26 Apr 2016: Heroes VII XPack - Trial by Fire - Coming out in June! - read more
17 Apr 2016: Global Alternative Creatures MOD for H7 after 1.8 Patch! - read more
7 Mar 2016: Romero launches a Piano Sonata Album Kickstarter! - read more
19 Feb 2016: Heroes 5.5 RC6, Heroes VII patch 1.7 are out! - read more
13 Jan 2016: Horn of the Abyss 1.4 Available for Download! - read more
17 Dec 2015: Heroes 5.5 update, 1.6 out for H7 - read more
23 Nov 2015: H7 1.4 & 1.5 patches Released - read more
31 Oct 2015: First H7 patches are out, End of DoC development - read more
5 Oct 2016: Heroes VII development comes to an end.. - read more
[X] Remove Ads
LOGIN:     Username:     Password:         [ Register ]
HOMM1: info forum | HOMM2: info forum | HOMM3: info mods forum | HOMM4: info CTG forum | HOMM5: info mods forum | MMH6: wiki forum | MMH7: wiki forum
Heroes Community > Heroes 3.5 - WoG and Beyond > Thread: A problem giving artifacts
Thread: A problem giving artifacts
Nimrandir
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.

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
fnord
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.


____________

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
Nimrandir
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.

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
fnord
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.


____________

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
Nimrandir
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.

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
Mitzah
Mitzah


Promising
Supreme Hero
of the Horadrim
posted November 30, 2004 09:36 AM

So, does it work ???
____________
| The HoMM Channel |

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
Nimrandir
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?!

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
fnord
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.


____________

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
Nimrandir
Nimrandir

Tavern Dweller
posted December 02, 2004 11:16 PM

It works! Thanks!

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
Jump To: « Prev Thread . . . Next Thread »
Post New Poll    Post New Topic    Post New Reply

Page compiled in 0.0378 seconds