Wog scripting question...

Official forum of the Wake of Gods mod to Heroes of Might and Magic III.
Oenomaus
Leprechaun
Leprechaun
Posts: 6
Joined: 11 Sep 2008

Wog scripting question...

Unread postby Oenomaus » 11 Sep 2008, 14:45

Hi. Not sure if anyone looks at this section much or if this is the right place to ask a question but I was wondering if anyone could explain to me how exactly to go about making a generic script for an object. That is to say I have made a script for a specific object (type 63;63) but at the moment when a hero visits one of them, all of them are counted as visited (there are eight on the map). I assume I have to somehow find their coordinates using UN:N and perform a loop of some sort but can't think exactly how to go about this (this is my first attempt at programming of any sort...). The ERM tutorial only covers a single object at specific location and I tried looking at the built in scripts but could not understand them sufficiently...

I have been working on and off on a fairly epic map (in my opinion) since the release of Armageddon's Blade and want to finally provide some scripts for blank objects I have placed so as to finally finish it...

Any help would be much appreciated.

User avatar
Salamandre
Genie
Genie
Posts: 1032
Joined: 13 May 2006
Location: France
Contact:

Unread postby Salamandre » 11 Sep 2008, 17:27

It depends of what the object gives to you: if it is a spell, do a check when visit and reset the flag is you already have the spell. Same for artefacts, but here you can cheat by removing it before.

For example, from my map:

!?OB43/44/0&1000;
!!HE-1:S12/?i;
!!VRz245&i=0:S^You visited the sanctuary. Here are your rewards^;(give necromancy, there are more lines to follow but is only an example)
!!VRz245&i>0:S^You have learned this,don't come here again!^;
....]


If the hero has already necromancy (S12) the object is visited. You can restreint the visits by fixing the precise number of the hero, so no any other hero can visit with !!HE$


If all objects 63/63 give the same thing, then script them as a single object.


If you need to know how to script blank artefacts, take a look at Thoran Rift map by Fnord. At event "Pendant of Thoran".

Oenomaus
Leprechaun
Leprechaun
Posts: 6
Joined: 11 Sep 2008

Unread postby Oenomaus » 18 Sep 2008, 22:25

Thanks a lot for the response and the map reference. I have finally sorted the issue. The solution was my discovery of the PO998:O-2;etc command.

However, I am now faced with a more serious problem. I now have a few scripts which work beautifully when I don't wogify my map but which only partially work when I do (I don't have any buildings being replaced or anything but I do want most of the preprogrammed wog scripts to run). I have changed all the variables over and over and whatever I do it is always the same. Part of my script for the 63/63 object always seems to activate a dialogue box with two stacks of gold coins on it, followed by a comment about just breaking even, which I assume is something to do with the tavern card game, although I couldn't find this anywhere in that script and I don't have that enabled anyway...

Otherwise is there some neater way of loading my scripts alongside the ready done ones, rather than just putting them in the map editor and ticking the wog box on loading the game as I am doing at the moment?

Also, regarding the scripting of artifacts, how does one alter the message which displays when one picks the artifact up off the ground?

User avatar
Salamandre
Genie
Genie
Posts: 1032
Joined: 13 May 2006
Location: France
Contact:

Unread postby Salamandre » 18 Sep 2008, 22:36

Oenomaus wrote:Thanks a lot for the response and the map reference. I have finally sorted the issue. The solution was my discovery of the PO998:O-2;etc command.

However, I am now faced with a more serious problem. I now have a few scripts which work beautifully when I don't wogify my map but which only partially work when I do (I don't have any buildings being replaced or anything but I do want most of the preprogrammed wog scripts to run). I have changed all the variables over and over and whatever I do it is always the same. Part of my script for the 63/63 object always seems to activate a dialogue box with two stacks of gold coins on it, followed by a comment about just breaking even, which I assume is something to do with the tavern card game, although I couldn't find this anywhere in that script and I don't have that enabled anyway...

Otherwise is there some neater way of loading my scripts alongside the ready done ones, rather than just putting them in the map editor and ticking the wog box on loading the game as I am doing at the moment?

Also, regarding the scripting of artifacts, how does one alter the message which displays when one picks the artifact up off the ground?

You have to set WOG options with the UN:P commands which will prohibite chaotic wogification. If you get wrong text that means that the variable (z) are used by other scripts.

usually the most of scripts can be copy/pasted from DATA/s so you don't really have to wogify the map, and will use only your options. Once you choose your scripts, check for flags, functions and variable used and avoid duplication.

Then, before starting the map, reset WOG options to default.

Oenomaus
Leprechaun
Leprechaun
Posts: 6
Joined: 11 Sep 2008

Unread postby Oenomaus » 20 Sep 2008, 16:45

I have one recurring problem. Several of my scripts seem to have a conflict with what can only be the tavern card game even though this script is not running. I get a dialogue box with a picture of two stacks of gold, then a dialogue box with "You have a streak of bad luck and pull out in time only to lose your stake" (+ picture of bad luck), and finally after a battle I get a dialogue box with "You play a lousy game and LOSE your entire stack of 0 gold coins" (+ picture of bad luck). I wouldn't care too much except that while it does this it ignores certain sections of code, though it does not produce an error message or anything... I have tried changing all the variables but it makes no difference and anyway these scripts don't share any variables with each other.What is it about these two bits of code that triggers this problem?:

!?OB63/63;
!!PO998:O?i; check owner
!!FU80&i>-2:P; if valid visit then call FU 80
...
!?FU80; If hero hasen't visited before this trigger is activated.
!!OW:C?y1; [get current player colour]
!!OW:Iy1/?y2; [is current player an AI?]
!!HE-1:E?y3; get hero's experience
!!FU84&y2=0/y3<200933:P; if less than level 25, perform FU84
...
!?FU84;
!!IF:Q2^The monks show disdain for your paltry experience and chase you from their halls. You take umbrage at this. Do you want to punish them for their insolence?^;
!!HE-1&2:T109/71/0/169/500; Provoke a battle with 500 war zealots
!!HE-1&2:O?i; get current hero owner
!!FU87&2/i>=0:P; if not dead go to prizes
!?FU87;
!!IF:Q1/33/5/34/5/1^You have won the battle with the fervent monks and received your reward of knowledge and Power but they cursed you with their dying breath and your fate is to be shunned by others until you can find absolution^; If Hero survived he will receive a message
!!HE-1:Fd0/d0/d5/d5; add +5 to knowledge and power
!!HE-1:Y3/0/360/1; diplomacy curse
!!PO998:O-3; set owner to -3 (plundered)
!!VRz356:S^Monastery of the Fervent (Plundered)^; store text in ^ ^ to z356 string.
!!OBv998/v999/v1000:H356; set hint text

and

!?OB63/55;
!!PO998:O?i; check owner
!!FU91&i<>-2:P; if valid visit then call FU 91
...
!?FU91;
!!OW:C?y1; [get current player colour]
!!OW:Iy1/?y2; [is current player an AI?]
!!IF&y2=0:Q1^A foul stench emanates from this hut. It is likely the original peasants who lived here have died and become zombies. Still, there may well be valuable experience to be gained by braving the stench and confronting the inhabitants. Do you wish to enter?^;
!!HE-1&1:O?v114; Store owner's colour's number in v114 variable.
!!HE-1&1:T39/88/1/59/50; Provoke a battle with 50 zombies
!!HE-1&1:O?v115; Store owner's colour's number in v115 variable.
!!IF&1/v114=v115/y2=0:M^You get your experience all right but the effects of the noxious vapours will take a while to wear off^;
!!HE-1&1/v114=v115:Ed10000; add experience
!!HE-1&1/v114=v115:Y1/0/14/1; blindness curse
!!PO998&1/v114=v115:O-2; set owner to -2 (visited)
!!VRz951&1/v114=v115:S^Plague-Ridden Hut (Visited)^; store text in ^ ^ to z951 string.
!!OBv998/v999/v1000&1/v114=v115:H951; set hint text


while this very similar code is unaffected and works perfectly...:

!?OB63/56;
!!PO998:O?i; check owner
!!FU88&i<>-2:P; if valid visit then call FU 88
!!FU89&i=-2:P; if visited then call FU 89
...
!?FU88;
!!OW:C?y1; [get current player colour]
!!OW:Iy1/?y2; [is current player an AI?]
!!IF&y2=0:Q1^A foul stench emanates from this hut. It is likely the original peasants who lived here have died and become zombies. Still, there may well be valuable experience to be gained by braving the stench and confronting the inhabitants. Do you wish to enter?^;
!!HE-1&1:O?v112; Store owner's colour's number in v112 variable.
!!HE-1&1:T39/88/1/58/75; Provoke a battle with 75 walking dead
!!HE-1&1:O?v113; Store owner's colour's number in v113 variable.
!!IF&y2=0/v112=v113:M^You get your experience all right but the effects of the noxious vapours will take a while to wear off^;
!!HE-1&v112=v113:Ed10000; add experience
!!HE-1&v112=v113:Y8/0/14/1; myopia curse
!!PO998&v112=v113:O-2; set owner to -2 (visited)
!!VRz951&v112=v113:S^Plague-Ridden Hut (Visited)^; store text in ^ ^ to z951 string.
!!OBv998/v999/v1000:H951; set hint text

Otherwise everything is working well...

User avatar
Salamandre
Genie
Genie
Posts: 1032
Joined: 13 May 2006
Location: France
Contact:

Unread postby Salamandre » 20 Sep 2008, 20:40

Have you tried to disable the 13 erm script and see if it changes anything?

Oenomaus
Leprechaun
Leprechaun
Posts: 6
Joined: 11 Sep 2008

Unread postby Oenomaus » 20 Sep 2008, 22:34

it is disabled and that makes no difference... I could not find that exact hint text when I scanned script 13 but I know that that is what the dialogue boxes I am getting are associated with. Further experiments have produced a few other dialogue boxes saying I had got a full house and won an amulet etc...

User avatar
Salamandre
Genie
Genie
Posts: 1032
Joined: 13 May 2006
Location: France
Contact:

Unread postby Salamandre » 21 Sep 2008, 05:40

No, I mean DISABLE the 13 erm script, not in wog settings. Rename it to anything else. The exact text can not be found in 13erm but in 13ert.


Return to “Wake of Gods”

Who is online

Users browsing this forum: No registered users and 5 guests