Spawning main heroes

Maps and the art of mapmaking.
tofiffe
Peasant
Peasant
Posts: 93
Joined: 21 Mar 2010

Spawning main heroes

Unread postby tofiffe » 10 Jul 2010, 13:49

I would like to make a map so, that after you start the game, the chosen heroes appear at start, without towns.

What scripts would be possible?

And is there any way that every 2 or 3 days a cart with creatures would appear and they would join? they should be the same faction as heroes you choose...

tofiffe
Peasant
Peasant
Posts: 93
Joined: 21 Mar 2010

Unread postby tofiffe » 10 Jul 2010, 17:34

i seem to have found a way for adding creatures depending on the day of the week, but still don't know how to make a hero selectable without town and make the script detect what faction the heroes are...

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

Unread postby Franzy » 12 Jul 2010, 03:37

Just take away the town on the day one and teleport hero on your start location.

tofiffe
Peasant
Peasant
Posts: 93
Joined: 21 Mar 2010

Unread postby tofiffe » 12 Jul 2010, 10:29

so something like:
SetObjectPosition(h,x,y,z);
RemoveObject(town1);
at the begining of the script?
but the hero has no name if he/she is normaly spawned...how can i solve that?

tofiffe
Peasant
Peasant
Posts: 93
Joined: 21 Mar 2010

Unread postby tofiffe » 14 Jul 2010, 10:39

and when i try to remove town, it says the object is not removable...

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

Unread postby Franzy » 15 Jul 2010, 15:41

There is a function that returns an array of all player's heroes names. The first (and single) element of this array will store your starting hero name.

To be able to remove or move a town or any other static object you should set appropriate propery (IsMovable or somethig like this, can't remember) to true (not nil).

tofiffe
Peasant
Peasant
Posts: 93
Joined: 21 Mar 2010

Unread postby tofiffe » 15 Jul 2010, 17:09

So
SetObjectPosition(GetPlayerHeroes(player_1), x,y,z);
MakeTownMovable("town1");
RemoveObject("town1");
that solved it thanks! Now what about getting the hero faction? There's a hell lot of scripting if i'd want to check for every creature of each faction so the player1 and 2 would be getting reinforcements everytime...

Oh and SetObjectPosition(GetPlayerHeroes(player_1), x,y,z); returns an error, like wrong argument 1

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

Unread postby Franzy » 16 Jul 2010, 17:37

GetPlayerHeroes returns an array. You have to access its first element. Like this:

a=GetPlayerHeroes(PLAYER_1);
hero = a[0];

tofiffe
Peasant
Peasant
Posts: 93
Joined: 21 Mar 2010

Unread postby tofiffe » 17 Jul 2010, 06:54

oh! that's something new! thanks...

tofiffe
Peasant
Peasant
Posts: 93
Joined: 21 Mar 2010

Unread postby tofiffe » 18 Jul 2010, 06:39

just wanted to ask
GetPlayerRace( PLAYER_1 );
which variable does it return? number or name? like 0 or haven?

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

Unread postby Franzy » 18 Jul 2010, 16:33

A number of course.

tofiffe
Peasant
Peasant
Posts: 93
Joined: 21 Mar 2010

Unread postby tofiffe » 19 Jul 2010, 09:16

so numbers from 0 to 7?

EDIT:solved that..but the script now has 524 lines, no error is reported but it doesn't execute...

and how could i make a cycle that every square of the map would be specified?
for i=0,71 do
PlayVisualEffect(efectname, '','', x, i, 0, 0);
end;
but that's just for all y coordinates...

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

Unread postby Franzy » 20 Jul 2010, 14:03

Never heard of nested cycles? :)

N=178 -- map size
for i=1,N do
for j=1,N do
-- tile(i,j)

end; end;

tofiffe
Peasant
Peasant
Posts: 93
Joined: 21 Mar 2010

Unread postby tofiffe » 20 Jul 2010, 17:19

never heard of nested cycles...thanks!

But on the other hand, now the map laggs(it's tiny XD) is there any posibility to skip a number or two?

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

Unread postby Franzy » 21 Jul 2010, 17:04

for i=1,10,2 do

will probably result in i=1, 3, 5, 7,9

If it won't work use the following trick

for i=1,N/2 do
tile(i*2,j)
end

tofiffe
Peasant
Peasant
Posts: 93
Joined: 21 Mar 2010

Unread postby tofiffe » 22 Jul 2010, 07:13

thanks, it was sure weird to see a tiny map lag on 4gb ram XD
i had to do /4 and *4 to unlag it

now is the trigger for loss of a hero is HERO_LOSS_TRIGGER?

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

Unread postby Franzy » 22 Jul 2010, 17:18

Look up in thr functions reference file. It's in the game folder with other docs.

tofiffe
Peasant
Peasant
Posts: 93
Joined: 21 Mar 2010

Unread postby tofiffe » 25 Jul 2010, 06:38

ok i did look up, but some functions don't trigger...i don't thing it would matter if a function has more than one trigger...but the part of the script that was suposed to add creatures to an object simply doesn't work...

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

Unread postby Franzy » 26 Jul 2010, 16:55

PLAYER_REMOVE_HERO_TRIGGER.

tofiffe
Peasant
Peasant
Posts: 93
Joined: 21 Mar 2010

Unread postby tofiffe » 26 Jul 2010, 17:29

yes, i did that, but the function isn't triggered...


Return to “Mapmaking Guild”

Who is online

Users browsing this forum: No registered users and 0 guests