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
Или так:

daemon_n, XEPOMAHT, Berserker, thanks for the answers.

I have another question, how can I remove a hero with error. For some reason, a hero is put on the map without assinging an owner. By checking with erm, I have this:
Image: s43tOPV.png
IF:M returns the correct coordinates and -1 as the owner.

As a result, the game crashes at the start of this hero's turn. What I want to do is to either correct the owner or remove the hero from the map so that it won't cause error.

Tried with HE:K, HE:O, no luck.
Archer30, set pos -1/-1/-1;
Set owner to red, call HE:P to change position, call HE:K.
to set owner properly, you need use player setup OW:O
Unfortunately, none of Berserker and daemon_n's method works. The hero with no owner still stays on the screen.

HE:O + HE:K simply has no effect
HE:P-1/-1/-1 leads to an instant crash

I don't understand how OW:O can help here
(15.02.2023 01:10)Archer30 Wrote: [ -> ]I don't understand how OW:O can help here

(15.02.2023 01:10)Archer30 Wrote: [ -> ]HE:O + HE:K simply has no effect

У Вас там такое возмутительное количество работающих скриптов, что разобраться в них просто так не получится. При таком объёме найти ошибку очень сложно (особенно когда в ваших модах одни скрипты правят ошибки других, другие правят ошибки третьих и т.д., в итоге такие кастыли копятся как снежный ком и превращают общий ERM-код в тыкву). Скорее всего какой-то кривой ERM-скрипт делает данного героя безхозным, от того, его нельзя убрать с карты с помощью !!HE:K.

(15.02.2023 01:10)Archer30 Wrote: [ -> ]HE:P-1/-1/-1 leads to an instant crash

Перемещать героев за пределы карты вообще-то нельзя.
Archer30, maybe upload savegame?
Berserker, unfortunately, the save game was heavily modded, you will have to download stuff in order to load it. I don't think it is worth the time.

So I know clearly how exactly this problem happened. It was resulted by my script of boosting AI turn speed.
The script is long, but the main idea is rather clear: It resets AI heroes every X day with the function !!SN:E5081488/(CALLCONV_THISCALL)/(heroPtr)/(hero); to remove some unimportant data so that the AI could start moving instead of being stuck in a place for minutes. I don't know the details of this function, but it just works. The AI heroes do have a shorter time of responding.

My script:

Full script for download

Here comes the problem of my script:
In most cases, the script works ok. But for some reason, usually, after Month 2, there is a chance the script results in an error just like the screenshot here. Pink player's heroes were moved back to the map, yet the owner could not be set correctly. If this happens, the game will crash the next day when Pink is about to move, but if loading a save game before the day with error and re-execute my script, the error could be gone. That is a say, the problem does not happen 100% but once it happens, it is the end of the game.

Here I'd like to know if you guys have advice on my script or boosting AI turn speed in general, mostly I want to know if there is a chance to fix the issue of missing hero owner by executing this script.
(15.02.2023 08:21)Archer30 Wrote: [ -> ]It resets AI heroes every X day with the function !!SN:E5081488/(CALLCONV_THISCALL)/(heroPtr)/(hero); to remove some unimportant data so that the AI could start moving instead of being stuck in a place for minutes. I don't know the details of this function, but it just works. The AI heroes do have a shorter time of responding.

Единственное, что увидел в этой функции, влияющее на ИИ, это сброс множителя агрессии героя на дефолтное значение и сброс координат карты, в которые идёт ИИ. И то, и другое можно устанавливать вручную с помощью нескольких строк, без вызова функции по 5081488, т.е. без костылей в сотни ERM-строк, замедляющих игру. НО:

1. Сброс координат заставит ИИ поменять цель визита на карте, что, возможно, сделает его тупее.
2. Сброс агрессии так же может превратить героя в тряпку и лёгкую мешень для человека.
3. Можно конечно сбрасывать счётчики телепортации и городского портала, но так ИИ так же не сможет пользоваться данными заклинаниями на 1 ход, т.е. ещё сильнее оглупеет.

Алгоритмы поведения ИИ с помощью кастылей всё же советую не менять - они написаны достаточно неплохо и работают быстро на картах стандартных размеров. Да, на картах гигантсткого размера ИИ долго думает, но это решается только увеличением тактовой частоты процессора - по коду игры радикальных оптимизаций написать за 20 лет пока ни у кого не получилось. Костыли в виде отупляющих ИИ ERM-скриптов - не выход.
Archer30, is AI slow if fly and dimension door are banned?
XEPOMAHT, thanks. Well, I understand executing the function at 5081488 certainly has some problems, but on the other hand, it's quite annoying for players to see AI heroes standing for so long before moving. I mean, something is wrong in the mods, but I don't know where exactly so that I wrote another script to boost AI speed and cause some other troubles.

Would you mind simplifying my script a bit without calling 5081488?

Berserker, it is. In my full script I disable AI DD and limit the quantity of AI heroes. Yet the function at 5081488 is still crucial for boosting the speed of AI.
(12.02.2023 23:12)Archer30 Wrote: [ -> ]As a result, the game crashes at the start of this hero's turn. What I want to do is to either correct the owner or remove the hero from the map so that it won't cause error.

Tried with HE:K, HE:O, no luck.

Archer30, try this:

igrik, thanks. I tested the code and it resulted in map drawing error.

But don't worry, I am not seeking for resolving the issue from this side anymore. I should be able to prevent a hero from appearing on the map with no owner.
Is there a way to check the hex ID my creature is about to stand for the melee attack (if I click my mouse)?

Here's a problem I encounter. I try to make the Backstab ability, which gives a 20% bonus on the final damage if attacking from behind. The problem is, without a way to check the hex ID of my creature is about to stand for its next attack, I can't have the corrected damage shown on the screen (so it won't be like Cavalier with Charge ability, showing different damage according to mouse position).

Well, it's confusing to describe, let's see the code.


What should I change the MM:D line, for it to return the position my creature about to appear for the next attack?
In a word, is it possible to have my theoretical damage corrected depending on whether it's going to be an attack from behind?

I know it can be done by CM:A and a lot of lines. I hope to know an internal way so the code can be shorter.
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