hi there
I'd like to have a house (for example a quest hut) where I can buy level-ups. First, there should be the chance to choose the hero, who should get the level up, second the price should be told (current level multiplied with 500 gold...or something else), and at last, the question if the player would like to spend his money.
Further this must be available infinite times.
Is this possible?
[h4 editor] scripting a house, where I can buy levels
Re: [h4 editor] scripting a house, where I can buy levels
Hi! It's possible. Here's the script I've just written:
In the eiditor, name any peasant hut as "peasant_boss". When you enter this hut, the script starts working.
In this script I think it's not possible to ask heroe if he want to level up... he just must (beacuse of angry peasant ). The hero that will be leveled up is the hero that enters this hut. Everything else is as you wished.
If something isn't clear enough or you have same questions, just ask. I'll try to help.
.
Code: Select all
function fun1(oldowner, newowner, heroname, townname)
if GetPlayerResource(newowner, GOLD) >= GetHeroLevel(heroname)*500 then
MessageBox("Maps/Multiplayer/Alavris 1/wiad1.txt");
LevelUpHero(heroname);
SetPlayerResource(newowner, GOLD, GetPlayerResource(newowner, GOLD)-GetHeroLevel(heroname)*500);
SetObjectOwner("peasant_boss", PLAYER_NONE);
else
MessageBox("Maps/Multiplayer/Alavris 1/wiad2.txt");
end;
end;
Trigger(OBJECT_CAPTURE_TRIGGER, "peasant_boss", "fun1");
In this script I think it's not possible to ask heroe if he want to level up... he just must (beacuse of angry peasant ). The hero that will be leveled up is the hero that enters this hut. Everything else is as you wished.
If something isn't clear enough or you have same questions, just ask. I'll try to help.
.
Ok, so let's start from the beginning .nikon wrote:hm thanks, but I don't understand
1. Making the hut.
Place peasant hut which you want to be your leveling-heroe-up building.
Then mark it by cursor, so it's whole in red colour. Now press CTRL+SPACE... object propersties tree opens. In this tree change "Name" cell vaule to "peasant_boss".
2. Making message.
We have to make two diffirent messages that will appear in box when entering the hut. First (named "wiad1.txt") tells that you lose some money but your hero levels up. Second (named "wiad2.txt") tells that you have not enough money to level up your hero. So, in the editor, select View-->Map properties tree. Choose "Add" as shown:
Now click on "New" buttow as shown:
Write a name for your text file (first message must be named "wiad1.txt"), then click "Ok". New window appears. Here you can write text of your message. When finished, click "Ok".
Now repeat this process to create second message named "wiad2.txt".
3. Writing the script
In the editor, select View-->Map properties. New window appears. Now, select "Script" bookmark. Click "Edit Script" button. Now, paste here whole code I wrote in my previous post. But there are two places in this code which must be changed:
Code: Select all
MessageBox("Maps/Multiplayer/Alavris 1/wiad1.txt");
Code: Select all
MessageBox("Maps/Multiplayer/Alavris 1/wiad2.txt");
Hmm, I think it is all you should know... but ask if something goes wrong.
.
Indeed. So you can either script an amount for each hero level or you can measure amount of gold the player owns versus hero level to check whether the hero is 'eligible'. The latter has the downside that you cannot show the amounts the player needs to pay.nikon wrote: tried a few things, and the big problem is, that I can't say "take 'variable' gold from player", there has to be a number
Also, you cannot allow the player to choose a specific hero; unless all heroes have fixed names. Easiest way around that is probably to have the quest hut grant a level to the most powerful hero in the visiting army.
Allowing the script to run infinite times requires you to use the TRIGGERED tab.
There are multiple ways to handle this. One of them is to:
1. Leave the proposal message, progress message and completion script empty and insert an impossible quest requirement.
2. Under the triggered tab, put:
Code: Select all
SEQUENCE:
IF [introduction shown]
IF number of heroes in army = 0
DISPLAY: "Sorry, but only heroes can use this quest hut"
END-IF
ELSE
SEQUENCE:
SET [introduction shown] to TRUE
DISPLAY MESSAGE: "Blahblah quest hut, level up, costs money blahblah"
END-IF
IF number of heroes in army > 0
IF experience level of most powerful hero in army = 1
IF amount of gold player owns is >= 500
ASK "Do you want to pay 500 gold for an increase in level?"
IF YES:
DISPLAY MESSAGE "ALright. There you go"
SUBACTION1: take 500 gold from player
SUBACTION2: increase experience level of most powerful hero in army by +1
IF NO:
DISPLAY MESSAGE: "Suit yourself"
ELSE
DISPLAY MESSAGE: "You do not have enough gold"
END-IF
END-IF
END-IF
IF number of heroes in army > 0
IF experience level of most powerful hero in army = 2
IF amount of gold player owns is >= 1000
...etc....
If you only want to allow 1 level up per visit, you need to script this in 7-6-5-4-3-2-1 sequence.
Are you suggesting coconuts migrate?
You could allow less than 69 level ups
Or you could try the alternative scripting path; which is to:
1. Measure current amount of gold through a re-iterating take gold script (and give gold back afterwards) to determine maximum level up that is allowed. E.g. if cost is [500 gold * level], determine how many chunks of 500 fit in the player's total amount of gold.
2. Measure current hero level and check if it is lower or equal than the maximum allowed level according to 1.
3. If level up is allowed, ask if the player wants to level up. If so, take [current level * 500 gold] through a reiterating script and give a level.
Although this is a lot less scripting, it has the downside that it does not show the exact amount of gold to the player.
Or you could try the alternative scripting path; which is to:
1. Measure current amount of gold through a re-iterating take gold script (and give gold back afterwards) to determine maximum level up that is allowed. E.g. if cost is [500 gold * level], determine how many chunks of 500 fit in the player's total amount of gold.
2. Measure current hero level and check if it is lower or equal than the maximum allowed level according to 1.
3. If level up is allowed, ask if the player wants to level up. If so, take [current level * 500 gold] through a reiterating script and give a level.
Although this is a lot less scripting, it has the downside that it does not show the exact amount of gold to the player.
Are you suggesting coconuts migrate?
Who is online
Users browsing this forum: No registered users and 1 guest