Heroes of Might and Magic Community
visiting hero! Register | Today's Posts | Games | Search! | FAQ/Rules | AvatarList | MemberList | Profile


Age of Heroes Headlines:  
5 Oct 2016: Heroes VII development comes to an end.. - read more
6 Aug 2016: Troubled Heroes VII Expansion Release - read more
26 Apr 2016: Heroes VII XPack - Trial by Fire - Coming out in June! - read more
17 Apr 2016: Global Alternative Creatures MOD for H7 after 1.8 Patch! - read more
7 Mar 2016: Romero launches a Piano Sonata Album Kickstarter! - read more
19 Feb 2016: Heroes 5.5 RC6, Heroes VII patch 1.7 are out! - read more
13 Jan 2016: Horn of the Abyss 1.4 Available for Download! - read more
17 Dec 2015: Heroes 5.5 update, 1.6 out for H7 - read more
23 Nov 2015: H7 1.4 & 1.5 patches Released - read more
31 Oct 2015: First H7 patches are out, End of DoC development - read more
5 Oct 2016: Heroes VII development comes to an end.. - read more
[X] Remove Ads
LOGIN:     Username:     Password:         [ Register ]
HOMM1: info forum | HOMM2: info forum | HOMM3: info mods forum | HOMM4: info CTG forum | HOMM5: info mods forum | MMH6: wiki forum | MMH7: wiki forum
Heroes Community > Heroes 3.5 - WoG and Beyond > Thread: Scripting
Thread: Scripting This thread is 2 pages long: 1 2 · NEXT»
faramir
faramir

Tavern Dweller
posted October 23, 2003 04:27 PM

Scripting

Hi there,

You know, i would like to learn erm, but i don't hurry too much. that's why i want Your help. What's wrong in that script:
ZVSE
!?OB9/2/0;
!!IF:Q49^question^;
!!TR6/6/01&49^answer^;
!!IF&-49:M^\answer^;
I know most other receivers, but I make something wrong using CF-s.

Thanks
____________

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
fnord
fnord


Promising
Famous Hero
posted October 25, 2003 09:07 AM

Quote:
Hi there,

You know, i would like to learn erm, but i don't hurry too much. that's why i want Your help. What's wrong in that script:
ZVSE
!?OB9/2/0;
!!IF:Q49^question^;
!!TR6/6/01&49^answer^;
!!IF&-49:M^\answer^;
I know most other receivers, but I make something wrong using CF-s.

Thanks


I'm not sure what you're trying to do with the TR receiver there but the &49 should definitely be to the left of the colon rather than to the right of it.


 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
faramir
faramir

Tavern Dweller
posted October 25, 2003 01:02 PM

Hello

I know the condition should be just after the parameters. But that wasn't the problem. the answer is not in the right place. the script should look like:
!!TR6/6/0&491;
!!IF&49:M^ANSWER^;
I can't believe a was such a moron. By the way, is there a possibility to set a global event (e.g. MA) a local event? I mean to change parameters of a simple moster, not the whole type.

Thanks!
____________

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
fnord
fnord


Promising
Famous Hero
posted October 26, 2003 02:56 AM

Quote:
I know the condition should be just after the parameters. But that wasn't the problem. the answer is not in the right place. the script should look like:
!!TR6/6/0&491;
!!IF&49:M^ANSWER^;
I can't believe a was such a moron. By the way, is there a possibility to set a global event (e.g. MA) a local event? I mean to change parameters of a simple moster, not the whole type.

Thanks!


Well I'm glad you figured out the problem.

You can't change individual monsters or monster stacks except in combat.


 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
faramir
faramir

Tavern Dweller
posted October 29, 2003 04:28 PM

Hello

Thanks for help! I have one more question. I wouldl like to make an object a town. I tried with OB receiver (!!OBx/x/x:T98) but it doesn't work! I also tried to set the parameter in variable, but it doesn't change anything. CA receiver also doesn't work. Thanks!
____________

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
fnord
fnord


Promising
Famous Hero
posted October 29, 2003 10:38 PM

Quote:
Thanks for help! I have one more question. I wouldl like to make an object a town. I tried with OB receiver (!!OBx/x/x:T98) but it doesn't work! I also tried to set the parameter in variable, but it doesn't change anything. CA receiver also doesn't work. Thanks!


The only way to make another object into a town is to use the advanced UN:I syntax to place one object that <I>looks</I> like another object.

This placement may not work with an instruction (although you could try it) but should work at any other point in the game.

If you wish to "change" an object into a town later in the game, first delete the object (UN command) and then place a new one with UN:I (using the advanced syntax).


____________

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
faramir
faramir

Tavern Dweller
posted October 29, 2003 11:45 PM

Everything seems to be ok, but i don't know some nubers of objects. For example an adventure cave. in format OB there's nothing about it.
____________

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
fnord
fnord


Promising
Famous Hero
posted October 30, 2003 03:38 AM

Quote:
Everything seems to be ok, but i don't know some nubers of objects. For example an adventure cave. in format OB there's nothing about it.


You can find a listing of the new blank objects in the ERM Help with pictures and the object type and subtype (they're almost all type 63 actually so really you just need to know the subtype) and pictures by clicking on the button labeled "WoG Objects" or in some earlier versions of the ERM Help I think it was "Editor" or something along those lines.


____________

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
faramir
faramir

Tavern Dweller
posted October 30, 2003 06:54 AM

Thanks fnord!
____________

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
faramir
faramir

Tavern Dweller
posted October 30, 2003 07:10 AM

But when i build anything in that town, its appearance changes to a normal castle. Is there a way to stop that? And how can i change properties of an object just placed by a script. I mean when object is placed in the map by the UN:I receiver, how can i modify it?
____________

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
fnord
fnord


Promising
Famous Hero
posted October 30, 2003 08:58 AM

Quote:
But when i build anything in that town, its appearance changes to a normal castle. Is there a way to stop that? And how can i change properties of an object just placed by a script. I mean when object is placed in the map by the UN:I receiver, how can i modify it?


No, there's no way in 3.57f to stop the object changing external appearance back to its castle type if you build something there, although building through ERM commands will not cause it to change appearance.

I suppose you could possibly write a script to check which structures are built in the town, delete the town, and build it again with UN:I and ERM commands, but it would be complicated and probably not work completely anyway.

In 3.58, a command to change the external appearance of a town to match its internal appearance will be added, but this won't help the problem of a town changing its appearance when a player builds there. I'm not sure if there's any way we'll be able to get around that issue.

I suppose in some future WoG update, commands for checking mouse-clicks on the Town build screen could possibly be added. This might let a script be written to let the player build normally but the build would actually be done through ERM and not change the town's appearance externally. I think there may be a few other issues here such as finding a way to properly update both the build screen and the town screen (without exiting) but maybe a way could be found. Anyway, if possible, this almost certainly wouldn't be realised until 3.59 or later I'm afraid.

You can change any object's properties with the OB receiver and type, subtype and control word commands, but it may often have strange effects and only sometimes works the way you expect. Certain objects always have dedicated receivers that let you change their properties correctly and these can be found in the Other Objects button in ERM help. Specific object receivers include receivers for treasure chests, camp fires, signs, warrior's tombs, mines and a number of others. Not all objects have specific object receivers and more may eventually be added to ERM.

To modify a town placed by UN:I, use the CA receiver as for any normal town. For monsters, use the MO receiver, etc.


____________

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
faramir
faramir

Tavern Dweller
posted October 30, 2003 01:57 PM

I know how to change properties of an object, but how can i do that, when object is being placed in game. I mean when a player activates trigger to build an object and i wanna change it's properties.
____________

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
fnord
fnord


Promising
Famous Hero
posted October 30, 2003 08:33 PM

Quote:
I know how to change properties of an object, but how can i do that, when object is being placed in game. I mean when a player activates trigger to build an object and i wanna change it's properties.


Could you give me an example?  What type of object?


____________

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
faramir
faramir

Tavern Dweller
posted October 31, 2003 08:22 AM

When i place any object, for example a mercenary camp and i want to change its properties, nothing happens. I place the object with te UN:I command and when i play the game, the object is not changed. By the way, how can i erase the original properties of an object?
____________

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
fnord
fnord


Promising
Famous Hero
posted October 31, 2003 11:37 AM

Quote:
When i place any object, for example a mercenary camp and i want to change its properties, nothing happens. I place the object with te UN:I command and when i play the game, the object is not changed. By the way, how can i erase the original properties of an object?


Okay, I'm a little confused here. What properties does a mercenary camp have that you could change?

I mean, it gives +1 per hero to Attack. I don't think there's any way of changing that unless you disable the object and write your own custom script for when it's visited.


____________

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
faramir
faramir

Tavern Dweller
posted November 01, 2003 12:36 AM

i'm just talking about it. how can i disable the original purpose of an object?
____________

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
fnord
fnord


Promising
Famous Hero
posted November 01, 2003 04:57 AM

Quote:
i'm just talking about it. how can i disable the original purpose of an object?


Use the OB:S command to disable an object.

If you want to disable a specific object, use a trigger for that object's location and then OB:S.

If you want to disable all objects of a specific type, use a trigger with the object's type instead, or type and subtype if you wish, again followed by the OB:S command.

For example, to disable all Mercenary Camps, you could use:

<code>
ZVSE

!?OB51;
!!OBv998/v999/v1000:S;
</code>

(An object or hero's current position is always stored in v998/v999/v1000.)

However, there is a problem with the above -- it will disable the object for the AI too and the AI doesn't understand disabling so it will often visit the disabled object, see that the "visited" flag isn't set for it, and revisit it, over and over. Even if you use the &1000 flag to only disable it for humans, the disabling from a human visit will still apply, so you may wish to do something like the following:

<code>
ZVSE

!?OB51;
!!OBv998/v999/v1000:R;
!!OBv998/v999/v1000&1000:S;
</code>

The OB:R command enables the object, so this will enable it when visited and then immediately disable it but only if it's  a human. The AI will get the +1 Attack bonus and the "visited" flag will be set for the AI so it will be happy.

If you really didn't want the AI getting the bonus, you could use a post-visit trigger with a &-1000 flag to take away 1 point of Attack from the AI hero after it visited.

<code>
ZVSE

!?OB51;
!!OBv998/v999/v1000:R;
!!OBv998/v999/v1000&1000:S;

!$OB51&-1000;
!!HE-1:Fd-1/d/d/d;
</code>

Note: you can use indirect reference of variables instead if you wish, so you could put:

<code>
!!OB998:S;
</code>

instead of:

<code>
!!OBv998/v999/v1000:S;
</code>

"998" tells it that v998/v999/v1000 hold the coordinates. or if you have them in v4/v5/v6, for example, you could use !!OB4:S; to reference them the same way.


____________

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
fnord
fnord


Promising
Famous Hero
posted November 01, 2003 04:59 AM

Please ignore the <code> and </code> in the above message. I'm used to the Round Table forum where that's a formatting command.
____________

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
faramir
faramir

Tavern Dweller
posted November 01, 2003 12:07 PM

thanks for help!

I thought that the OB:S command will disable the object, so that no one can use it, but i didn't think, that i can write a script to a disabled object. you mentioned that there's nothing to change in a mercenary camp. but if i would like to set some new properties and let the original ones stay? i mean to set some messages or instructions, but don't change the original purpose of an object. everything seems to work when the object is placed in the map editor, but when an erm script places it during the game, there's nothing changed in the object. how should i write these commands to change the object, what trigger should i use? And one little question: is there a way to make an unflaggable object a flaggable object? thanks for your help, you really helped me much!
____________

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
fnord
fnord


Promising
Famous Hero
posted November 02, 2003 12:36 AM

Quote:
I thought that the OB:S command will disable the object, so that no one can use it, but i didn't think, that i can write a script to a disabled object. you mentioned that there's nothing to change in a mercenary camp. but if i would like to set some new properties and let the original ones stay? i mean to set some messages or instructions, but don't change the original purpose of an object. everything seems to work when the object is placed in the map editor, but when an erm script places it during the game, there's nothing changed in the object. how should i write these commands to change the object, what trigger should i use? And one little question: is there a way to make an unflaggable object a flaggable object? thanks for your help, you really helped me much!


You're very welcome.

Yes, if you disable an object, it's still a trigger for scripting purposes.

An ERM script will work identically, whether the object is placed in the map editor or in the game. If it's not working, it could be that you're referencing the object's location (x/y/l coordinates) and the object is being placed at a slightly different location than you expect.

The UN:I command places objects based on the lower left corner of the white rectangle that you see around an object if you place it on a map in the editor and click on it. However, the OB trigger works on an object's yellow trigger square. So the two aren't necessarily the same.

The other way to trigger an object is by type (and optionally subtype too) and this should work for ALL objects of that type (and/or subtype) regardless of the object's location, so placing it with an ERM command will make no difference.

In this case, just look up the object's number (Format OB) and use that, e.g., if it's 100, use !?OB54;  If the object also has several subtypes and you only want one of them, you can include the subtype too, e.g. !?OB54/3;


____________

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
Jump To: « Prev Thread . . . Next Thread » This thread is 2 pages long: 1 2 · NEXT»
Post New Poll    Post New Topic    Post New Reply

Page compiled in 0.0820 seconds