Skip to content

Posts from Scripts

4.8 (8 ratings)
In reply to Его Высокопреосвященство
User Avatar
15 years ago
Auto-translated
No, I actually need the "else" part here... if I remove it, the map will completely lose its meaning...

Added 13 minutes later
Unfortunately, your example script turned out to be non-functional. By the way, "object" refers to the hut where they should give a quest... But since there is a line SetObjectEnabled("gloria", nil);, it seems that the object's own function should not be executed, only the script, but when I enter the hut, it displays the message "There is no one here"...
15 years ago
Auto-translated
I forgot something:
SetObjectEnabled("gloria", nil);
function gloriaF(heroname)
if HasArtefact("RedHeavenHero04", 58) = true then
MessageBox(GetMapDataPath().."gloriaF.txt");
ChangeHeroStat("RedHeavenHero04", STAT_EXPERIENCE, 8000);
Trigger(OBJECT_TOUCH_TRIGGER, "gloria", nil);
else MessageBox(GetMapDataPath().."gloria1F.txt");
end;
end;
Trigger(OBJECT_TOUCH_TRIGGER, "gloria", "gloriaF");
Although, it probably won't work. Could you provide a complete description of the quest with the scripts? I also have constant problems with if statements. I don't know how to deal with them.
15 years ago
Auto-translated
Now, give it a try.
Attachments 1
1 file attached • Total size: 47.0 KB
User Avatar
15 years ago
Auto-translated
If none of them work, there might be an error at the very beginning. I had this happen to me. For example, there might be an error in a certain line, and everything after that won't work until you fix that error.
User Avatar
15 years ago
Auto-translated
I am, of course, grateful to you, but you recorded the function not with a script; I can do that myself. What's important to me is the "else" part...
No, of course, it can be recorded with a completely different script, but this one is much simpler... and I still don't understand why scripts that display a message box when entering a region don't work... but nevertheless, thank you. I'll try to remove the first script; maybe the problem is in it. I'll let you know later.
15 years ago
Auto-translated
Try treating it as a task; everything will become much simpler, and you'll be able to write the `else` statement.
In reply to Его Высокопреосвященство
User Avatar
15 years ago
Auto-translated
Unfortunately, none of the scripts work. Now the trigger responds, but it doesn't reset and doesn't trigger the message box. I decided to delete all the scripts and remove the script files from the map; I'll try again and let you know.
User Avatar
15 years ago
Auto-translated
Here, I think I've fixed everything. The first two functions work perfectly; I haven't tested the last one.
Attachments 1
1 file attached • Total size: 46.6 KB
In reply to 32MeTpa
User Avatar
14 years ago
Auto-translated
Thank you! Now everything is working. :)
Dear "32Meters", could you describe my mistake? (I write scripts from memory and don't even look at the manuals.)
User Avatar
14 years ago
Auto-translated
I recommend checking the manuals. The most common errors are related to strange quotation marks. Use the script editor (MapScriptsEditor); it will detect these errors. There weren't many other minor errors.
In reply to 32MeTpa
User Avatar
14 years ago
Auto-translated
Thanks! The keyboard automatically types those quotation marks (it's an expensive keyboard that automatically adds quotation marks when needed if configured correctly), but I must have messed up the keyboard settings. I'll connect the old one to write scripts. :D
14 years ago
Auto-translated
How to properly use GetDate and NEW_DAY_TRIGGER?
User Avatar
14 years ago
Auto-translated
Here's an example from my map (a caravan arrives on Mondays):
function Caravan()
if GetDate(DAY_OF_WEEK)==1 then
goldy=GetPlayerResource(1, 6)+diff*10000;
SetPlayerResource(2, 6, goldy);
MessageBox(GetMapDataPath()..'NewCar.txt');
CreateCaravan('CN', 1, 0, 180, 1,0, 184, 14);
sleep(2);
if nom==0 then
AddObjectCreatures('CN',106,(5-diff)*10);
AddObjectCreatures('CN',107,(5-diff)*5);
elseif nom==1 then
AddObjectCreatures('CN',106,(5-diff)*20);
AddObjectCreatures('CN',107,(5-diff)*10);
AddObjectCreatures('CN',108,(5-diff)*5);
elseif nom==2 then
AddObjectCreatures('CN',106,(5-diff)*20);
AddObjectCreatures('CN',107,(5-diff)*10);
AddObjectCreatures('CN',108,(5-diff)*5);
AddObjectCreatures('CN',109,(5-diff)*3);
AddObjectCreatures('CN',110,(5-diff)*2);
elseif nom==3 then
AddObjectCreatures('CN',106,(5-diff)*30);
AddObjectCreatures('CN',107,(5-diff)*15);
AddObjectCreatures('CN',108,(5-diff)*8);
AddObjectCreatures('CN',109,(5-diff)*5);
AddObjectCreatures('CN',110,(5-diff)*3);
elseif nom==4 then
AddObjectCreatures('CN',106,(5-diff)*30);
AddObjectCreatures('CN',107,(5-diff)*15);
AddObjectCreatures('CN',108,(5-diff)*8);
AddObjectCreatures('CN',109,(5-diff)*5);
AddObjectCreatures('CN',110,(5-diff)*3);
AddObjectCreatures('CN',111,(5-diff)*2);
else
AddObjectCreatures('CN',106,(5-diff)*30);
AddObjectCreatures('CN',107,(5-diff)*15);
AddObjectCreatures('CN',108,(5-diff)*8);
AddObjectCreatures('CN',109,(5-diff)*5);
AddObjectCreatures('CN',110,(5-diff)*3);
AddObjectCreatures('CN',111,(5-diff)*2);
AddObjectCreatures('CN',112,(5-diff)*1);
end;
nom=nom+1;
end;
end;
Trigger(NEW_DAY_TRIGGER,'Caravan');
User Avatar
14 years ago
Auto-translated
Could you suggest a script that sends messages on a specific day? Something similar to what was in the third game.

Statistics

Welcome our newest member: recijeb