creating custom battles...

Official forum of the Wake of Gods mod to Heroes of Might and Magic III.

Moderator: Moderators

Posts: 6
Joined: 11 Sep 2008

creating custom battles...

Postby Oenomaus » Feb 17 2009, 18:34

Am trying to create some custom battles for blank objects which involve more than one stack of troops, but every time I try to run them I get a number of messages of the type "ResourceManager::GetSample could not find the "sfx" resource "(null)attk.82M"".
Am using the following simple syntax, having looked at other WOG scripts:

!!HE-1&951/y2=0:Tv998/v999/v1000/141/75; trigger battle for human
!!HE-1&y2=1:Tv998/v999/v1000/141/75; trigger battle for AI

!?BF&950; edit battle
!!FU9503:P75/141/32 P75/141/66 P75/141/100 P75/141/134 P75/141/166;
!!FU9503:P50/142/48 P50/142/82 P50/142/116 P50/142/150;
!!FU9503:P250/159/25 P250/159/59 P250/159/93 P250/159/62 P250/159/96;

!?FU9503; add creature stacks
!!BU:Ex3/?y1; [see what's at our position]
!!BMy1&y1<>-1:N?y2; [see how many creatures in that stack]
!!VRy1&y1<>-1/y2=0:S-1; [treat no creatures as no stack]
!!BU&y1=-1:Sx1/x2/x3/1/-1/0; [if nothing there, place our new stack]

Any help would be very much appreciated. Its hard to know what I am doing wrong when it doesn't even show me the bit of code it dislikes...

User avatar
Posts: 73
Joined: 31 Jan 2006


Postby doom3d » Feb 18 2009, 17:33

Don't know what's going wrong, but try to locate the error with the standard error checking.

After every trigger(or Function) add this:

Code: Select all


Add to every line below that something like this:

Code: Select all

** original code,  line 1 **
!!UN:P905/?y99 P905/0;
!!IF:M^breakpoint 1, error flag: %Y99^;

Please, check that You don't use y99. You can change it to anything else.
You may change messages to display more variables. Also don't forget to use different breakpoint names. You will get " breakpoint x, error flag:1" message after the first line wich failed.

This is how I actually debug my unfinished script 130. Just a small part:

Code: Select all

;  98 select source town on adventure screen, called from cm5, y- values used  (faster then from town screen)
!!CAy-3/y-4/y-5:O?y1 U?y2 N?z1 H0/?y8; get owner/nr./name/garrison hero/
!!CA0/y2:P?y-3/?y-4/?y-5;   and real yellow square position
!!OW:C?y3 Gy3/?y4;  y4=1?
*** warning messages:
!!VRy7:S330000 +x1;
!!IF&y1<>y3:M^%Z24^;     warning: "town is not yours", in ert 330 000..001 en/hu
!!VRy7:S330006 +x1;
!!IF&y1=y3/y2=v3980:M^%Z24^;      *** &y1=y3/y2=v3980 target=source
!!FU|y1<>y3/y2=v3980:E; exit if above
** checking garrison or hero: read back qty/type/ creature name (or empty)
!!VRv32:S0; reset lvl3 multiplex
*handling more then 16 parameter
!!VRv30:Sy8; garrison hero id or -1
!!VRz9:Sz330032; set empty slot text, used later!
!!DO663/0/6/1:P=v451/=v452/=v453/=v454/=v455/=v456/=v457/=v458/=v459/=v460/=v461/=v462/=v463/=v464/=v465;  v465=sum
** transfer dialogue only if target set, source town not empty..
* town garrison empty?
!!VRy7:S330008 +x1;
* target is set?
!!VRy7:S330010 +x1;
!!IF|v3980=999:M^%Z24^;  reseted every turn every color plus startup
** check target and display message
** check number of caravans, MODE4 10 bit sequential read 'number of creatures' from v3644-3980, write disabled
!!VRy5:Sv3980 *7 +3644; start byte of target town (0-47)
!!VRy6:S11; start bit ("number of creatures" sub variable)
* start byte/bit/output start v/loops/lenght/shift per turn= Caravan var lenght/MC=1 first occurence/MP
!!VRv313:Cy5/y6/24/7/10/32/0; setup,
***  searching first "0" (v30) and number of "0"s (v319)  ***
!!DO646/1/999/1:P4/0/1/1/30;  read number of empty caravan slots (0 creature) into v319& write out disabled
* y5-6, v24-30 free
* target full: all caravan slots are occupied?
!!VRy7:S330012 +x1;
* check distance: within max. range?  Source Town: y-3 y-4 y-5, target town: v3980
!!VRv32:S-3; reset lvl3 multiplex

  ** distance handling is missing here **

** retest also when we already have some caravans moving
!!IF:M^first 0, v30: %V30, sum v319: %V319, hero id:%Y8, error flag: %Y90^;

** now we have target set and source owned by current player, source not empty, target not busy, go to dialogue screen
** creature names in z2-8, language selection for current player in x1

* dialogue box: choose stack
!!VRy7:S330014 +x1; header text pointer
!!IF:G1/24/0/22/2/3/4/5/6/7/8; [Display dialogue box: radio checkboxes, answer in v24, no default choice, header in z22]
!!FU&v24=0:E; exit if none choosen
* check slot number  (v24= 1,2,..64 -> log2(v24))
!!VRv32:S-1; set multiplex  98/2/1 OB:T/click/sub function nr.
!!DO663/0/7/1:Pv24/?v25;  convert stack nr. & get pointers   v25<-stack nr.
!!VRy7:Sv25 *2 +451;  v451-465: qty0, type0, ..
!!VRv26:Svy7; qty
!!VRv24:Svy7; type
!!VRv28:Sv25 +2; z var pointer
* empty slot choosen? :)
!!VRy7:S330016 +x1;
*dialogue box: choose qty from stack v25 * town name will be overwritten
!!VRy6:S330018 +x1; set to 330018 +language offset
!!VRz23:Szv28; name of type  * v28 free
!!VRz4:S^^; empty string
!!VRz5:Szy6; title
!!VRz6:Szy6; text above input box
!!VRz7:Szy6; text at right
* choose qty
!!IF:D64/5/6/7/4/4/4/4/4/4/4/4/4/4/4/4 F64/4/4/4/4/0 E1/64; [Set up dialogue box] [Display dialogue box]
* answer in z1, checkbox flags in v1
** z1 -> empty?, text->integer
** -> checking answer (between 1 and avalaible or 999), source Town y2 slot v25, target town v3980
!!VRy7:S330016 +x1;
!!IF|-1/v27=0:M^%Z24^;  empty text/not a number/0 as answer? :)
* check intervall
!!VRy7:S330024 +x1;
!!IF|v27<0:M^%Z24^; negative number:)
!!VRy7:S330026 +x1;
!!IF|v27>999:M^%Z24^; too high- script limit
!!VRy7:S330028 +x1;
!!IF|v27>v26:M^%Z24^;  too high- not avalaible

!!VRv27&v27<0:S0; negative?
!!VRv27&v27>999:S999;  script limit
!!VRv27&v27>v26:Sv26; avalaible?

 ******* seems to be OK so far ************

* check warlord's banner- garrison hero (1) or Town garrison (2)
!!EXy-3/y-4/y-5/v25/1&y8>-1:R?y10/156/?y11/?y12; y11-12 dummy, free
!!EXy-3/y-4/y-5/v25/2&y8=-1:R?y10/156/?y11/?y12; y11-12 dummy, free

!!VRy11:Sv26 -v27; remaining qty
!!VRy7:S330030 +x1;
* y10=1: warlord's banner will be lost if all creatures move and they have it. options:
* 1, Yes = sacrify it! Move all troops.
* 2, one last creature stops to hold banners, if there is at least 2 of them
* 3, exit if player wants to keep the banner, and there is only 1 creature OR the player press cancel
** Show a message with three pictures.1: loose artifact 2. keep 1 monster 3: exit -> IF:Q bug, going with 2 pictures
!!VRv2:S1; reset to default: all selected troop  will move
!!IF&y10>0/y11<1:Q2/8/156/21/v24/10^%Z24^; v2: 1=left picture, 2 = right, 0 = cancel, no picture
!!VRv2&v2=2/v26=1:S0; v2=2 player wants to keep 1 unit and alltogether we have 1, means nothing to do
!!VRv27&v2=2/y11<1/v26>1:Sd-1; v2=2 wants to keep banner, and we have more than 1 creature
** other choices: v2=1 no change, v2=0 exit

** teszt
!!UN:P905/?y90 P905/0;
!!IF:M^A, we have %V26 of type %V24 named %Z23, move:%V27, remains: %Y11 position: %Y-3 %Y-4 %Y-5,
stack:%V25, have banners:%Y10, hero id:%Y8, Town id:%Y2, error flag: %Y90^;

** check xp first, then  call central conversion FU(type nr., ?actual xp, ?bitwise xp) ** NOT READY **
* read & convert ?v28 experience with FU. REM: max. XP around 160K, full xp~ rank10*1.1..1.65
!!EXy-3/y-4/y-5/v25/2:A?y8/?y9/?v28; xp/creature      ** y8 in use **
* call xp conversion to n bit
!!FU663:Pv24/v28/?v29; creature type/normal xp/bitwise

** now we move v27 creature from position y-3 y-4 y-5, hero y8(=-1 if no hero) or town y2, stack v25,
** owned by y1(y3), from creature type v24 qty v26, to target town v3980 slot v30; experience=v29
**  start bit v3644 bit0 +(v3980 *7*32 +v30*32)

User avatar
Posts: 1032
Joined: 13 May 2006
Location: France

Postby Salamandre » Feb 18 2009, 20:11

Doom, you always amaze me.

What pissed me most of time, and it is the first reason why WoG died so fast (despite its infinite possibilities), is that people who know how to do maps don't know how to script them, while people who know to script don't know/not interested to create maps.

Sorry for off topic, but Doom was here, and I wanted to salute him.

User avatar
Posts: 73
Joined: 31 Jan 2006

Postby doom3d » Feb 22 2009, 12:40

Thanks. :proud: Once I nearly created a map Called Diablo III.
I accidentally deleted it, together with my Stargate script.
BTW, I never tried to use !!FU with more, than one P command. Should it work? I'm lazy to test it right now.
!!FU9503:P250/159/25 P250/159/59 P250/159/93 P250/159/62 P250/159/96;
This is new to me.

Posts: 6
Joined: 11 Sep 2008

Postby Oenomaus » Feb 25 2009, 13:20

Thank you very much for that. Much more sensible solution than my normal process of loading up a trial map again and again with more and more of the script (particularly irritating when the error causes a ctd). Error was very straightforward in the end (as so often): had creature type and number the wrong way round and it was unhappy about creature type 250...

Return to “Wake of Gods”

Who is online

Users browsing this forum: No registered users and 2 guests