Heroes V map editor questions
As a side note, GetGameVar and SetGameVar are useful only when you need to exchange a variable between multiple scripts (example: the main map script modifies a variable which is shared and used in a combat script as well)
A global script variable like I gave example above is GLOBAL but only to the script you're currently in. Variables defined through SetGameVar and retrieved with GetGameVar are GLOBAL for the entire game session.
A global script variable like I gave example above is GLOBAL but only to the script you're currently in. Variables defined through SetGameVar and retrieved with GetGameVar are GLOBAL for the entire game session.
No matter how powerful one becomes, there is always someone stronger. That's why I'm in a constant pursuit of power, so I can be prepared when an enemy tries to take advantage of me.
-
- Lurker
- Posts: 1
- Joined: 15 Sep 2008
Spell Question
Hi all, this is my first post and I'm hoping I'm getting it in the right spot.
I'm trying to build a map with towns that have preplanned spells in the guilds. Can't do it... According to the search I've done here, the solution is to click the 'Spells' tab in the object properties box. But there is no such tab. Instead I've got: Garrison, Town Specialization, Script, Player, Buildings and Garrison Hero.
I'm sorry for such a lame question, but I don't know where to look and the manual is not very helpful.
I'm trying to build a map with towns that have preplanned spells in the guilds. Can't do it... According to the search I've done here, the solution is to click the 'Spells' tab in the object properties box. But there is no such tab. Instead I've got: Garrison, Town Specialization, Script, Player, Buildings and Garrison Hero.
I'm sorry for such a lame question, but I don't know where to look and the manual is not very helpful.
Hey, Question:
Is there any way to make a script function that would ask a riddle for example, that the player would have to answer? I have no idea if this is even possible, let alone how to do it.
Is there any way to make a script function that would ask a riddle for example, that the player would have to answer? I have no idea if this is even possible, let alone how to do it.
I swear - by my life, and my love of it - that I will never live for the sake of another man, nor ask another man to live for mine.
- Grumpy Old Wizard
- Round Table Knight
- Posts: 2205
- Joined: 06 Jan 2006
- Location: Tower Grump
Franzy mentioned a new undocumented functinon TalkBoxForPlayers that could possibly be useed for that. I'm not really clear on what all the function does. Otherwise you could try using several QuestionBox functions.
viewtopic.php?t=9219
viewtopic.php?t=9219
Frodo: "I wish the ring had never come to me. I wish none of this had happened."
Gandalf: "So do all who live to see such times but that is not for them to decide. All we have to decide is what to do with the time that is given to us."
Gandalf: "So do all who live to see such times but that is not for them to decide. All we have to decide is what to do with the time that is given to us."
With help from Franzy's postings, I wrote a working talk box for players that displays four choices for the player to choose from. Here is the code (Sorry about the line wraps; It looks better in the editor.):
Code: Select all
pFilter = {1, 2, 4, 8}; -- player 1-4 filter constants for multiplayer functions
pFlt = pFilter[pNum]; -- get the player filter
TalkBoxForPlayers
(
pFlt, -- show talk box to chosen player
'/Textures/Interface/Sphinx/SphinxIcon.(Texture).xdb#xpointer(/Texture)', --iconRef
'', -- iconTooltipRef ref to txt file with text that will appear when hovering mouse above icon
path..'ssMainText.txt', -- textRef - text that would be shown beside icon (no show, bug)
path..'ssAddText.txt', -- text that is shown below the buttons with options
'ssChoiceHandler', -- callback - name of a function that will be envoked when player hits OK button.
0, -- mode
path..'ssCaptionText.txt', -- titleTextRef - Caption text in the upper part of dialog (not mandatory)
path..'ssSelectionText.txt', -- selectTextRef - Text that will be shown above options (not mandatory
0, -- default option sent when player clicks OK without making selection
path..'ssOption1.txt', -- optionTextRef - text for options. 5 options possible
path..'ssOption2.txt',
path..'ssOption3.txt',
path..'ssOption4.txt'
);
function ssChoiceHandler(playerID, choice)
print("player is ", playerID, " -- choice is ", choice);
if choice == 1 then
for i=1, 4 do
local pSta = GetPlayerState(i); -- active players are 1
if pSta == 1 then
local pRes = GetPlayerResource(i, WOOD);
SetPlayerResource(i, WOOD, pRes + (3 * gSSbase));
local pRes = GetPlayerResource(i, ORE);
SetPlayerResource(i, ORE, pRes + (3 * gSSbase));
end;
end;
end;
if choice == 2 then
for i=1, 4 do
local pSta = GetPlayerState(i); -- active players are 1
if pSta == 1 then
local pRes = GetPlayerResource(i, MERCURY);
SetPlayerResource(i, MERCURY, pRes + (2 * gSSbase));
local pRes = GetPlayerResource(i, CRYSTAL);
SetPlayerResource(i, CRYSTAL, pRes + (2 * gSSbase));
end;
end;
end;
if choice == 3 then
for i=1, 4 do
local pSta = GetPlayerState(i); -- active players are 1
if pSta == 1 then
local pRes = GetPlayerResource(i, SULFUR);
SetPlayerResource(i, SULFUR, pRes + (2 * gSSbase));
local pRes = GetPlayerResource(i, GEM);
SetPlayerResource(i, GEM, pRes + (2 * gSSbase));
end;
end;
end;
if choice == 4 then
for i=1, 4 do
local pSta = GetPlayerState(i); -- active players are 1
if pSta == 1 then
local pRes = GetPlayerResource(i, GOLD);
SetPlayerResource(i, GOLD, pRes + (1500 * gSSbase));
end;
end;
end;
MessageBoxForPlayers(PLAYERFLT_ALL,{ path.."supplyShip.txt"; pNum = playerColors[playerID], res = resName[choice]},nil );
end;
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
“Forgiving and being forgiven, loving and being loved,
living and letting live, is the simple basis for it all."
Ernest Holmes 1984
Is there a way to prevent a hero from getting a specific skill?
For example, I'm strictly controlling the troops the hero can have, but he is a ranger, so I want to prevent him from getting Battle Commander, which would give him war dancers every week.
For example, I'm strictly controlling the troops the hero can have, but he is a ranger, so I want to prevent him from getting Battle Commander, which would give him war dancers every week.
I swear - by my life, and my love of it - that I will never live for the sake of another man, nor ask another man to live for mine.
Oh... There was some ambiguous wording on the skill wheel. I just changed the hero type to warlock, lol.
So, new question: Is there any way to make lava passable? I've got the whole elemental thing going on and a part of the map is devoted to fire elementals, so I want their territory to be lava and the water elementals to be water...
So, new question: Is there any way to make lava passable? I've got the whole elemental thing going on and a part of the map is devoted to fire elementals, so I want their territory to be lava and the water elementals to be water...
I swear - by my life, and my love of it - that I will never live for the sake of another man, nor ask another man to live for mine.
Any tile can be made passable with a little trick. Just create a dubble (your own copy) of an object you want to make "ghosty" (fully passable) then open its properties tree, locate property "BlockedTiles" and clear all entries. Voila.
I would recommend to do the trick only with static objects (trees, mountains, etc), cause active objects (dolmens, towns, dwellings, etc) also have ActiveTiles. And I am not sure if you can safely remove them.
Beware that hero will pass THRUGH ghosty objects, not walking on their surface.
P.S. I hope you know how to make object dubbles. If not, read the thread, it was discussed many times. Also it's described in editor manual.
I would recommend to do the trick only with static objects (trees, mountains, etc), cause active objects (dolmens, towns, dwellings, etc) also have ActiveTiles. And I am not sure if you can safely remove them.
Beware that hero will pass THRUGH ghosty objects, not walking on their surface.
P.S. I hope you know how to make object dubbles. If not, read the thread, it was discussed many times. Also it's described in editor manual.
What is wrong about this?
first one the angel join note works, but other textboxes not show?
is it have to be wrote scripts in right order on script editor?
i mean if this angel join comes later than "orchnote" and before "exporgold"
???
first one the angel join note works, but other textboxes not show?
is it have to be wrote scripts in right order on script editor?
i mean if this angel join comes later than "orchnote" and before "exporgold"
???
-------------------------------------------------------------------------------
----------------angel join note------------------------------------------------
function angeljoining(h,rg)
if h == "Nicolai" then
Trigger( REGION_ENTER_AND_STOP_TRIGGER, "rgnangeljoin", nil );
MessageBox("Maps/SingleMissions/Demon Urgash/angeljoinnote.txt");
GiveExp( "Nicolai", 8000 );
GiveResources( "Nikolai", 10000, 6 );
end;
end;
Trigger( REGION_ENTER_AND_STOP_TRIGGER, "rgnangeljoin", "angeljoining" );
------------------------------------------------------------------------------
------------------------------------------------------------------------------
function expgoldnote(h,rg)
if h == "Nicolai" then
Trigger( REGION_ENTER_AND_STOP_TRIGGER, "rgnexpgoldnote", nil );
MessageBox("Maps/SingleMissions/Demon Urgash/expgold.txt");
GiveExp( "Nicolai", 2000 );
GiveResources( "Nikolai", 10000, 6 );
end;
end;
Trigger( REGION_ENTER_AND_STOP_TRIGGER, "rgnexpgoldnote", "expgoldnote" );
-----------------------------------------------------------------------------
-----------------------------------------------------------------------------
function orchold(h,rg)
if h == "Nicolai" then
Trigger( REGION_ENTER_AND_STOP_TRIGGER, "rgnorchold", nil );
MessageBox("Maps/SingleMissions/Demon Urgash/orchold.txt");
end;
end;
Trigger( REGION_ENTER_AND_STOP_TRIGGER, "rgnorchold", "orchold" );
-----------------------------------------------------------------------------
-----------------------------------------------------------------------------
Is GiveResources your own function?
Everything seems fine. There might be problems with region names though. They should match exactly, so watch trailing spaces and letter case.
Also, as I told you already, look what the console says. It points out error AND the line number. No need to play guess games.
Everything seems fine. There might be problems with region names though. They should match exactly, so watch trailing spaces and letter case.
Also, as I told you already, look what the console says. It points out error AND the line number. No need to play guess games.
well thats why i asking because console not so errors..
and that giveresources are not my. but its not problem there because other fuctions work perfectly even that is there..
i have looked regions aswell..hmm maybe im too hesitated.. maybe i need to look very sharp.. because mistakes come.. and i had erros what i solved a lot. triple check is good
btw whole script is now 132 lines long and those are last ones and they not show..
AND script starts. all other work.. so its not big mistake because scripth work else good..
EDIT:
-------------------------------------------------------------------------------------------------
ääh i found problem and solve it.
region area was too small
and that giveresources are not my. but its not problem there because other fuctions work perfectly even that is there..
i have looked regions aswell..hmm maybe im too hesitated.. maybe i need to look very sharp.. because mistakes come.. and i had erros what i solved a lot. triple check is good
btw whole script is now 132 lines long and those are last ones and they not show..
AND script starts. all other work.. so its not big mistake because scripth work else good..
EDIT:
-------------------------------------------------------------------------------------------------
ääh i found problem and solve it.
region area was too small
New question. i have seen this some where in this forum but not find which topic it was..
so..
how i can make monster as a normal object what dont attack me but acts like friendly unit, and when my hero touch it, textbox appears and then give spell and then vanish from map
i dea is that i want make vampire to give me vampirism spell when i "talk" with him
so..
how i can make monster as a normal object what dont attack me but acts like friendly unit, and when my hero touch it, textbox appears and then give spell and then vanish from map
i dea is that i want make vampire to give me vampirism spell when i "talk" with him
1) Name your monster, e.g. "thevampire"
2) Add these lines to your script:
function speaktovampire(obj,h)
MessageBox(...)
TeachHeroSpell(h, SPELL_VAMPIRISM);
end;
SetObjectEnabled("thevampire",nil)
Trigger(OBJECT_TOUCH_TRIGGER,"thevampire","speaktovampire");
(lines can contain errors, check them by referencing the manuals, but the idea is correct)
3) You may also want to add custom description to the monster and change cursor from "sword" to "interaction", there functions for that.
2) Add these lines to your script:
function speaktovampire(obj,h)
MessageBox(...)
TeachHeroSpell(h, SPELL_VAMPIRISM);
end;
SetObjectEnabled("thevampire",nil)
Trigger(OBJECT_TOUCH_TRIGGER,"thevampire","speaktovampire");
(lines can contain errors, check them by referencing the manuals, but the idea is correct)
3) You may also want to add custom description to the monster and change cursor from "sword" to "interaction", there functions for that.
when i go to vampire i cannot go to him.. i can see sword coming on it but when i double click i cannot move to him...
here is a code...
console not say nothing.
AND i not found info in " script functions" manual..
here is a code...
and i have change vampire name "thevampire" in monsters properties when i click it and map properties tree appereas at this monster only. there is "name" option so i though it that what u say?-------vampire speak--------------------------------------------------------
function speaktovampire(obj,h)
MessageBox("Maps/SingleMissions/Demon Urgash/kuiskaus.txt" );
TeachHeroSpell(h, SPELL_VAMPIRISM);
end;
SetObjectEnabled("thevampire",nil)
Trigger(OBJECT_TOUCH_TRIGGER,"thevampire","speaktovampire");
console not say nothing.
AND i not found info in " script functions" manual..
Correct script, should work:
------vampire speak--------------------------------------------------------
function speaktovampire(h)
MessageBox("Maps/SingleMissions/Demon Urgash/kuiskaus.txt" );
TeachHeroSpell(h, SPELL_VAMPIRISM);
end;
SetObjectEnabled("thevampire",nil)
Trigger(OBJECT_TOUCH_TRIGGER,"thevampire","speaktovampire");
------vampire speak--------------------------------------------------------
function speaktovampire(h)
MessageBox("Maps/SingleMissions/Demon Urgash/kuiskaus.txt" );
TeachHeroSpell(h, SPELL_VAMPIRISM);
end;
SetObjectEnabled("thevampire",nil)
Trigger(OBJECT_TOUCH_TRIGGER,"thevampire","speaktovampire");
Who is online
Users browsing this forum: Semrush [Bot] and 0 guests