Spawning main heroes

Maps and the art of mapmaking.
Franzy
War Dancer
War Dancer
Posts: 362
Joined: 07 Sep 2007
Location: Moscow, Russia
Contact:

Unread postby Franzy » 07 Aug 2010, 10:59

1 sleep is 1/20 of a second approximately. Though it varies depending on the system and game speed setting.

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

Unread postby Franzy » 07 Aug 2010, 11:01

I suggest you use print dunction for the debug to see what values hold your variablrs. It prints data into the console. I believe the trouble is your b[0] is nil.

tofiffe
Peasant
Peasant
Posts: 93
Joined: 21 Mar 2010

Unread postby tofiffe » 08 Aug 2010, 10:25

so if b[0] == not nil then
xxx
end; or what did you mean?

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

Unread postby Franzy » 08 Aug 2010, 14:18

You don't need that line at all. But if you want, you can, yes. You can also write
if X ~= nil then...
~= means NOT EQUAL

tofiffe
Peasant
Peasant
Posts: 93
Joined: 21 Mar 2010

Unread postby tofiffe » 09 Aug 2010, 06:26

interesting...thanks!

now i seem to have found a new problem, when new week starts, i wanted to use:
SetObjectOwner("spt1", PLAYER_1); --spt1 is neutral town
MakeHeroInteractWithObject( a[0], "spt1");
sleep(5);
SetObjectOwner("spt1", PLAYER_NONE);
solved that...but why do you loose after this? and in the town there are no creatures to be hired...

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

Unread postby Franzy » 09 Aug 2010, 17:02

Creatures are generated in the dwellings (including towns) only if these dwellings are owned by a player.
As for losing... When a hero inters the town he disappears from the map, so when you make the town neutral player probaly ends with no heroes and towns, which is a defeat.

tofiffe
Peasant
Peasant
Posts: 93
Joined: 21 Mar 2010

Unread postby tofiffe » 11 Aug 2010, 08:00

so i guess first i should add
GetObjectPosition(a[0], x, y, z);
SetObjectOwner("spt1", PLAYER_1);
MakeHeroInteractWithObject( a[0], "spt1");
SetObjectPosition(a[0], x,y,z);
SetObjectOwner("spt1", PLAYER_NONE);

as for solving the creatures problem, i would have to give it to another player, but he would have upgraded them, forbidden upgrades would affect all players right?

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

Unread postby Franzy » 11 Aug 2010, 18:40

Probably. Though AI can cheat in many different ways...

tofiffe
Peasant
Peasant
Posts: 93
Joined: 21 Mar 2010

Unread postby tofiffe » 12 Aug 2010, 17:48

is there any way to make custom skill and add it to hero?

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

Unread postby Franzy » 12 Aug 2010, 18:59

Yes, pretty much. I did not try it myself, but I've seen many examples of my fellow mapmapkers.

tofiffe
Peasant
Peasant
Posts: 93
Joined: 21 Mar 2010

Unread postby tofiffe » 13 Aug 2010, 06:50

so any links or advices?

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

Unread postby Franzy » 14 Aug 2010, 12:24

Here is an example map... It's in russian though. http://all4heroes.net/forum/download/fi ... 265de51d31

tofiffe
Peasant
Peasant
Posts: 93
Joined: 21 Mar 2010

Unread postby tofiffe » 14 Aug 2010, 17:49

err...not spell, i meant skill like luck, leadership, attack...

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

Unread postby Franzy » 14 Aug 2010, 19:51

You mean teach hero a skill? You can do that via hero properties or via functions. Don't remeber the spelling. GiveHeroSkill or TeachHeroSkill...

tofiffe
Peasant
Peasant
Posts: 93
Joined: 21 Mar 2010

Unread postby tofiffe » 15 Aug 2010, 06:54

i know how to GIVE hero a skill, i want to CREATE a completely new one if possible...

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

Unread postby Franzy » 15 Aug 2010, 14:54

Aw, you mean a skill that would be available to ALL heroes? Might be possible, but not likely. Many skill-related things are hardcoded.

tofiffe
Peasant
Peasant
Posts: 93
Joined: 21 Mar 2010

Unread postby tofiffe » 16 Aug 2010, 07:17

well i wanted to create a skill, that would only be obtainable by script, there would be no other way of aquiring it. and while i'm asking, i saw buildings from towns in a few maps, how did ppl get them there?

tofiffe
Peasant
Peasant
Posts: 93
Joined: 21 Mar 2010

Unread postby tofiffe » 20 Aug 2010, 08:39

so no way to create a such skill?

then what is with adding those town buildings?

and startThread reports errors if i use no " too...
startThread(loop);
function loop()
for i=1,72 do
for j=1,72 do
SetObjectPosition("eyecandy", i,j,0);
startThread(loop);
end;
end;
end;

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

Unread postby Franzy » 22 Aug 2010, 17:24

Well, if you don't really need any GUI changes you can create any skill :)

As for startThread, the problems is probably in reverse calls. Your function loop calls itself. Don't know if lua can handle that. Anyway, it's always a bad idea.

tofiffe
Peasant
Peasant
Posts: 93
Joined: 21 Mar 2010

Unread postby tofiffe » 23 Aug 2010, 06:41

so how then call a loop?
and about the skill, how could i create it? i learn the best by looking at examples or by editing them...


Return to “Mapmaking Guild”

Who is online

Users browsing this forum: No registered users and 10 guests