Need help with gold mines HV (TotE)

Maps and the art of mapmaking.
User avatar
HellSpawn
Peasant
Peasant
Posts: 74
Joined: 06 Jan 2006

Need help with gold mines HV (TotE)

Unread postby HellSpawn » 30 Jul 2009, 02:16

I'm creating a multi-player map with 8 players.
I'm trying to mod. the gold mines to create a certain amount of gold per day.
Here's the script so far.....

function goodmorning()
local i, p
for i=1,8 do
p = GetObjectOwner("themine1");
if p~=PLAYER_NONE then
SetPlayerResource(p,GOLD,GetPlayerResource(p,GOLD)+49000);

sleep(1);
end;
end;
end;

Trigger(NEW_DAY_TRIGGER,"goodmorning");

Every time I use this, it makes the gold mine disappear.

Can anyone help me with this?
Last edited by HellSpawn on 30 Jul 2009, 16:54, edited 3 times in total.

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

Unread postby Franzy » 30 Jul 2009, 08:38

Well this is strange... Do you have 8 mines all named themine1, themine2, themine3... etc?

User avatar
HellSpawn
Peasant
Peasant
Posts: 74
Joined: 06 Jan 2006

Unread postby HellSpawn » 30 Jul 2009, 16:21

Franzy wrote:Well this is strange... Do you have 8 mines all named themine1, themine2, themine3... etc?
I copied the wrong script file, but I've corrected that.
I was using the script above on a test map just to see if it would work, but to no avail.

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

Unread postby Franzy » 31 Jul 2009, 06:22

That's strange, because this script is wrong, while the previous was correct :)

If you have only one gold mine, the script should look like:

unction goodmorning()
local p
p = GetObjectOwner("themine1");
if p~=PLAYER_NONE then
SetPlayerResource(p,GOLD,GetPlayerResource(p,GOLD)+49000);
end;
end;

Trigger(NEW_DAY_TRIGGER,"goodmorning");

Anyway, you can try this script with any object that can have owner. Replace the mine with a dwelling, garrison or town and see what happens. Maybe gold mines are just buggish :)

User avatar
HellSpawn
Peasant
Peasant
Posts: 74
Joined: 06 Jan 2006

Unread postby HellSpawn » 03 Aug 2009, 21:40

I've tried the script and the gold mine just disappears off of the map, just like before.
I can't seem to figure this one out.

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

Unread postby Franzy » 04 Aug 2009, 12:02

Did you try other objects?

User avatar
HellSpawn
Peasant
Peasant
Posts: 74
Joined: 06 Jan 2006

Unread postby HellSpawn » 05 Aug 2009, 20:17

Franzy wrote:Did you try other objects?

I suppose I could try a garden of the wee folk or something like that.
I'll keep you posted.

User avatar
HellSpawn
Peasant
Peasant
Posts: 74
Joined: 06 Jan 2006

Unread postby HellSpawn » 05 Aug 2009, 21:23

Well, I've tried to use other objects for the gold but it's not working, so I'm left with the solution of just adding more gold mines.

One more question I've had problems with....
I've been trying to remove the level 40 cap.
I've tried setting it to 0, and I've tried clicking on where it says "Remove Cap".
None of those things work.
Any suggestions?

User avatar
Grumpy Old Wizard
Round Table Knight
Round Table Knight
Posts: 2205
Joined: 06 Jan 2006
Location: Tower Grump

Unread postby Grumpy Old Wizard » 07 Aug 2009, 10:21

I read that some scripts don't work right in multiplayer. I've only done scripting in single player maps. It is difficult to see why your script would cause a gold mine to disappear just from checking ownership of the mine.

I checked mine ownership in a single player map that I was making (on which my hard drive died) and the mine did not disappear. I was also using labels similar to yours, as I had all the mines on the map named.

Oh, rdeford also has at least one map that checks mine ownership and the mines don't disappear. It is a single player map. Check out his "Mining Tycoon" map.

Click here

Here is one example of a script he uses for mines.
function countMines()
local count = 0;
for i=1, 20 do
if GetObjectOwner("mine"..i) == PLAYER_1 then
count = count + 1;
end;
end;
return count;
end;
SetPlayerResource(p,GOLD,GetPlayerResource(p,GOLD)+49000);
I suggest you break up this statement into two steps. Sometimes functions don't like other functions inside them even if it seems you should be able to do it.
Pgold = GetPlayerResource (p, 6) + 49000 -- 6=Gold
SetPlayerResource (p, 6, Pgold);
If it turns out that multiplayer scripting bugs are the problem then you could add in a quest for the extra gold, set a flag when the quest is completed and give gold accordingly. For example, "capturing" a statute could give a weekly income. Or a bounty quest where defeating a certain type of creature would give you an income bonus. I think there are lots of creative ways to add gold without just adding more gold mines, although there is nothing wrong with that, especially if you intend on players being able to hurt each other with raids on mines.
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."

User avatar
HellSpawn
Peasant
Peasant
Posts: 74
Joined: 06 Jan 2006

Unread postby HellSpawn » 08 Aug 2009, 16:56

The multi-player map just doesn't seem to like these scripts.
Oh well, thanks for all of your help Franzy & Grumpy Old Wizard.

It's appreciated.


Return to “Mapmaking Guild”

Who is online

Users browsing this forum: No registered users and 7 guests