Scripting help for heroes 5 required please! :)

Maps and the art of mapmaking.
SilverMB
Leprechaun
Leprechaun
Posts: 3
Joined: 27 Jan 2011

Scripting help for heroes 5 required please! :)

Unread postby SilverMB » 27 Jan 2011, 15:07

Hello everyone,

I have been trying for the last 3 days to get a script working on a randomly generated map in Heroes 5.

I read the guide CH_H5_scripting2.01 from here and I used HOMM5_Script_Functions.pdf for the specific functions.

What I am trying to do is quite simple I want to add once a week 2 creatures to a castle or to a hero.

This is how I went about it:

1) I created a random map and defined what faction player 1 and what faction player 2 is. And gave Player 1 the hero "Nur"

2) I opend the script panel under map properties.

I added MANY different version of these scripts:

Code: Select all

Trigger(NEW_DAY_TRIGGER, "days");
function days()
 if GetDate(DAY) == 2 then
AddHeroCreatures( Nur, CREATURE_ARCHANGEL, 1 );
end;
end; 

Trigger (NEW_DAY_TRIGGER, "town1");
function town1()
	if GetDate(2) then
GetObjectCreatures(Bahiyaa, 91, 2);
end;
end;
This is a slightly simplified version of what I had before , and from what I understood this should add 2 creatures on day 2 to the hero Nur and to my town Bahiyaa.

3. I start the heroes game select the map I created in multiplayer or single player and wait until it is day 2.

Sadly nothing ever happens no matter how I change the script. I am not even getting an error message…

I am guessing I am doing something very basic wrong or scripts don’t work with random generated maps.

Can anyone explain me what I am doing wrong or give me a step by step explanation on how to “add 2 creatures each week to a town :ill:
Any help would be very much appreciated !

Kind regards,


SilverMB -

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

Unread postby Franzy » 27 Jan 2011, 21:14

Names of objects, including hero names, should be enclosed in ' '. Cheers!

User avatar
Warmonger
Pixie
Pixie
Posts: 125
Joined: 15 Dec 2007
Contact:

Unread postby Warmonger » 28 Jan 2011, 06:48

Only one function can be bound to NEW_DAY_TRIGGER at once. Merge them into one, or add nested calls in bound function.
VCMI : the future of Heroes 3!
People just don't care.

SilverMB
Leprechaun
Leprechaun
Posts: 3
Joined: 27 Jan 2011

Unread postby SilverMB » 28 Jan 2011, 09:33

Thanks for the quick replies guys! :)

I tried to put the value ( 'heroname', creatureID, amount) in between ' ' the value turn orange (instat of black like before) - but it still doesnt work. Still no error message nothing.

I found another post with a similar question , the code that was used there is this one:

Code: Select all

function NewDayTrigger() 
if GetDate(DAY) == 3 then 
MessageBox("Maps/SingleMissions/Go for first map/firs.txt"); 
end; 
if GetDate(DAY_OF_WEEK) == 3 then 
AddHeroCreatures("Christian", 14, 5); 
end; 
end; 

Trigger(NEW_DAY_TRIGGER, "NewDayTrigger");
Im writing it like that but it simply doesnt react...

@Warmonger: I know only 1 function will work, but non of it works atm. I am trying to get ANYTHING to work or to react at least.

I think , as I said above, there is something else wrong. Like I am putting it into the wrong "script" tab or maybe I have something to check/uncheck for random maps to accept scripts ... I really don't know but I am getting pretty frustrated with this :(

Anyone able to help me out with this ?


SilverMB -

User avatar
Warmonger
Pixie
Pixie
Posts: 125
Joined: 15 Dec 2007
Contact:

Unread postby Warmonger » 28 Jan 2011, 15:41

What does console say? Does it say anything at all?
VCMI : the future of Heroes 3!
People just don't care.

SilverMB
Leprechaun
Leprechaun
Posts: 3
Joined: 27 Jan 2011

Unread postby SilverMB » 29 Jan 2011, 10:40

The consol says "Ok"
That's the code I am using now - still no reaction.

Code: Select all

 Trigger(NEW_DAY_TRIGGER, "days");
function "days"()
if GetDate(DAY_OF_WEEK) == 3 then  
AddHeroCreatures("Nur", 92, 1);
end;
end; 
:(


SilverMB

User avatar
Warmonger
Pixie
Pixie
Posts: 125
Joined: 15 Dec 2007
Contact:

Unread postby Warmonger » 29 Jan 2011, 11:56

Are you sure you refer to corect scrip name of hero? Nur is actually called "Astral" and only Nathir is called "Nur". You can check it in scripting reference.

Also, function definition shouldn't be taken into quote marks, otherwise it looks correct.
VCMI : the future of Heroes 3!
People just don't care.


Return to “Mapmaking Guild”

Who is online

Users browsing this forum: No registered users and 0 guests