Wake of Gods Forum | Форум Во Имя Богов

Full Version: Ваши вопросы по ERM-скриптам
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625
Much better now!

-) Misspelling: Freindly
-) Misleading "friendly" in many descriptions. All variables have nothing to do with allied players.
This condition does not do anything useful: !!FU&i^dark_enabledForAI^=(FALSE):E;
The whole logics of dark_enabledForAI seems to be unclear.

Check for AI should be done via OW:I(player)/?(isAi:y);

-) ; Jump to the next hero if hero is in the same team with current player
Obvious comment. !!co is jump, the condition is trivial.

-) !!HEi:O?(owner:y);
   !!OW:T(owner)/?(heroTeam:y);

Check for NO_OWNER and continue. Do not get team for heroes without owner.

-) Separate break commands from the rest code, they are flow control structures (important things):

-) !!UN:U(OBJ_HERO)/i/-1/?(x)/?(y)/?(z);
That's wrong! UN:U searches for N-th object on adventure map, many heroes are not on adventure map and besides, you already have necessary hero ID.


My congratulations. Your coding skills are improving from day to day!
This script is really modular, clear and reusable.
Thanks a lot Berserker. I rely on spelling check heavily. Too bad Sublime Text didn't correct the misspelling for me ))))

I struggled with naming the script. The "friendly darkness" is the best result that came out. Friendly - short for "user-friendly". As you see, the new darkness is less annoying, more user-friendly in some ways, makes sense now?

The i^dark_enabledForAi^ is for disabling the new darkness ability for AI players. Stupid AIs don't play well even if the whole map is revealed for them...I wanted to check whether the current player is AI, if yes + i^dark_enabledForAi^ then the function ends.

Corrected the script with your awesome tips! Added some VR:F to prevent issues since I encourage players to edit Settings as they pleased...are they necessary?
(31.05.2021 18:45)fatsawhorse Wrote: [ -> ]
Quote:в окне героя заблокировать через !!СМ:R0; действие клика на арте #149,
- сама то беда как раз что я не могу никак определить этот арт. Не вижу нигде ресиверов, которые бы его определили при этом чтобы на нём прошло нажатие левой кнопки мыши! Bad
Я тебе уже давал ранее такой код в одном из скриптов Moral
Quote:Question: In what scenario would you prefer variables to be announced at the beginning of a function?
Declare function arguments at the top of the function and declare local variables as close to the first usage place, as possible. Thus variable is created in the context of its usage.

Quote:!#VA(x:y) (y:y) (z:y);
These variables can be created on the fly on the first usage:
HE:P?(x:y)/...

We can move

to instructions after declarations. This is a one time operation.
!#VRi^dark_enabledForAi^:F(FALSE)/(TRUE);
...


=>


To my mind, getting two parameters can be joined in the same command and still be readable. Like get isAi and team.
The commend should describe exit condition, usually we calculate something and then exit on condition.

Next, you miss !!HEi:P?(x)/?(y)/?(z); before UN:H
Berserker, great! Totally forgot about the short syntax for boolean after reading the changelog.

Corrected all those. But I just realize I made a serious mistake - The UN:H was wrongly used.

Code:
UN:H
Hide part of the map (round area)
   #1 = x
   #2 = y
   #3 = Level
   #4 = Owner (Format E1)
   #5 = Radius
Comments:
The shroud will be replaced for all players except the owner.

Thought that was placed for the owner only.
Looks like I have to rewrite Dry

Edit: done rewriting for now, checking team is not even necessary, your allies will always reveal themselves. Also changed to end of turn trigger - heroes with Darkness will hide himself/herself after moving.
Excellent work! 132

Invalid. Change to !#FU(dark_RestrainValues):P;

Change to !?FU(OnGameEnter)&i^dark_on^;
Same for other triggers.

Remove, declare vars on the first usage in !!HEi:P?(x:y)/?(y:y)/?(z:y);
Great! Corrected everything. Now it's time to send it to our customer. 96-copy
Perfect!
But since when do we have the improved boolean support?

Any & variable = (TRUE) can now be written as & variable?
Yes, in conditions.
SergOz здравствуйте..

Спасибо за код, но конечно шлем всё же одевается с рюкзака всё равно, но только с центрального (с общего рюкзака), но я по аналогу Вашему попробую заблокировать его в основном рюкзаке и если не получится, то оставлю свой скрипт.

Мой скрипт корявый и он удаляет шлем бессмертия, если он попал уже в командира и снова его отдаёт герою в рюкзак, но как то так и работает, но не по задумке..

Жаль что в тригере !?CM2 нет проверки всех ячеек рюкзака, а только первых пяти и поэтому придётся мне пытаться что-то сделать с этим ресивером !!HE-1:А1/149/?; - здесь можно проверить позицию шлема во всём рюкзаке, но опять же всё проблемно, но думаю как-то можно..

В идеале если бы шлем навести на командирскую ячейку и ячейка заблокируется, но буду пытаться.. Благодарю Вас..
Hi! I'm looking for help with these questions

Wanting to check these at the end of a battle:
1. How to check whether a town was involved in the battle? I know BA:S does something but looks like it won't return the corrected result if the battle happens in a town with no fort (walls).
2. How to get the ID or coordinates of the town involved in the siege battle? Is v998 - v1000 still the best way to do in ERA 3?

Also, Is there a way to check the type of object if we have the coordinates? I guess checking whether v998 - v1000 is a town could help with checking whether the battle was a siege too

Thanks Yes
2. !!BA:P?(x:y)/?(y:y)/?(z:y) or i^battle_x^, i^battle_y^, i^battle_z^
1. Get x/y/z coordinates, decrease x by 1, single UN:U call, check the result, If result is the same as original x/y/z, than it's battle in a town. Check if town has no visitor hero or visitor hero and no monsters in town itself.
Hmm, I doubt a single call of UN:U could work, an example - when you have 2 towns with the same x coordinates but different y.
Code:

Map for Testing

Ultimately, the purpose of the script is only for getting one condition - when the defender of the town wins a battle but with no hero nor creatures left in the town (normally this could only happen when the fight won with summoned units). Any shortcut for this?

Edit: Improved script
Quote: I doubt a single call of UN:U could work
Imagine X/Y/Z battle coordinates.
Assume the previous town search ended at X-1/Y/Z.
Add 1 to (X - 1), check if Map[X][Y][Z] is a town, stop if so. Otherwise continue searching. In the former case we will end at X + DX/Y + DY/Z + DZ coordinate, which is not original X/Y/Z, obviously.

Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625
Reference URL's