Creature Messages question and New Day message question

Maps and the art of mapmaking.
omeggidon2
Leprechaun
Leprechaun
Posts: 6
Joined: 28 Jun 2008

Creature Messages question and New Day message question

Unread postby omeggidon2 » 28 Jun 2008, 18:28

Ok...I actually have two questions...

1. Here is the code I am using to create a New Day Message

Code: Select all

Trigger(NEW_DAY_TRIGGER, "NewDayTrigger");

function NewDayTrigger()
if GetDate(DAY_OF_WEEK) == 1 then
MessageBox("Maps\RMG\1372-2268-3872-4378\NDM.txt");
	
end;
Hoever I keep getting Function NewDayTrigger no defined Line 3 Error? What Am I doing wrong with this code...

Second...How do you script a message to appear, when a creature is first encountered..Currently from what I can tell all message and resource options are currently given after creatue is defeated....

Franzy
War Dancer
War Dancer
Posts: 362
Joined: 07 Sep 2007
Location: Moscow, Russia
Contact:

Re: Creature Messages question and New Day message question

Unread postby Franzy » 29 Jun 2008, 07:33

Hoever I keep getting Function NewDayTrigger no defined Line 3 Error? What Am I doing wrong with this code...
1) Don't mind anything the editor says. Mind only the errors that are noted in console when you run the map.
Second...How do you script a message to appear, when a creature is first encountered..Currently from what I can tell all message and resource options are currently given after creatue is defeated....
2) Name the monster (e.g. "mymonster"). Then use the following code:

SetObjectEnabled("mymonster",nil);
Trigger(OBECT_TOUCH_TRIGGER,"mymonster","touchmymonster");

function touchmymonster(hero)

-- Write here anything you want happen BEFORE the battle.

SetObjectEnabled("mymonster",not nil);
MakeHeroInteractWithObject(hero,"mymonster")
end;

omeggidon2
Leprechaun
Leprechaun
Posts: 6
Joined: 28 Jun 2008

Re: Creature Messages question and New Day message question

Unread postby omeggidon2 » 30 Jun 2008, 03:03

1) Don't mind anything the editor says. Mind only the errors that are noted in console when you run the map.
The trigger will not even run...Day 1 or start of week.

Mabey i'm missing something in the coding...I named the monster "mymonster" and just copied the code as is...except I added a message to be displayed just saying test.. Encountering the creature either causes it to join or fight with nothing happening before the battle

Franzy
War Dancer
War Dancer
Posts: 362
Joined: 07 Sep 2007
Location: Moscow, Russia
Contact:

Unread postby Franzy » 30 Jun 2008, 06:54

1. New day trigger works starting from day 2. If you want anything to happen on the very first day, just write the code in the body of the script.

2. Where did you put the code? I hope not in the monster's tab "script"? The code should be placed in the map script!

P.S. It's genertally a good idea to learn by examples. Examine other maps to see how the things are done.

omeggidon2
Leprechaun
Leprechaun
Posts: 6
Joined: 28 Jun 2008

Unread postby omeggidon2 » 30 Jun 2008, 14:19

All scripts are in the map scripts...I did try to put the trigger in the monsters script to see if it would do anything...but nothing happened....

When i enable the console view, at first I got an error but after placing the triggers after the functions the errors went away. After switching the function to

If getdate (DAY_OF_WEEK) == 2 nothing happens yet...but I will attempt to learn from other's maps as well...where would I download them?

Franzy
War Dancer
War Dancer
Posts: 362
Joined: 07 Sep 2007
Location: Moscow, Russia
Contact:

Unread postby Franzy » 30 Jun 2008, 19:00

Script tab in monster properties is combat script that is only executed in combat with this monster.

As for the maps, look here, on CS or on maps4heroes.com. Look for singleplayer maps, they are usually scripted. My maps Coming Home and Mercenaries are heavily scripted (too much, maybe :)), you may look at them. Rdeford's and Myythrin's maps also worth a look in that sense. But your main source of scripts should be official campaigns. There are many places in the web where you can get them as usual maps. I suppose you played the campaigns through, now you should understand how did they do it. Though I must warn you comments are in Russian there. But nothing really valuable in them, mostly programmer's jokes. (Russian coders tend to exercise in humor rather than to explain plainly what they do in the code...)

User avatar
rdeford
Assassin
Assassin
Posts: 299
Joined: 17 Apr 2007
Location: Sequim, USA
Contact:

Unread postby rdeford » 01 Jul 2008, 15:19

@ omeggidon2 -- The script in The Virgin Of Ponce, Episode 1 is short and simple compared to my other efforts. It does all the things you are trying to do in a very straightforward way. And it is commented in English. You can get it from either the CH or the M4H archives. Just do a H5 map search with author = rdeford as the criteria.

Oh, and if you have not yet downloaded The Basics of Heroes V Scripting ver. 2.0 for H5, HOF, & ToTE from the CH downloads page, get it and read it before going any further with your scripting.

Good luck with your map. Ask lots of questions here in the forum. All of us here desire to see more H5 map makers, especially those who can learn scripting.

@ franzy -- The script in your map, Coming Home, was what inspired me to begin making scripted H5 maps. I was simply astounded and awed by how much you were able to customize HOMM into a story-telling, adventure game. I still take a peek into that script from time to time when I am looking for ways to do things. THANKS!
rdeford, Mage Of Soquim

“Forgiving and being forgiven, loving and being loved,
living and letting live, is the simple basis for it all."

Ernest Holmes 1984


Return to “Mapmaking Guild”

Who is online

Users browsing this forum: No registered users and 0 guests