I feel so dumb, sample map script not working!
I feel so dumb, sample map script not working!
Ok after reading many posts here I think I am missing something small to get this to work properly. I made the sample map that came with the map editor. However I can't get the Meeting to work..
In the Region i named it Meeting and the code from the editor sample is thus.
GiveExp ("Isabell", 2000);
function Meeting(heroname)
if heroname=="Christian" then
SetPlayerResource(PLAYER_1,6,10000);
AddHeroCreatures("Christian", 14, 5)
Trigger(REGION_ENTER_AND_STOP_TRIGGER,"meeting","Meeting"nil);
end;
end;
I also tried this script that looks so cool but it will not display either!
O do get the Function errors but read in posts here they do not matter/
What is missing? What am I doing wrong please?
MessageBox("Maps\SingleMissions\Go for first map\First Day text.txt");
-- only do this the first day
function NewDayTrigger()
if GetDate(DAY_OF_WEEK) == 1 then
-- do this first day of every week.
end;
end;
Trigger(NEW_DAY_TRIGGER, "NewDayTrigger");
In the Region i named it Meeting and the code from the editor sample is thus.
GiveExp ("Isabell", 2000);
function Meeting(heroname)
if heroname=="Christian" then
SetPlayerResource(PLAYER_1,6,10000);
AddHeroCreatures("Christian", 14, 5)
Trigger(REGION_ENTER_AND_STOP_TRIGGER,"meeting","Meeting"nil);
end;
end;
I also tried this script that looks so cool but it will not display either!
O do get the Function errors but read in posts here they do not matter/
What is missing? What am I doing wrong please?
MessageBox("Maps\SingleMissions\Go for first map\First Day text.txt");
-- only do this the first day
function NewDayTrigger()
if GetDate(DAY_OF_WEEK) == 1 then
-- do this first day of every week.
end;
end;
Trigger(NEW_DAY_TRIGGER, "NewDayTrigger");
Re: I feel so dumb, sample map script not working!
I'd say the meeting scripts should look like
What do the errormessages tell you?
Code: Select all
function Meeting(heroname)
if heroname=="Christian" then
SetPlayerResource(PLAYER_1,6,10000);
AddHeroCreatures("Christian", 14, 5);
Trigger(REGION_ENTER_AND_STOP_TRIGGER,"meeting",nil);
end;
end;
Trigger(REGION_ENTER_AND_STOP_TRIGGER, "meeting", "Meeting");
Pitsu's code will work for sure. Error was in this line:
Just too many arguments given to function Trigger().
.
Code: Select all
Trigger(REGION_ENTER_AND_STOP_TRIGGER,"meeting","Meeting"nil);
.
Well shoot I gave up on trying to get the Region code working for now.. and just Put this in. But the message box is not opening at all.
Could it be too long a Directory name? And If so can I change it in the Map properties?
MessageBox("Maps\SingleMissions\Go for first map\Firs.txt");
-- only do this the first day
function NewDayTrigger()
if GetDate(DAY_OF_WEEK) == 1 then
-- do this first day of every week.
Trigger(NEW_DAY_TRIGGER, "NewDayTrigger");
end;
end;
Trigger(NEW_DAY_TRIGGER, "NewDayTrigger");
ChangeHeroStat("Isabell",0, 2000);
Could it be too long a Directory name? And If so can I change it in the Map properties?
MessageBox("Maps\SingleMissions\Go for first map\Firs.txt");
-- only do this the first day
function NewDayTrigger()
if GetDate(DAY_OF_WEEK) == 1 then
-- do this first day of every week.
Trigger(NEW_DAY_TRIGGER, "NewDayTrigger");
end;
end;
Trigger(NEW_DAY_TRIGGER, "NewDayTrigger");
ChangeHeroStat("Isabell",0, 2000);
Most common problems with not appearing messages is either wrong path (yours seems OK), missing file (make sure that there is "Firs.txt" file) and finally an error somewhere else in the script that makes the game ignore the rest of the script file/function. You could try:
Code: Select all
function NewDayTrigger()
if GetDate(DAY) == 1 then
MessageBox("Maps\SingleMissions\Go for first map\Firs.txt");
end;
if GetDate(DAY_OF_WEEK) == 1 then
--Add the commands what need to be done first day each week
end;
end;
Trigger(NEW_DAY_TRIGGER, "NewDayTrigger");
Hummm.. getting very flustrated..
here is your code, I only changed the day.
function NewDayTrigger()
if GetDate(DAY) == 3 then
MessageBox("Maps\SingleMissions\Go for first map\firs.txt");
end;
if GetDate(DAY_OF_WEEK) == 3 then
AddHeroCreatures("Christian", 14, 5)
end;
Trigger(NEW_DAY_TRIGGER, "NewDayTrigger");
Now I copied the map first map.h5m to another directory and extracted it and yes firs.txt is in the file. and no monsters were added to the Hero. I even ran the game 2 full weeks.. Are we supposed to add the Hero's name to the properties under object Properties Tree?? I only see one Hero and thats Player 2 the computer.. Vittorio is shown under Map Objects. However under Object Properties Tree he is shown as Main Hero Christian. So Confusing.. Much Thanks for any help!
here is your code, I only changed the day.
function NewDayTrigger()
if GetDate(DAY) == 3 then
MessageBox("Maps\SingleMissions\Go for first map\firs.txt");
end;
if GetDate(DAY_OF_WEEK) == 3 then
AddHeroCreatures("Christian", 14, 5)
end;
Trigger(NEW_DAY_TRIGGER, "NewDayTrigger");
Now I copied the map first map.h5m to another directory and extracted it and yes firs.txt is in the file. and no monsters were added to the Hero. I even ran the game 2 full weeks.. Are we supposed to add the Hero's name to the properties under object Properties Tree?? I only see one Hero and thats Player 2 the computer.. Vittorio is shown under Map Objects. However under Object Properties Tree he is shown as Main Hero Christian. So Confusing.. Much Thanks for any help!
- Grumpy Old Wizard
- Round Table Knight
- Posts: 2205
- Joined: 06 Jan 2006
- Location: Tower Grump
You are missing an "end;" Put it after the AddHeroCreatures statement. Also you need a semicolon after AddHeroCreatures("Christian", 14, 5) like so:meows wrote:Hummm.. getting very flustrated..
here is your code, I only changed the day.
function NewDayTrigger()
if GetDate(DAY) == 3 then
MessageBox("Maps\SingleMissions\Go for first map\firs.txt");
end;
if GetDate(DAY_OF_WEEK) == 3 then
AddHeroCreatures("Christian", 14, 5)
end;
Trigger(NEW_DAY_TRIGGER, "NewDayTrigger");
Now I copied the map first map.h5m to another directory and extracted it and yes firs.txt is in the file. and no monsters were added to the Hero.
function NewDayTrigger()
if GetDate(DAY) == 3 then
MessageBox("Maps\SingleMissions\Go for first map\firs.txt");
end;
if GetDate(DAY_OF_WEEK) == 3 then
AddHeroCreatures("Christian", 14, 5);
end;
end;
Trigger(NEW_DAY_TRIGGER, "NewDayTrigger");
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."
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."
- theLuckyDragon
- Round Table Knight
- Posts: 4883
- Joined: 06 Jan 2006
Thank you Pitsu, Grumpy old Wizard and alavris! It's working!
here is the code. It seems it took adding the (( end; )) and reversing the slashes to make this beast work!
I have a question if you don't mind gentlemen,
1. How do you know how many (( end; )) you need?
2.When adding more than one function do you need anything between them?
3. Does anyone have any working region code? Simular to the region in the manual? That will not work either. I did change the code to reflect the
1.3 verson of the cheat codes but alas that was not enough.
Working and it really did put a smile on my face.. Thank you so much!
function NewDayTrigger()
if GetDate(DAY) == 3 then
MessageBox("Maps/SingleMissions/Go for first map/firs.txt");
end;
if GetDate(DAY_OF_WEEK) == 3 then
AddHeroCreatures("Christian", 14, 5);
end;
end;
Trigger(NEW_DAY_TRIGGER, "NewDayTrigger");
here is the code. It seems it took adding the (( end; )) and reversing the slashes to make this beast work!
I have a question if you don't mind gentlemen,
1. How do you know how many (( end; )) you need?
2.When adding more than one function do you need anything between them?
3. Does anyone have any working region code? Simular to the region in the manual? That will not work either. I did change the code to reflect the
1.3 verson of the cheat codes but alas that was not enough.
Working and it really did put a smile on my face.. Thank you so much!
function NewDayTrigger()
if GetDate(DAY) == 3 then
MessageBox("Maps/SingleMissions/Go for first map/firs.txt");
end;
if GetDate(DAY_OF_WEEK) == 3 then
AddHeroCreatures("Christian", 14, 5);
end;
end;
Trigger(NEW_DAY_TRIGGER, "NewDayTrigger");
1) "end" must be placed for exmple after:meows wrote:1. How do you know how many (( end; )) you need?
2.When adding more than one function do you need anything between them?
3. Does anyone have any working region code? Simular to the region in the manual? That will not work either. I did change the code to reflect the
1.3 verson of the cheat codes but alas that was not enough.
-function
-if ...
-for ...
-do while ...
So if you used in function an "if" you have to write two "end"s.
2) You don't need anything between them.
3) I'll search for for some good example in my map and will post here.
.
Ok, I've found in my map an example of working region script:
The region must be named archers1 and you also have to change path inside MessageBox() function. This script will work only when RED player comes into the region.
.
Code: Select all
function f_archers1(hero_name)
AddHeroCreatures(hero_name, CREATURE_ARCHER, 6);
if GetCurrentPlayer() == PLAYER_1 then
MessageBox("Maps/Multiplayer/Alavris 2/mess16.txt");
end;
Trigger(REGION_ENTER_AND_STOP_TRIGGER, "archers1", nil);
end;
Trigger(REGION_ENTER_AND_STOP_TRIGGER, "archers1", "f_archers1");
.
- Grumpy Old Wizard
- Round Table Knight
- Posts: 2205
- Joined: 06 Jan 2006
- Location: Tower Grump
If you are looking for example scripts feel free to download my map "Seize The Throne" in the maptesting section. The scripting is heavily commented so you should be able to see what I have done there.meows wrote:Oh thank you so much! I actually have 2 working scripts now.. WOOT..
Now on to getting to learn this much better.
Thank you guys!
All scripts are working and there are over 1000 lines of code. It is version 0.91. I am waiting for a couple of playtesters to finish their playthroughs to update to 1.0.
GOW
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."
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."
Who is online
Users browsing this forum: No registered users and 2 guests