Command Help
Command Help
Is there a way to detect when the (end of turn) button is pushed?
Like:
If the end of turn is pushed
then if it is day 7
then if the dendoid dwelling still has men in it
you did not visit the dendoid dwelling this week.
I need a script see script help for explaination.
Like:
If the end of turn is pushed
then if it is day 7
then if the dendoid dwelling still has men in it
you did not visit the dendoid dwelling this week.
I need a script see script help for explaination.
- Gaidal Cain
- Round Table Hero
- Posts: 6972
- Joined: 26 Nov 2005
- Location: Solna
What I need is this:
The hero (and there can be only one) visits a dendroid dwelling.
If the hero visits and collects the dendroids 3 weeks in a row a sawmill will be built nearby.
I know how to build the sawmill but I need a way to check if the dendroids were picked up each week. If there is an eiser way of accomplishing this please let me know.
If I can check the dwelling on day 7 to see if dendroids are present and do this 3 weeks in a row, I will know when to build the sawmill.
Please help, I have been working on this one for a long time.
The hero (and there can be only one) visits a dendroid dwelling.
If the hero visits and collects the dendroids 3 weeks in a row a sawmill will be built nearby.
I know how to build the sawmill but I need a way to check if the dendroids were picked up each week. If there is an eiser way of accomplishing this please let me know.
If I can check the dwelling on day 7 to see if dendroids are present and do this 3 weeks in a row, I will know when to build the sawmill.
Please help, I have been working on this one for a long time.
- Gaidal Cain
- Round Table Hero
- Posts: 6972
- Joined: 26 Nov 2005
- Location: Solna
OK, I see. While your way seems to be possible, I'd take another route. First, does the hero actually needs to buy dendroids, or is it enough that he visits theiur dwelling? I'm going to go with the latter, but if it's the former, you only have to add a check to see hom many dendroids there are in the dwelling.
What you do is that you use two variables, one that keeps the last week the dwelling was visited, and one that keeps the number of times it has been visited in a row. Whenever the hero visits the dwelling, you check when the last time he visited was. If it was last week, you increase the other variable by one. If it wasn't last week, you set it to one. Then you check that variable- if it's 3, you build the sawmill. The code would go something like below. I'll use v1 and v2 for number of times visited and last week visited (in that order), but you can of course exchange them to whatever you want.
Hope this helps
What you do is that you use two variables, one that keeps the last week the dwelling was visited, and one that keeps the number of times it has been visited in a row. Whenever the hero visits the dwelling, you check when the last time he visited was. If it was last week, you increase the other variable by one. If it wasn't last week, you set it to one. Then you check that variable- if it's 3, you build the sawmill. The code would go something like below. I'll use v1 and v2 for number of times visited and last week visited (in that order), but you can of course exchange them to whatever you want.
Code: Select all
!#VRv1:S0;
!#VRv2:S0; (initialize variables (v2=0 for convenience- don't have to have separate check for week 1))
!?OBx/y/z;
!!FU&v1=3:E; (this is just to skip everything if the mill already have been built)
!!VRy1:Sc-1 :7; (Get current week minus one)
!!VRv1&y1=v2:+1;
!!VRv1&y1<>v2:S1; (if didn't visit last week, set number of times visited to 1- you're here now)
!!VRv2:Sy1+1; (v2 now holds the week for visit)
(build sawmill if v2=3)
You don't want to make enemies in Nuclear Engineering. -- T. Pratchett
- Qurqirish Dragon
- Genie
- Posts: 1011
- Joined: 06 Jan 2006
- Location: Flying the skies of Ohlam
One slight problem with this code- if you visit a second time in the same week, then v2 will not be the same as y1, and the counter will reset. After setting y1 to last week's number, you should add:Gaidal Cain wrote:OK, I see. While your way seems to be possible, I'd take another route. First, does the hero actually needs to buy dendroids, or is it enough that he visits theiur dwelling? I'm going to go with the latter, but if it's the former, you only have to add a check to see hom many dendroids there are in the dwelling.
What you do is that you use two variables, one that keeps the last week the dwelling was visited, and one that keeps the number of times it has been visited in a row. Whenever the hero visits the dwelling, you check when the last time he visited was. If it was last week, you increase the other variable by one. If it wasn't last week, you set it to one. Then you check that variable- if it's 3, you build the sawmill. The code would go something like below. I'll use v1 and v2 for number of times visited and last week visited (in that order), but you can of course exchange them to whatever you want.
Hope this helpsCode: Select all
!#VRv1:S0; !#VRv2:S0; (initialize variables (v2=0 for convenience- don't have to have separate check for week 1)) !?OBx/y/z; !!FU&v1=3:E; (this is just to skip everything if the mill already have been built) !!VRy1:Sc-1 :7; (Get current week minus one) !!VRv1&y1=v2:+1; !!VRv1&y1<>v2:S1; (if didn't visit last week, set number of times visited to 1- you're here now) !!VRv2:Sy1+1; (v2 now holds the week for visit) (build sawmill if v2=3)
Code: Select all
!!VRy2:Sy1+1; (get current week)
Code: Select all
!!VRv1&y1<>v2/y2<>v2:S1; (if didn't visit last week or this week, set number of times visited to 1- you're here now)
UN Command
In the help file under the UN Command it says:
When I use 5 paramiters I place the sawmill but it is snow covered on grass???
And I get an error when trying to use 7 paramiters.
How does it know weather I want to use 7 parameters for placing an object with terraine and redraw
or
I want to place an object which functions as object type/subtype but looks like an object type2/subtype2 using 7 parameters?
Obviously it does not, because after the error message it places a red random monster dot where the sawmill should go?
What is the syntax for using this parameter? terrain=-1, redraw=1 and where does it go?
Please help me to understand this command?
Well this is very confusing. The red part especially!I#1/#2/#3/#4/#5...
up to 9 parametres Place an object.
#1 = x
#2 = y
#3 = Level
#4 = Type of object (see Format OB)
#5 = Subtype of object
If you use only 5 parameters you cannot set another terrain type and cancel redraw (terrain=-1, redraw=1)
#6 = Terrain type (see Format TR)
#7 = Redraw needed (1) or not (0)
Additional syntax: You can place an object which functions as object type/subtype but looks like an object type2/subtype2.
If you do so then:
#1 = x
#2 = y
#3 = Level
#4 = Type of object (see Format OB)
#5 = Subtype of object
#6 = Type2 of object to look like (see Format OB)
#7 = Subtype2 of object to look like
If you use only 7 parameters you cannot set another terrain type and cancel redraw (terrain=-1, redraw=1)
#8 = Terrain type (see Format TR)
#9 = Redraw needed (1) or not (0)
When I use 5 paramiters I place the sawmill but it is snow covered on grass???
Code: Select all
!!UN:I39/7/0/53/0; **place lumber mill
Code: Select all
!!UN:I39/7/0/53/0/2/1; **place lumber mill on grass & redraw
or
I want to place an object which functions as object type/subtype but looks like an object type2/subtype2 using 7 parameters?
Obviously it does not, because after the error message it places a red random monster dot where the sawmill should go?
What is the syntax for using this parameter? terrain=-1, redraw=1 and where does it go?
Please help me to understand this command?
Okay, either the ERM Help or the command or both is screwed up and doesn't work the way it says it should with 6 or 7 parameters.
With 5 parameters, it's correct, but as you found out the terrain type doesn't necessarily match and you get odd results like the snow-terrain sawmill.
So here's what you do..you ignore the 5-7 parameter version of UN:I and instead use the 9 parameter version, but the trick is to use the same object type and subtype for both objects. So you place a sawmill that looks like a sawmill and then specify both the terrain type and redraw (as you were trying to do before).
In other words...
If you don't want to specify a terrain type, or if the object is in the object section that doesn't have a terrain type, use -1 for the terrain instead.
With 5 parameters, it's correct, but as you found out the terrain type doesn't necessarily match and you get odd results like the snow-terrain sawmill.
So here's what you do..you ignore the 5-7 parameter version of UN:I and instead use the 9 parameter version, but the trick is to use the same object type and subtype for both objects. So you place a sawmill that looks like a sawmill and then specify both the terrain type and redraw (as you were trying to do before).
In other words...
Code: Select all
!!UN:I39/7/0/53/0/53/0/2/1;
- Fnord
I tried that and it worked.
Now I just need to try the timing thing. I'm not perfectly clear where the extra line you added above fits in?
Thanks
Code: Select all
!!UN:I39/7/0/53/0/53/0/2/1;
Thanks
All told
If I understand where to insert the corrected lines of code, the script now looks like this... ?
Does that look like it will work?
Code: Select all
!#VRv1:S0;
!#VRv2:S0; *** initialize variables (v2=0 for convenience- don't have to have separate check for week 1
!?OBx/y/z; *** Object trigger x/y/z coordinates
!!FU&v1=3:E; *** skip everything if the mill already built
!!VRy1:Sc-1 :7; *** Get current week minus one
!!VRv1&y1=v2:+1;********************** What does this line do???
!!VRv1&y1<>v2/y2<>v2:S1; *** if didn't visit last week or this week, set number of times visited to 1- you're here now
!!VRy2:Sy1+1; *** get current week
******************************Did I add this in the right place??
!!VRv2:Sy1+1; *** v2 now holds the week for visit
!!UN&v2=3:I39/7/0/53/0/53/0/2/1; *** Build log mill looks like log mill on grass & redraw
Try this.
Code: Select all
!#VRv100:S0-1; * Last visit week
!#VRv101:S0; * Number of visits
!$OBx/y/z; *** Object trigger x/y/z coordinates
!!FU&v101=3:E; *** skip everything if the mill already built
!!VRy1:Sc :7; * Current week
!!FU&y1=v100:E; * Exit if already hired at this week
* Part of code to check if the player has baught all the creatures. Remove it if it's enough just to visit the dwelling.
!!DWx/y/z:M0/d/?y2;
!!FU&y2>0:E;
* End of the part of code.
!!VRv101:+1;
!!VRv100:+1;
!!VRv101&v100<y1:S1; *** if didn't visit last week or this week, set number of times visited to 1- you're here now
!!VRv100:Sy1;
!!UN&v101=3:I39/7/0/53/0/53/0/2/1; *** Build log mill looks like log mill on grass & redraw
My patches: MM6 MM7 MM8. MMExtension. Tools. Also, I love Knytt Stories and Knytt Underground. I'm also known as sergroj.
Yes, I tryed that and it seem to work fine. I changed a few of the variables so there was no conflict.
I noticed something else with another script that wasn't there before and there doesn't seem to be anything in conmmon. Perhaps you can advise...
This seems to work fine, except that the trees grow back 2 days after they become passable. If you happen to be in the area beyond the trees you become trapped by new trees.
Any ideas why the trees are comming back?
I noticed something else with another script that wasn't there before and there doesn't seem to be anything in conmmon. Perhaps you can advise...
Code: Select all
ZVSE
*** TIMER *** ---------------------------------------------------
!#TM7:S1/999/1/255; *** Starts day 1, ends day 999, every day, all players
!?TM7; *** Timer Trigger
!!VRv32:Sc0; *** v32 contains current day.
!!VRv17&v32=1:S0; *** If day=1 set v17 to 0
!!VRv18&v32=1:S0; *** if day=1 set v18 to 0
------------------------
!!LE41/15/0&v32=v18:D1/1; ** Disable event after fire.
!!IF&v18=v32:M^************************
The fire is out and the forest is safe.
Perhaps you could invistigate where those wizards were practicing?
************************^;
** text if 6 days after fire started
!!UN&v18=v32:O44/19/0; ** delete enchanter from map
!!UN&v18=v32:O46/19/0; ** delete enchanter from map
!!UN&v18=v32:O44/20/0; ** delete enchanter from map
!!UN&v18=v32:I46/19/0/79/0; ** Place lumber on map
!!UN&v18=v32:I44/20/0/79/0; ** Place lumber on map
--------------------------------
!?LE41/15/0&999; **event trigger
!!VRv17:+1; **add 1 to v17
!!VRv18&v17=5:Sc0; ** set current day into v18 when fire starts
!!IF&v17=5:M^********************
Those silly wizards have let their magic get out of hand.
The forest is on fire.
********************^;
**show text if v17=5
!!UN&v17=5:F43/16/0/44/17; **make trees on fire if v17=5
!!LE41/15/0&v17>4:M^No telling how long that fire will last.^;
!!VRv18&v17=5:Sd+6; ** add 6 to when the fire started
Any ideas why the trees are comming back?
The code doesn't seem to make them passable at all! What should it do exactly?
Anyway, here are the first corrections:
If the human player isn't the first or there can be more than one human player, tell me.
Anyway, here are the first corrections:
Code: Select all
ZVSE
!#VRv17:S0; *** Number of LE visits
!?TM7; *** Timer Trigger. Called only once now.
!!LE41/15/0:D1/1;
!!IF:M^************************
The fire is out and the forest is safe.
Perhaps you could invistigate where those wizards were practicing?
************************^;
** text if 6 days after fire started
!!UN:O44/19/0; ** delete enchanter from map
!!UN:O46/19/0; ** delete enchanter from map
!!UN:O44/20/0; ** delete enchanter from map
!!UN:I46/19/0/79/0; ** Place lumber on map
!!UN:I44/20/0/79/0; ** Place lumber on map
--------------------------------
!?LE41/15/0&999; **event trigger
!!VRv17:+1;
!!IF&v17=5:M^********************
Those silly wizards have let their magic get out of hand.
The forest is on fire.
********************^;
**show text if v17=5
!!UN&v17=5:F43/16/0/44/17; **make trees on fire if v17=5
!!LE41/15/0&v17>4:M^No telling how long that fire will last.^;
!!VRy1:Sd+6;
!!TM7:Sy1/y1/999/1; *** Only one day for the first player.
My patches: MM6 MM7 MM8. MMExtension. Tools. Also, I love Knytt Stories and Knytt Underground. I'm also known as sergroj.
I do not understand???
Can you please tell me what you have done and why?
Is this the complete script or did you want me to add this to my code above?
And if so where do I add it?
My map has only 1 hero on it.
this is what the code should do:
After an event is visited 5 times the fire starts and the text for the event changes.
After the fire goes out the enchanters beyond are removed from the map and replaced with piles of lumber and the event is disabled.
Can you please tell me what you have done and why?
Is this the complete script or did you want me to add this to my code above?
And if so where do I add it?
My map has only 1 hero on it.
this is what the code should do:
After an event is visited 5 times the fire starts and the text for the event changes.
After the fire goes out the enchanters beyond are removed from the map and replaced with piles of lumber and the event is disabled.
The timer is now set up when the count down starts, but not at the game beginning as it was. This simplified the script much.Cavorite wrote: Can you please tell me what you have done and why?
I haven't tasted what I've written.
This is the complete script.Cavorite wrote: Is this the complete script or did you want me to add this to my code above?
That's good.Cavorite wrote: My map has only 1 hero on it.
That's exactly what it did and does now, but you told about trees growing back 2 days after becoming passable.Cavorite wrote: this is what the code should do:
After an event is visited 5 times the fire starts and the text for the event changes.
After the fire goes out the enchanters beyond are removed from the map and replaced with piles of lumber and the event is disabled.
My patches: MM6 MM7 MM8. MMExtension. Tools. Also, I love Knytt Stories and Knytt Underground. I'm also known as sergroj.
Who is online
Users browsing this forum: No registered users and 4 guests