Attributes Question - Visibility System
Bissrok
30 May 2015, 17:07I just downloaded the program for Windows yesterday, and I have been playing around, but can't get a particular system to work.
I'm trying to put a "Visibility" attribute in the game. Your current Visibility score would always be displayed on the screen, and it is affected by the equipment you're carrying and certain events.
To the player object, I added a "visibility" attribute (integer) of value 0. I added a "visibility" status attribute with a blank value.
To a weapon object (called "weapon"), I gave a "visibility" attribute. For the value, I wrote a script:
The intention was to make it so that, if the player is carrying the object, their visibility would go up by 2. If they're not carrying it, it does not affect their visibility.
But, when I run the game, whether or not they're carrying the object "weapon," I only see "Visibility: " on the main screen. I assume I at least did something wrong on the player settings, but I am not sure what. Could anyone tell me what I did wrong?
I'm trying to put a "Visibility" attribute in the game. Your current Visibility score would always be displayed on the screen, and it is affected by the equipment you're carrying and certain events.
To the player object, I added a "visibility" attribute (integer) of value 0. I added a "visibility" status attribute with a blank value.
To a weapon object (called "weapon"), I gave a "visibility" attribute. For the value, I wrote a script:
if (Got(weapon)) {
player.visibility = player.visibility +2
}
else {
player.visibility = player.visibility +0
}
The intention was to make it so that, if the player is carrying the object, their visibility would go up by 2. If they're not carrying it, it does not affect their visibility.
But, when I run the game, whether or not they're carrying the object "weapon," I only see "Visibility: " on the main screen. I assume I at least did something wrong on the player settings, but I am not sure what. Could anyone tell me what I did wrong?
The Pixie
30 May 2015, 21:35Sounds like two different issues. The first is that you should see "Visibility: 0". I am not sure, but that could be because of capitalisation. Quest is looking for "Visibility", but you have put in "visibility". Try deleting it from the statis attributes, and putting in "visibility" and "Visibility: !" (the exclamation mark tells Quest to put the value there).
The second issue is that your if/else may never get triggered. Where is the script? I would put it in the take and drop scripts. When you take a weapon, visiubility goes up two, when you drop it, it goes down two.
This probably has not answered your question, but hopefully has set you in the right direction. If it is still not working, it might be a good idea to paste in your game code.
The second issue is that your if/else may never get triggered. Where is the script? I would put it in the take and drop scripts. When you take a weapon, visiubility goes up two, when you drop it, it goes down two.
This probably has not answered your question, but hopefully has set you in the right direction. If it is still not working, it might be a good idea to paste in your game code.
HegemonKhan
30 May 2015, 21:45your 'if' Script should be put into a global Turnscript, instead of as an added~created~set'ted Script Attribute for your 'weapon' Object.
The problem is that your 'if' Script is not firing~activating~executing~running constantly. An Object's Script Attribute requires that you have to manually~force it to activate, such as if you created it in the GUI~Editor, as an added Verb, then during game play, the person would click on the Object's Verb's button or its hypertext link to activate it, or you'd have to have actual code lines that~to~will activate~call it.
A global Turnscript (if its 'enabled' Boolean Attribute checkbox in the GUI~Editor is checked) is constantly activating, which is what you want.
to create~add a global Turnscript:
click on the upper-left most 'object' in the left side's 'tree of stuff', so that it is highlighted, as this ensures that the Turnscript will be a global Turnscript.
now at the top of the screen, under the 'add' in the menu bar (I don't know why 'Turnscript' is not in the 'tree of stuff', as Timer is there, which is the same as a Turnscript, except it uses real time seconds, instead of the quest engine's underlying 'turn' internal coding), choose 'Turnscript'.
give the Turnscript a name, check in its 'enabled' Boolean Attribute checkbox (this causes it to be always activating from the moment the game begins), then add in your Scripts.
-------
about your script block...
1. 'player.visibility = player.visibility + 2' will cause it to be constantly raising~increasing your 'visibility' by +2... which I don't think you want..., right?
do you want a 'event flag state' system ???, which is this conceptually:
player.visibility = 0 ---> 'whatever' is not visible
player.visibility = 1 ---> 'whatever' is opaque (half-visible)
player.visibility = 2 ---> 'whatever' is (fully) visible
which you would jsut use this instead:
~ OR ~
do you want to do a '0-100' system, of gradual more visibility layers of the 'whatever' :
( this would use the 'player.visibility=player.visibility+2' )
( and I think this is self-explanatory, hopefully )
2. if you want to do the '0-100' system, then you don't want this code~script line~block:
as there's no reason for it. You'd just want this for your full script block:
unless you need to change between '0' and '2', then you'd need this:
--------------
and (well, Pixie, already beat me to it), are you seeing the 'visibility' displaying '0' or '2' during the game?
The problem is that your 'if' Script is not firing~activating~executing~running constantly. An Object's Script Attribute requires that you have to manually~force it to activate, such as if you created it in the GUI~Editor, as an added Verb, then during game play, the person would click on the Object's Verb's button or its hypertext link to activate it, or you'd have to have actual code lines that~to~will activate~call it.
A global Turnscript (if its 'enabled' Boolean Attribute checkbox in the GUI~Editor is checked) is constantly activating, which is what you want.
to create~add a global Turnscript:
click on the upper-left most 'object' in the left side's 'tree of stuff', so that it is highlighted, as this ensures that the Turnscript will be a global Turnscript.
now at the top of the screen, under the 'add' in the menu bar (I don't know why 'Turnscript' is not in the 'tree of stuff', as Timer is there, which is the same as a Turnscript, except it uses real time seconds, instead of the quest engine's underlying 'turn' internal coding), choose 'Turnscript'.
give the Turnscript a name, check in its 'enabled' Boolean Attribute checkbox (this causes it to be always activating from the moment the game begins), then add in your Scripts.
-------
about your script block...
if (Got(weapon)) {
player.visibility = player.visibility +2
}
else {
player.visibility = player.visibility +0
}
1. 'player.visibility = player.visibility + 2' will cause it to be constantly raising~increasing your 'visibility' by +2... which I don't think you want..., right?
do you want a 'event flag state' system ???, which is this conceptually:
player.visibility = 0 ---> 'whatever' is not visible
player.visibility = 1 ---> 'whatever' is opaque (half-visible)
player.visibility = 2 ---> 'whatever' is (fully) visible
which you would jsut use this instead:
if (Got(weapon)) {
player.visibility = 2
}
else {
player.visibility = 0
}
~ OR ~
do you want to do a '0-100' system, of gradual more visibility layers of the 'whatever' :
( this would use the 'player.visibility=player.visibility+2' )
( and I think this is self-explanatory, hopefully )
2. if you want to do the '0-100' system, then you don't want this code~script line~block:
else {
player.visibility = player.visibility +0
}
as there's no reason for it. You'd just want this for your full script block:
if (Got(weapon)) {
player.visibility = 2
}
unless you need to change between '0' and '2', then you'd need this:
if (Got(weapon)) {
player.visibility = 2
} else {
player.visibility = 0
}
--------------
and (well, Pixie, already beat me to it), are you seeing the 'visibility' displaying '0' or '2' during the game?
The Pixie
30 May 2015, 22:20HegemonKhan wrote:your 'if' Script should be put into a global Turnscript, instead of as an added~created~set'ted Script Attribute for your 'weapon' Object.
I was thinking that myself at first, but if you do that the visibility will increase by 2 every turn, which is not what you want (I think).
Bissrok
31 May 2015, 03:28Thank you both. It is working and displaying perfectly now.
My experience with programming is half a book of Python for Kids, so I am glad to know help is out there!
My experience with programming is half a book of Python for Kids, so I am glad to know help is out there!
HegemonKhan
31 May 2015, 17:48laughs, I'm still going through the python lesson on codecademy, about 75% through it, forgot what section I'm on is called though, maybe the 'classes' section.
Quest's XML+FLEE is very noobie-friendly, it's how I learned to code, and now am moving onto learning python on codecademy thanks to quest, laughs.
Quest's XML+FLEE is very noobie-friendly, it's how I learned to code, and now am moving onto learning python on codecademy thanks to quest, laughs.
Bissrok
31 May 2015, 22:42I have a related question, if you guys don't mind.
I want it so that, if you fire a gun, your Visibility attribute is increased by 7 one time, and it will be removed once you leave the room.
-I gave the player a Boolean attribute called "gunfired," which starts as False.
-I made a turn script that is enabled at the start of the game which says:
When I run it in the game, it runs twice, then stops. I only want it to run once. In the GUI, it reads "After 1 turns..." I tried setting this to zero, but I saw the same thing. Runs twice, stops.
I get the feeling that I am using SetTurnTimeout incorrectly. Does anyone know how I might use it properly?
EDIT: Nevermind! I found a workaround. I now it have it so that, when you use the verb Shoot on the object, "gunfired" goes to true and you get +7 visibility. Then, when you enter the next map, if "gunfired" is True, it drops visibility by 7 and changes "gunfired" to False.
I want it so that, if you fire a gun, your Visibility attribute is increased by 7 one time, and it will be removed once you leave the room.
-I gave the player a Boolean attribute called "gunfired," which starts as False.
-I made a turn script that is enabled at the start of the game which says:
if (player.gunfired = True) {
player.visibility = player.visibility + 7
SetTurnTimeout (1) {
player.gunfired = False
}
}
When I run it in the game, it runs twice, then stops. I only want it to run once. In the GUI, it reads "After 1 turns..." I tried setting this to zero, but I saw the same thing. Runs twice, stops.
I get the feeling that I am using SetTurnTimeout incorrectly. Does anyone know how I might use it properly?
EDIT: Nevermind! I found a workaround. I now it have it so that, when you use the verb Shoot on the object, "gunfired" goes to true and you get +7 visibility. Then, when you enter the next map, if "gunfired" is True, it drops visibility by 7 and changes "gunfired" to False.