Skip to content

Posts from Scripts

4.8 (8 ratings)
User Avatar
13 years ago
Auto-translated
Okay, I didn't know where to post this, so I'll post it here: Is it possible to make a hero gain levels after level 40? I know it's probably a silly idea, and I'll have to manually adjust the amount of experience gained, but still.
In reply to Олегарх
User Avatar
13 years ago
Auto-translated
Oligarch
I was thinking... I'll place the objects and then just move them around. It will be easier, IMHO.
In Resources\pointLights\, you just need to set the light points, like in the object properties, and give them a name, and then call the function SetObjectFlashlight("object name", "light point name")
to disable it, the second parameter should be ""

Added 4 minutes later
Heroist
Okay, I didn't know where to write this, so I'll write it here: Is it possible to make a hero gain levels after level 40? I know it's probably nonsense, and I'll have to manually work with the amount of experience gained, but still.
For now, there is no way to influence this.
User Avatar
13 years ago
Auto-translated
Not good, I'd say. It seems like the amount of experience needed has increased; it was 1..., and now it's 2... (million/billion, I'm not sure). In that case, we'll just have to reduce the amount of experience on the map. Thanks.
User Avatar
13 years ago
Auto-translated
Is it possible to use the same name for an object ('druid1') and a variable (druid1 = 0) in a script? I did this with a druid, and now the console says "object 'druid1' does not exist or is not interactive." Is this the problem, or should I check the script?
In reply to Heroist
User Avatar
13 years ago
Auto-translated
Is it possible to determine if a tile is occupied?
In reply to Heroist
User Avatar
13 years ago
Auto-translated
Heroist
Is it possible to use the same name for an object ('druid1') and a variable (druid1 = 0) in a script? I did this with a druid, and now the console says "object 'druid1' does not exist or is not interactive." Is this the problem, or should I check the script?
Yes, you can. :) The error is most likely in the SetObjectEnabled function or a Trigger.

Added 1 minute ago
Oligarch
Is it possible to determine if a tile is occupied?
IsTilePassable(x, y, floor) returns:
1 - if not occupied
nil - if occupied

It considers water impassable by default.
User Avatar
13 years ago
Auto-translated
Hmm, thank you.

Added 37 minutes ago
here are a couple more questions:

1) Where is the error? The script doesn't work at all, it doesn't even try.


---transformation (trans)---

trans = 0

function trans()
while 1 do
sleep(1)
if GetObjectOwner ('elftown') == 1 and trans == 0 then
sleep(1)
ShowFlyingSign(GetMapDataPath().."trans1.txt", "Berein", -1, 7);
sleep(5)
TransformTown ('elftown' , 4)
ReplaceDwelling ('elfdwel1' , 4)
ReplaceDwelling ('elfdwel2' , 4)
ReplaceDwelling ('elfdwel3' , 4)
ReplaceDwelling ('elfdwel4' , 4)
trans = 1
end
end
end
startThread (trans)


(Everything is named correctly, as in the editor)

2) Can I immediately destroy the tavern in the town right after the transformation? (I remember asking a similar question, but I didn't quite manage it, or I was just lazy)
In reply to Heroist
User Avatar
13 years ago
Auto-translated
Heroist
Hmm, thank you.

Added 37 minutes ago
here are a couple more questions:

1) Where is the error? The script doesn't work at all, it doesn't even try.


---transformation (trans)---

trans = 0

function trans()
while 1 do
sleep(1)
if GetObjectOwner ('elftown') == 1 and trans == 0 then
sleep(1)
ShowFlyingSign(GetMapDataPath().."trans1.txt", "Berein", -1, 7);
sleep(5)
TransformTown ('elftown' , 4)
ReplaceDwelling ('elfdwel1' , 4)
ReplaceDwelling ('elfdwel2' , 4)
ReplaceDwelling ('elfdwel3' , 4)
ReplaceDwelling ('elfdwel4' , 4)
trans = 1
end
end
end
startThread (trans)


(Everything is named correctly, as in the editor)

2) Can I immediately destroy the tavern in the town right after the transformation? (I remember asking a similar question, but it didn't quite work out, or I was just too lazy)


In the StartTread line, there is a syntax error. The function is written with a lowercase letter
User Avatar
13 years ago
Auto-translated
That's not the point. I have everything written like that.)))

I'll check it now, but I'm already used to writing it this way; it doesn't seem to depend on whether it's uppercase or lowercase...
User Avatar
13 years ago
Auto-translated
I mean, the StartTread itself is written with a lowercase letter. I think it shouldn't be like that.
User Avatar
13 years ago
Auto-translated
Well, that’s what I’m saying, it’s always written that way for me, and it works. I don’t think the script checks for that.

Now I’ll try writing it with a capital letter, but this 93.734% won’t help, unfortunately.

Added 4 minutes later
No, I wrote it with a capital letter, and now the script is complaining about the function altogether.
User Avatar
13 years ago
Auto-translated
I don't quite understand this function, unfortunately. As I understand it, the condition in the trans function's loop is false from the very beginning of the game (if elftown doesn't belong to player 1). Doesn't this cause StartThread to stop working?

Added 1 minute later
although, no, I probably said something nonsensical.
User Avatar
13 years ago
Auto-translated
startThread simply launches a function. It's like a trigger, but it doesn't depend on anything. Moreover, if you put a while loop, the function will be checked endlessly immediately after launch. I think the problem might be with sleep, as the script might simply not have enough time to execute))

Added 1 minute ago
Although, actually, no, that's not the problem. There are plenty of sleeps there... There's also a pop-up message...

Added 2 minutes ago
Damn, I changed the variable name, and it all started working. What a load of nonsense...

There's still a second question...

Added 22 minutes ago
I'm completely confused..

SetTownBuildingLimitLevel('elftown', TB_TAVERN, 0)
SetObjectDwellingCreatures('elftown' , 2, 100)

In the first case, it doesn't understand the building type, and I can't find another one. It also doesn't work with quotes.
In the second case, it doesn't want to add creatures for recruitment. Although all the creature dwellings are built.
It's terrible
In reply to Heroist
User Avatar
13 years ago
Auto-translated
Heroist

In the first case, it doesn't recognize the building type, and I can't find another one. It also doesn't work with quotes.
Try one of these options:
TOWN_BUILDING_TAVERN = 4

Statistics

Welcome our newest member: recijeb