Skip to content

Posts from Scripts

4.8 (8 ratings)
15 years ago
Auto-translated
Question: The QuestionBox function isn't working, but I've done everything as described in the manual:
---City---
function Great_Lord (heroname)
if GetObjectOwner(heroname) == 1 then
QuestionBox("City", "City_combat", "City_no_combat");
Trigger(REGION_ENTER_AND_STOP_TRIGGER, "City", nil);
end;
end;
Trigger(REGION_ENTER_AND_STOP_TRIGGER, "City", "Great_Lord");
-----
function City_combat (heroname)
StartCombat(NECROMANT, GREAT_LORD, 4, 42, 4, 40, 8, 38, 16, 36, 30, nil, nil, nil);
end;
---
function City_no_combat (heroname)
sleep(5);
end;
What's the correct way to do it?
In reply to Его Высокопреосвященство
User Avatar
15 years ago
Auto-translated
I've started learning scripting. Here's my first problem:
function oneF()
  MessageBox("/Maps/SingleMission/Test_map3/text.txt");
  Trigger(REGION_ENTER_AND_STOP_TRIGGER, "one", nil);
end;

Trigger(REGION_ENTER_AND_STOP_TRIGGER, "one", "oneF");

The trigger works (the hero stops), but the function doesn't. What's the problem?
15 years ago
Auto-translated
I've started learning scripts.
Here's the first problem:
function oneF()
MessageBox("/Maps/SingleMission/Test_map3/text.txt");
Trigger(REGION_ENTER_AND_STOP_TRIGGER, "one", nil);
end;

Trigger(REGION_ENTER_AND_STOP_TRIGGER, "one", "oneF");

The trigger works (the hero stops), but the function doesn't. What's the problem?

Put heroname in parentheses. In MessageBox("/Maps/SingleMission/Test_map3/text.txt"); the error is that it should be SingleMissions, not SingleMission. The second error is that you don't need "/" before Maps.
User Avatar
15 years ago
Auto-translated
The manual sometimes lies. Vampirlord can demand a lot of resources (it seems like the quantity parameter, but I'm not sure). You can't demand different types. Your Eminence, in your question box, the first parameter is incorrect; you need a text file.
15 years ago
Auto-translated
There’s already a message about it. The problem is known: the trigger works, but everything else doesn’t. What should be done?
User Avatar
15 years ago
Auto-translated
Which objects does OBJECT_TOUCH_TRIGGER and its associated MessageBox function apply to?
I tried it on a Sylvan tree – it works, but not on a tower that provides defense.
User Avatar
15 years ago
Auto-translated
Your Eminence, could you please clarify? In general, it's best to provide an exact quote from the script and ensure that the information is comprehensive (for example, you didn't include the values of the variables).
32metra works for everyone, except, I think, for Heroes. You most likely have some kind of error with the tower, or you didn't "disable" it.
User Avatar
15 years ago
Auto-translated
Ment, I checked everything and compared it with the tree.
And by the way, the message is displayed even if the object is not disabled.
User Avatar
15 years ago
Auto-translated
Okay, I'll do a more detailed analysis when I can. But this shouldn't be happening.
15 years ago
Auto-translated
---City---
function Great_Lord (heroname)
if GetObjectOwner(heroname) == 1 then
QuestionBox("City", "City_combat", "City_no_combat");
Trigger(REGION_ENTER_AND_STOP_TRIGGER, "City", nil);
end;
end;
Trigger(REGION_ENTER_AND_STOP_TRIGGER, "City", "Great_Lord");
-----
function City_combat (heroname)
StartCombat(NECROMANT, GREAT_LORD, 4, 42, 4, 40, 8, 38, 16, 36, 30, nil, nil, nil);
end;
---
function City_no_combat (heroname)
sleep(5);
end;

I have a quest on my map: to capture a city. When you approach the city, a message should appear: do you want to fight the city's owner (in this case, the QuestionBox script should work, where "City" is the text asking "Do you want to fight the city's owner," and the rest, "City_combat," "City_no_combat," are functions that should be executed). NECROMANT = "Giovanni," GREAT_LORD = "Aberrar." "City" is a region; when entering it, QuestionBox should be triggered. I don't understand what the problem is. Maybe I wrote something wrong in the last two QuestionBox functions.
User Avatar
15 years ago
Auto-translated
Did you use resources? Otherwise, how can a single word represent a text file? Resources might not even work; no one uses them, not even the developers.
15 years ago
Auto-translated
I keep making the same simple mistakes! Thank you so much, Ment, you've helped me out again!
User Avatar
15 years ago
Auto-translated
Does anyone know a way to disable music playback directly during gameplay? I need to play a sound, but it's almost inaudible because of the music, and increasing the volume is a rather crude way that's irritating to the ear.
In reply to Ment
15 years ago
Auto-translated
Ment
Is there a way to disable music playback during gameplay? I need to play a specific sound, but it's almost inaudible due to the music, and increasing the volume is a rather crude solution that's unpleasant to the ear.

I believe there are scripts for playing music/sounds – if you use them at the right time, the desired sound will be heard properly.

Statistics

Welcome our newest member: recijeb