|
Thread: [Editor"MOD"]Heroes V Quest Editor | This thread is pages long: 1 2 3 4 5 6 · «PREV / NEXT» |
|
Lepastur
Known Hero
The Red Taskmaster
|
posted February 16, 2009 08:45 PM |
|
|
Just another question for our expert, Ash. I've been looking through the campaign maps and found it's possible to set some areas unpassable (although there are no obstacles which close them), but I'm wondering if it could be possible to set these areas only for certain players... do you know something about this matter?
____________
Torre de Marfil Foro / Portal - La Comunidad
hispana más completa sobre la saga Might&Magic.
|
|
Asheera
Honorable
Undefeatable Hero
Elite Assassin
|
posted February 16, 2009 09:12 PM |
|
|
Those 'unpassable' tiles are like that because of the masks. And afaik masks are universal.
Maybe you could use some tricks with "REGION_ENTER_AND_STOP_TRIGGER" type of triggers for some regions you don't want some heroes to pass. That kind of trigger will stop the hero once it gets into the region, and also execute the function you set.
Not sure it will lead to exactly what you want though.
____________
|
|
TSoD
Promising
Famous Hero
NCF Blacksmith
|
posted February 21, 2009 02:02 PM |
|
|
Hi
Watch my algorithm for the defeat all objective type. Syntaxically, it is all right. BUT the condition (GetPlayerState(i) == nil) returns always FALSE ! Even when all players are dead but the player 1...
Quote: function f_check__DefeatedAll0()
InactivePayersCount = 0--here
while v_check__IsDefeatedAll0Working do
print("entrer while")
InactivePlayersCount = 0--here
for i=1, 8 do
print(i)
if i == 1 then
print("IGNORER JOUEUR QUI TUE")
else if (GetPlayerState(i) == nil) then
print("Ajouter 1 à InactiveCount OK")
InactivePlayersCount = InactivePlayersCount + 1
end;
end;
end;--here
if (InactivePayersCount == 7) then if (GetPlayerState(1) == not nil) then
print("No award to give because the None award type has been checked.");
if not(GetObjectiveState("Quest1", 1) == OBJECTIVE_COMPLETED) then SetObjectiveState("Quest1", OBJECTIVE_COMPLETED, 1); end;
v_check__IsDefeatedAll0Working = false;
end;
end;
sleep(5);
end;
end;
--Starting Thread...
startThread(f_check__DefeatedAll0)
Why doesn't my condition work ?
____________
NCFBank,
the complete and homogen NCF
library.
|
|
kainc
Famous Hero
|
posted February 21, 2009 02:07 PM |
|
Edited by kainc at 14:14, 21 Feb 2009.
|
Quote: Hi
Watch my algorithm for the defeat all objective type. Syntaxically, it is all right. BUT the condition (GetPlayerState(i) == nil) returns always FALSE ! Even when all players are dead but the player 1...
I'm not a scripter or coder but should "nil" actually work? how about replacing it with "0"?
or you could try with
(GetPlayerState(1) > 0) then
|
|
Asheera
Honorable
Undefeatable Hero
Elite Assassin
|
posted February 21, 2009 03:59 PM |
|
|
No, it's correct with nil. That's how it is.
btw, TSoD, there's a special statement 'elseif' if you need such cases, no need to write 'else if' and have two 'end' because of that.
Example:
if a > b then
a = b
elseif a > c then
a = c
else
a = a + 1
end
____________
|
|
TSoD
Promising
Famous Hero
NCF Blacksmith
|
posted February 21, 2009 05:19 PM |
|
|
thanks for that asheera
btw have you the way to make two conditions in a if ? Like
if ((a > b) AND (a + b > 10)) then...
I tried with AND or && or & but the game always gets error.
And for my algorithm that return always false ? Do you have an idea ?
____________
NCFBank,
the complete and homogen NCF
library.
|
|
Asheera
Honorable
Undefeatable Hero
Elite Assassin
|
posted February 21, 2009 05:25 PM |
|
|
Sorry, I have no idea for the algorithm and why it goes wrong, it shouldn't return only false. I'm guessing there's an error somewhere else but I can't spot it because the code is hard to read since it's not formatted with spaces, etc.
As for the AND stuff, of course you can, but you have to write and (with small letters)
complex example:
if (a > b and c > d) or e > f then
something
end
____________
|
|
TSoD
Promising
Famous Hero
NCF Blacksmith
|
posted February 22, 2009 12:44 PM |
|
|
|
Asheera
Honorable
Undefeatable Hero
Elite Assassin
|
posted February 22, 2009 05:13 PM |
|
Edited by Asheera at 17:14, 22 Feb 2009.
|
I found a problem, sometimes you wrote InactivePayersCount instead of InactivePlayersCount. That typo screws everything (and also, you should revert back to "GetPlayerState(i) == nil" instead of "GetPlayerState(i) == 0")
____________
|
|
TSoD
Promising
Famous Hero
NCF Blacksmith
|
posted February 22, 2009 05:22 PM |
|
Edited by TSoD at 17:43, 22 Feb 2009.
|
OK thanks alot again, Asheera !!
EDIT : I did the corrections : there were two places where InacivePayerCount has been changed. I've also use the elseif keyword and also the 'and' to only improve the code. BUT it doesn't work yet...
There is the new MapScript.lua file.
Could you please look again :s :s Have you got any idea ?
____________
NCFBank,
the complete and homogen NCF
library.
|
|
Asheera
Honorable
Undefeatable Hero
Elite Assassin
|
posted February 22, 2009 05:48 PM |
|
|
Hmm can't spot any obvious problem, if you run the script what does it display in the console? Is there a whole script error or just the logic behind it? Those prints should help determine what's wrong as well.
____________
|
|
TSoD
Promising
Famous Hero
NCF Blacksmith
|
posted February 22, 2009 06:12 PM |
|
|
I know what's wrong, but I can't understand why. The condition in the "elseif" returns always false (GetPlayerState(i) == nil)...
It is the logic that have an error, not the script. The game run it very well.
It display always this :
Quote: entrer while
1
IGNORER JOUEUR QUI TUE
2
3
4
5
6
7
8
entrer while
1
IGNORER JOUEUR QUI TUE
2
3
4
5
6
7
8
entrer while
1
IGNORER JOUEUR QUI TUE
2
3
4
5
6
7
8
and so on...
Then this string is never printed : Ajouter 1 à InactiveCount OK.
It means that the count of inactive players is never incremented... (InactivePlayersCount = InactivePlayersCount + 1) and then that the last condition to complete the condition is always false too (if (InactivePayersCount == 7) and (GetPlayerState(1) == not nil))...
____________
NCFBank,
the complete and homogen NCF
library.
|
|
SimonaK
Promising
Supreme Hero
|
posted February 22, 2009 06:36 PM |
|
Edited by SimonaK at 18:37, 22 Feb 2009.
|
I dont know, i ant to try to help you.
Quote: returns always false (GetPlayerState(i) == nil)...
if I would be in your place, I wound like to know the value of GetPlayerState(i)
to test print the value of GetPlayerState(i) in each condition part:
if i == 1 then
print("IGNORER JOUEUR QUI TUE")
print(GetPlayerState(i))
else
print(GetPlayerState(i))
print("Ajouter 1 à InactiveCount OK")
InactivePlayersCount = InactivePlayersCount + 1
end;
|
|
Asheera
Honorable
Undefeatable Hero
Elite Assassin
|
posted February 22, 2009 09:41 PM |
|
|
Are you sure there are inactive players on the map?
____________
|
|
TSoD
Promising
Famous Hero
NCF Blacksmith
|
posted February 23, 2009 09:37 AM |
|
Edited by TSoD at 09:45, 23 Feb 2009.
|
Well, if they don't exists or if they are dead, I consider them as inactive... No ?
OMG why didn't ubi give us ALL available functions and their correct use !
EDIT : I did what you said SimonaK, I print this :
print(GetPlayerState(i) == nil)
as second instruction of the FOR algorithm (so just after the "print(i)" instruction). And it returns always "nil" in the game...
Quote: entrer while
1
nil
IGNORER JOUEUR QUI TUE
2
nil
3
nil
4
nil
5
nil
6
nil
7
nil
8
nil
1
nil
IGNORER JOUEUR QUI TUE
2
...
____________
NCFBank,
the complete and homogen NCF
library.
|
|
Asheera
Honorable
Undefeatable Hero
Elite Assassin
|
posted February 23, 2009 05:38 PM |
|
Edited by Asheera at 17:38, 23 Feb 2009.
|
Write:
print(GetPlayerState(i))
And not:
print(GetPlayerState(i) == nil)
And let's see what it shows.
____________
|
|
TSoD
Promising
Famous Hero
NCF Blacksmith
|
posted February 24, 2009 11:00 AM |
|
Edited by TSoD at 12:38, 24 Feb 2009.
|
Yeah !
Thanks to you, I found the way ! It works now !
GetPlayerState(X) == 1 --returns true if the player is playing now
GetPlayerState(X) == 3 --returns true if the player is defeated
GetPlayerState(X) == 4 --returns true if the player does NOT exist on this map (for example, a map with only two players, the Red and the Blue. The six others are on "4").
Thanks alot for your debugging method Asheera
EDIT : and for the GetMapDataPath... I don't understand, I write this instruction :
if (GetPlayerResource(1, GOLD) >= 35000) and (GetPlayerResource(1, WOOD) >= 0) and (GetPlayerResource(1, ORE) >= 0) and (GetPlayerResource(1, MERCURY) >= 0) and (GetPlayerResource(1, SULFUR) >= 0) and (GetPlayerResource(1, GEM) >= 0) and (GetPlayerResource(1, CRYSTAL) >= 0) then
print("!!resources given")
SetPlayerResource(1, 0, (GetPlayerResource(1, 0) + 99999));
MessageBox(GetMapDataPath().."AwardsMessageBoxes/f_check__ResourcesAssembled0.txt", nil);
if not(GetObjectiveState("Quest1", 1) == OBJECTIVE_COMPLETED) then SetObjectiveState("Quest1", OBJECTIVE_COMPLETED, 1); end;
v_check__IsResourcesAssembled0Working = false
end;
The file in its folder exists, is coded in UNICODE, but the messagebox does not appear at all !
And this is strange : all other instructions are executed : complete the objective, print 'resources given', add 99999 to the wood. The only thing that doesn't work is the MessageBox... And the console doesN'T tell me 'Empty message text !'... Strange strange...
|
|
Asheera
Honorable
Undefeatable Hero
Elite Assassin
|
posted February 24, 2009 03:43 PM |
|
|
Nothing comes to mind, except maybe try to use the other slash after the folder name. (the "\" one instead of "/")
____________
|
|
TSoD
Promising
Famous Hero
NCF Blacksmith
|
posted February 24, 2009 04:58 PM |
|
|
In fact, I used this one ('\') the first time, but the game told me 'Empty Message Text !'. But when I tried with the '/' one, the game told me nothing... But didn't show any message box !
|
|
Asheera
Honorable
Undefeatable Hero
Elite Assassin
|
posted February 24, 2009 05:04 PM |
|
|
Well I guess that means the path and filename are correct.
Are you running the game in Single player or Hot Seat? Because if it's Hot Seat, you may need to use MessageBoxForPlayers() which has an additional first parameter to specify the player filter.
____________
|
|
|