What are the kind of scripts that don't work multiplayer?

Official forum of the Wake of Gods mod to Heroes of Might and Magic III.
Pollo2002
Peasant
Peasant
Posts: 96
Joined: 24 Jan 2006

What are the kind of scripts that don't work multiplayer?

Unread postby Pollo2002 » 04 May 2006, 16:23

the name of the subjects, i know some scripts don't work multiplayer and i would wanna wich ones and why

User avatar
Fnord
Round Table Knight
Round Table Knight
Posts: 341
Joined: 27 Nov 2005
Location: Victoria, BC, Canada

Re: What are the kind of scripts that don't work multiplayer

Unread postby Fnord » 04 May 2006, 17:41

Pollo2002 wrote:the name of the subjects, i know some scripts don't work multiplayer and i would wanna wich ones and why
In general, it's mostly combat scripts that don't work properly in mulitplayer. This is because the changed stack information isn't automatically passed between both computers in the combat unless special commands are given at exactly the right time, and it's all rather complicated--so far only Slava understands exactly how to correct MP scripts so that they should work and it's time consuming.

When the information differs between, it will often result in desynchronization of the combat and will cause the game to freeze.

In theory, most MP scripts that haven't been corrected will automatically be deactivated in an MP combat (by an ERM command in the script) but there may be some that aren't working correctly in this regard as well.

Also, there's a problem in 3.58f with the hard-coded Arrow Towers gaining experience that can sometimes result in desynchronization. This will be fixed in 3.59.

To find out which specific scripts don't work in MP, right-click on the script option description in the WoG Options screen. It should say at the bottom of the description if it's disabled for MP.
- Fnord

Pollo2002
Peasant
Peasant
Posts: 96
Joined: 24 Jan 2006

Unread postby Pollo2002 » 04 May 2006, 18:09

This mean that my project and chaning how spells work is a lost cause? because it would obviustly need to work around changing creature stats:S :'(

User avatar
Qurqirish Dragon
Genie
Genie
Posts: 1011
Joined: 06 Jan 2006
Location: Flying the skies of Ohlam

Unread postby Qurqirish Dragon » 05 May 2006, 13:49

Pollo2002 wrote:This mean that my project and chaning how spells work is a lost cause? because it would obviustly need to work around changing creature stats:S :'(
You could still do this- it would work fine in hot-seat mode, as well as in player-vs-computer battles in other multiplayer modes. It's up to you to decide if it is worth not having it in human-vs-human, network games. And who knows? maybe with the proper setup it will work? It depends on how you are changing the spell system.

Pollo2002
Peasant
Peasant
Posts: 96
Joined: 24 Jan 2006

Unread postby Pollo2002 » 05 May 2006, 15:54

No in fact i'm only interestend in human vs human network battles. All i'm doing is having that in mind.
As i said in other threds my idea is to make spells like stoneskin and bloodlust make an effect based on the hero spellpower.
This last days i've learning erm and i see it's not hard at all doing a scrpit about that, i mean i can't yet because i have some minor issues, but looking at other complex scripts and how they work i see that's very possible. But of course it's a real problem because my idea would be to make the script detect where the hero cast wich spell, then replacing the effect for the one i want. That would mean stack stats change, and i hear that it won't work over network :S, if there any other way to achieve what i want, just tell me but i don't know. I've seen that the other spell changing scrpit there is around (protection elemental) doesn't work over network, even it doesn't actually change the efect of the elemental protection, but from the other spells that it want to affect.
Wich is worse, it doesn't even change a stat and it still don't work over network. I assume that any scrpit using BG BH BU etc, don't work over network?

User avatar
Fnord
Round Table Knight
Round Table Knight
Posts: 341
Joined: 27 Nov 2005
Location: Victoria, BC, Canada

Unread postby Fnord » 05 May 2006, 17:26

Pollo2002 wrote:No in fact i'm only interestend in human vs human network battles. All i'm doing is having that in mind.
As i said in other threds my idea is to make spells like stoneskin and bloodlust make an effect based on the hero spellpower.
This last days i've learning erm and i see it's not hard at all doing a scrpit about that, i mean i can't yet because i have some minor issues, but looking at other complex scripts and how they work i see that's very possible. But of course it's a real problem because my idea would be to make the script detect where the hero cast wich spell, then replacing the effect for the one i want. That would mean stack stats change, and i hear that it won't work over network :S, if there any other way to achieve what i want, just tell me but i don't know. I've seen that the other spell changing scrpit there is around (protection elemental) doesn't work over network, even it doesn't actually change the efect of the elemental protection, but from the other spells that it want to affect.
Wich is worse, it doesn't even change a stat and it still don't work over network. I assume that any scrpit using BG BH BU etc, don't work over network?
In theory, any battle script can be made to work over a network in 3.58f because Slava added ERM commands that should let you transfer all information needed.

The only problems are:

1) figuring out what to use and when;
2) testing in MP battles (mostly very time-consuming).

The receiver you need to use it the IP receiver. You can see the various options in the ERM Help. The receiver's use is fairly straight-forward I think--the hard part knowing where and when it's needed.
- Fnord

Pollo2002
Peasant
Peasant
Posts: 96
Joined: 24 Jan 2006

Unread postby Pollo2002 » 05 May 2006, 22:13

i didn't find any ip reciever in the erm help :S
Still i did see the ip reciever in some scripts, for example in the scrpit 54 i saw the ip reciever and was really surprised, now yo name it, but the erm help for 2.5 doesn't talk about it

User avatar
Fnord
Round Table Knight
Round Table Knight
Posts: 341
Joined: 27 Nov 2005
Location: Victoria, BC, Canada

Unread postby Fnord » 05 May 2006, 23:44

Pollo2002 wrote:i didn't find any ip reciever in the erm help :S
Still i did see the ip reciever in some scripts, for example in the scrpit 54 i saw the ip reciever and was really surprised, now yo name it, but the erm help for 2.5 doesn't talk about it
It's in the current (3.58f) HTML version of the ERM Help, available on the WoG Download page (via FilePlanet).

Here's a direct link:
http://www.fileplanet.com/dl.aspx?/stra ... _tools.wog
- Fnord

Pollo2002
Peasant
Peasant
Posts: 96
Joined: 24 Jan 2006

Unread postby Pollo2002 » 06 May 2006, 14:04

Thanks
now i have a new problem, i realize there is no command to check what spell a hero is casting, you can SET it, but not GET or check :S
So i tried to work other way around, each movement, make a scrpit check for any active spell, but thre isn't a command to check WICH spell the creature has active :S

Shark
Leprechaun
Leprechaun
Posts: 45
Joined: 19 Feb 2006

Unread postby Shark » 06 May 2006, 15:09

it would be silly if you couldn't do something like "a spell is cast", and then run a series of "if the spell cast == this -- do ...."
i haven't done any ERM so i wouldn't really know how the spells are recognized, but if they have IDs, you could make a FOR statement, and i know you have those...
quote the erm356.txt file found in Documentation
7. New receiver !!BM#:...;
You may check/set/get some parameters of a stack of monsters
# - number of a stack (0...41). Usually it is used like 0...20
for a first (0) player and 21...41 for a second (1) player.
Commands:
T$ - type of a monster
P$ - position on a battle field
N$ - number of monsters in the stack (current).
L$ - hit points lost by the next monster in the stack
B$ - number of monsters in the stack (at the beginning of the battle).
E$ - number of times a spell-casting monster may cast its spell (not a
number of a spell)
I$ - side index as for heroes (0-left, 1-right)
R$ - number of retaliations each round (check for Royal Griffin)
A$ - attack with bonuses
D$ - defense with bonuses
H$ - hit points
S$ - speed
F$ - monster flags (as for MA:X)
O$ - number of a (hero's) army slot (0...6,-1)
K# - Strike a monster with #damage points
M#1/#2/#3 - apply a spell to the monster
#1 = number of spell
#2 = duration in turns
#3 = level of skill (0-none, 1-basic, 2-advanced, 3-expert)
C#1/#2/#3/#4/#5 - cast a spell from the monster
#1 - spell number
#2 - position to cast
#3 - Monster skill level (0...3)
#4 - Hero (???) Skill level (0...3)
#5 - Check 4 Target Monster existing (alive)
Q#1/#2/#3 put Quick Sand or Land Mine at a position
#1 - type (0=Quick Sand, 1=Land Mine)
#2 - position
#3 - redraw (1) or not (0)
J$ - get or check for number of active spells
G#/$1/$2 - set/check/get an active spell parameters
# - spell number
$1 - set/check/get duration (0=not applied)
$2 - set/check/get level of skill (0-none, 1-basic, 2-advanced, 3-expert)

pay attention to F$, J$ and G# ... you should first focus on getting your script to work, then toy around with IP receivers and TCP encapsulation...

Pollo2002
Peasant
Peasant
Posts: 96
Joined: 24 Jan 2006

Unread postby Pollo2002 » 06 May 2006, 16:10

as you can see you can't GET the spell unmber, you can only set it :S

G#/$1/$2 - set/check/get an active spell parameters
# - spell number
$1 - set/check/get duration (0=not applied)
$2 - set/check/get level of skill (0-none, 1-basic, 2-advanced, 3-expert)


as you see spell number symbol is #, that means that you can only set it but not read or get.

I don't understand the F one, and the J one let you know how many of them but not wich ones

Shark
Leprechaun
Leprechaun
Posts: 45
Joined: 19 Feb 2006

Unread postby Shark » 06 May 2006, 17:59

that doesn't make much sense, why would 0 represent a not applied spell then ? give it something that won't be there ?

what about checking if number of active spells is greater than 0, then for each of those spells, run a comparison to (get ID) and if stoneskin matches stoneskin, do { something } ... that seems to be tha way to do it, but it might not be possible....
but i'm sure Slava implemented that, he implemented so much stuff and chances are slim to none that he misses something like that....

but then again, i could be terribly wrong..

User avatar
Fnord
Round Table Knight
Round Table Knight
Posts: 341
Joined: 27 Nov 2005
Location: Victoria, BC, Canada

Unread postby Fnord » 07 May 2006, 05:56

Pollo2002 wrote:Thanks
now i have a new problem, i realize there is no command to check what spell a hero is casting, you can SET it, but not GET or check :S
So i tried to work other way around, each movement, make a scrpit check for any active spell, but thre isn't a command to check WICH spell the creature has active :S
There is a command to check the cast spell. It's in the BG receivers (BG:S). This should work for any spell cast by a creature or by a hero, although I can't say for certain if it works with spells cast by stack experience and I suppose it wouldn't work for spells cast through ERM.
- Fnord

Pollo2002
Peasant
Peasant
Posts: 96
Joined: 24 Jan 2006

Unread postby Pollo2002 » 09 May 2006, 20:03

I've been working on the script to make stoneskin defense bonus equal to spellpower, and i've achieved to give the creature the bonus defense i want, equal to the spellpower, the problem that i didn't thought because i'm dumb, is that when the spell wears off the bonus doesn't go away :P
any sugestion?
maybe once the stoneskin is casted on the creature, flag the creature stack and then each subsequent turn check if stoneskin is active in the flagged creature, and when it's not, substract the given bonus.
all this have sense?

User avatar
Fnord
Round Table Knight
Round Table Knight
Posts: 341
Joined: 27 Nov 2005
Location: Victoria, BC, Canada

Unread postby Fnord » 09 May 2006, 21:44

Pollo2002 wrote:I've been working on the script to make stoneskin defense bonus equal to spellpower, and i've achieved to give the creature the bonus defense i want, equal to the spellpower, the problem that i didn't thought because i'm dumb, is that when the spell wears off the bonus doesn't go away :P
any sugestion?
maybe once the stoneskin is casted on the creature, flag the creature stack and then each subsequent turn check if stoneskin is active in the flagged creature, and when it's not, substract the given bonus.
all this have sense?
Yes, and there are two main ways I can think of doing this. The first is to use a range of variables (one for each possible stack on the battlefield) to keep track of this. Then each time it's a stack's turn, check the corresponding variable. The second way would be to place a second spell on the stack, with an really long duration. This second spell would be one that couldn't normally be cast on a stack such as an adventure spell. It won't have any effect in combat but you can check if the stack has this spell or not, and if it has it, remove the bonus and delete the spell.
- Fnord

Shark
Leprechaun
Leprechaun
Posts: 45
Joined: 19 Feb 2006

Unread postby Shark » 10 May 2006, 11:21

i think 40 vars would be too much...
you could do a loop thru all of the armies(for one player and then the other)
and check for stoneskin, if the current unit has it -- give the bonus, if it had it and doesnt have it anymore -- remove the bonus... and here's the problem: you don't want to remove the defence bonus (which could be up to 15 and more) if the spell was never cast on that unit, so you have to check that...
the way it could be done.... hmm, dunno if ERM has arrays, so we'll think of another option...

you have to place a flag that says "this unit have/had a spell on it", then every couple of turns check all flagged monsters for stoneskin, and if its expired -- then you remove the effect, and de-flag the stack (you don't want to substract another 15 def next turn)...

so this should form the final algorithm:

spell is cast -> check all stacks for all spells you wanna mod -> if they have any of them, run a corresponding procedure, in this case stoneskin_MODIFY(currentStack) else do nothing.

ss_modify(stack unit):
get all stacks that have stoneskin -> flag them, add DEF equal to the spellpower -> every 1 turn check the flagged stacks if they have stoneskin on them, if they do -- do nothing, else -- substract DEF equal to the spellpower

that sounds as a good way to do it (to me), so the only thing left for you is to form your own algorithm if you don't like this one... but here's a tip, since you're gonna do this for most of the spells and not just one, its better to start generalized, and slowly narrowing it down with conditions (see the main algorithm -- it checks the stacks for any of the modded spells and then runs a seperate *procedure* for every one... kinda looks like the mail service, a letter arrives, check where it goes to, if its for this town -- send it to a local postoffice, if its not, send it to that town or to someone else that will send it to that town... and by procedures i reffer to code blocks, not actual procedures... if you organize your idea, your code will be organized too)

User avatar
Qurqirish Dragon
Genie
Genie
Posts: 1011
Joined: 06 Jan 2006
Location: Flying the skies of Ohlam

Unread postby Qurqirish Dragon » 10 May 2006, 13:04

Fnord wrote:
Pollo2002 wrote:I've been working on the script to make stoneskin defense bonus equal to spellpower, and i've achieved to give the creature the bonus defense i want, equal to the spellpower, the problem that i didn't thought because i'm dumb, is that when the spell wears off the bonus doesn't go away :P
any sugestion?
maybe once the stoneskin is casted on the creature, flag the creature stack and then each subsequent turn check if stoneskin is active in the flagged creature, and when it's not, substract the given bonus.
all this have sense?
Yes, and there are two main ways I can think of doing this. The first is to use a range of variables (one for each possible stack on the battlefield) to keep track of this. Then each time it's a stack's turn, check the corresponding variable.
IF you are good with binary, since v-vars are 32 bits, you could use two v-vars (one for attacker, one for defender) and use the first 21 bits to keep track of which stacks have been affected by any modified spell.
You will need a seperate 2 vaiables for each spell modified if you use this method.

Shark
Leprechaun
Leprechaun
Posts: 45
Joined: 19 Feb 2006

Unread postby Shark » 12 May 2006, 19:30

hm, thats a good idea, there's 11 bits left for the spells... with proper masks (a number that you XOR your stack bits with) you could make some really good and conservative stuff...
i didin't know ERM had bitwise operations/operators....

nice one Qurqirish Dragon... i just might start practicing this ERM, sounds like tons of fun :))

User avatar
Fnord
Round Table Knight
Round Table Knight
Posts: 341
Joined: 27 Nov 2005
Location: Victoria, BC, Canada

Unread postby Fnord » 13 May 2006, 03:09

Shark wrote:hm, thats a good idea, there's 11 bits left for the spells... with proper masks (a number that you XOR your stack bits with) you could make some really good and conservative stuff...
i didin't know ERM had bitwise operations/operators....

nice one Qurqirish Dragon... i just might start practicing this ERM, sounds like tons of fun :))
It has some with the VR receiver. You can use "&" for ANDing and "|" for ORing with that receiver (not to be confused with the conditional & and | that determines if a receiver or trigger is executed). There's also Xor if I recall.

Check the VR receiver in the ERM Help.
- Fnord

Shark
Leprechaun
Leprechaun
Posts: 45
Joined: 19 Feb 2006

Unread postby Shark » 14 May 2006, 12:54

well thats ok, usually the boolean AND is && and OR is || while the bitwise AND is & and OR is | while XOR is ^ ... i'll get to it one of these days and i might even make that Demonology / Summoning script by myself :)


Return to “Wake of Gods”

Who is online

Users browsing this forum: No registered users and 7 guests