dmdr Posted March 28, 2006 I'm having a little trouble with the Small scripting engine. Basically I want to set up a monster that will exit my map when killed. I've tried to set it up so that it will measure the creature's health every couple of seconds and exit the level when it reaches zero. However, the compiler whinges at me when I attempt to set up an integer using the _ThingGetProperty command (so: static bosshealth = (_ThingGetProperty(69, _THING_HEALTH))) and setting it to a value of 1 or something similar doesn't work properly either (a low value means it exits too soon, a high one makes it not work at all). An attempt to work around the second problem by rechecking the health value every time the script is called hasn't helped either. Can anyone help? This is the full script in it's final form (ie. before I gave up and went to bed): public OnInit() { //_SectorColormap ("BLDMAP", "_cmap_bottom", 7); Incidently, I'm also having trouble with this. I've tried changing the punctuation, capitalisation etc. etc. around but it refuses to work for me (hence why its commented out). Help? _SetCallback("StartupTXT", _SWAIT_DELAY, 35); _SetCallback("Script69", _SWAIT_DELAY, 35); } public Script10() //The Soulsphere Script { static bool:spherei = false; if(!spherei) { _Printf(_MSG_CENTER, "Placeholder script here\a"); spherei = true; } } public Script69() //The exit script (or at least part of it) { //_Printf(_MSG_CENTER, "Placeholder script here\a"); static bosshealth = (_ThingGetProperty(69, _THING_HEALTH)); if (bosshealth < 1) { _SetCallback("EndGame", _SWAIT_DELAY, 350); } bosshealth = (_ThingGetProperty(69, _THING_HEALTH)); _SetCallback("Script69", _SWAIT_DELAY, 35); } public StartupTXT() { _Printf(_MSG_CENTER, "Welcome to \133The Wicked Shall Perish,\n\139 by Lance MDR Rocket.\a"); } public EndGame() { _ExitLevel(); } Thanks in advance, and I'm sorry if this is a fairly noob-like question. I'm afraid my grasp on maths and the maths-like disciplines is fairly shaky. Finally, as a suggestion, would it be possible to update the small_funcref file in the docs .zip to include working examples of each script? I'd really appreciate it. 0 Quote Share this post Link to post
Mordeth Posted March 28, 2006 Lance MDR Rocket said: Finally, as a suggestion, would it be possible to update the small_funcref file in the docs .zip to include working examples of each script? I'd really appreciate it. Seconded! 0 Quote Share this post Link to post
Joe Posted March 28, 2006 Well, the problem here is how you've declared bosshealth. YOu can't give a static variable a value then change it. It stays static, hence the name. To fix it, get rid of the static before bosshealth = (_ThingGetProperty(69, _THING_HEALTH)); and instead stick new bosshealth; at the top, or at the start of Script69. That should do you. I'd also reccomend removing the static before spherei. I only made those changes and it compiled fine for me. Also, I'm pretty sure Quasar told me that the colormap functions were disabled for some gaybar reason. Hope that helps. 0 Quote Share this post Link to post
Quasar Posted March 28, 2006 I am not certain what the problem with the bosshealth assignment is. Could you please post the message that you get from the compiler? It would go miles toward helping me figure out what's going on here. It looks like it should work to me, unless there's no thing with TID 69 for some reason. Do not use _SectorColormap yet -- it is broken and must be reimplemented completely before it's going to work. Sorry about that; I had meant to remove it from the documentation until it was fixed, but forgot to do this before 3.33.02 was released. I encourage users to help with the authoring of tutorials, because it is something I have very little time to do. Joe has written one tutorial which is now posted on the Eternity Engine's page, but we need more. Is anybody willing to do this? 0 Quote Share this post Link to post
myk Posted March 28, 2006 Quasar said: I encourage users to help with the authoring of tutorials, because it is something I have very little time to do. Joe has written one tutorial which is now posted on the Eternity Engine's page, but we need more. Is anybody willing to do this? You might want to shift toward a wiki-style page for Eternity, so that people can more easily contribute in that regard. 0 Quote Share this post Link to post
Quasar Posted March 28, 2006 We have a Wiki too. I'm not discouraging its use in any way :P 0 Quote Share this post Link to post
Bloodshedder Posted March 28, 2006 Behold the unused wiki that nobody seems to know about 0 Quote Share this post Link to post
dmdr Posted March 29, 2006 OK, cheers guys. I'll try changing the 'static' prior to bosshealth to 'new' and see what happens (and the Soulsphere script if necessary, but that compiled fine and seemed to work OK for me) when I get home. Although, I seem to be under the impression that that will break the script if someone loads a save game? Shame about _SectorColormap: is there at least a way to change the colour of the light in a sector? I've got a bit where the player is submerged in blood and it does look a bit silly without that or a similar effect. Also, I'll happily help out with tutorials, or the wiki (which I've never seen before: is there even a link on the Eternity page?), when I suck a bit less. 0 Quote Share this post Link to post
Bloodshedder Posted March 29, 2006 Lance MDR Rocket said:or the wiki (which I've never seen before: is there even a link on the Eternity page?)Quasar doesn't seem to want to link to it until it has some material, but it's not going to get any material unless people know about it. Chicken or the egg. 0 Quote Share this post Link to post
dmdr Posted March 29, 2006 For future reference, the error message I got was the following: map01scr.txt(25) : error 008: must be a constant expression; assumed zero 0 Quote Share this post Link to post
Quasar Posted March 29, 2006 You told me not to link it until I had created an entire framework of subjects, which is something I simply am not capable of doing on my own, so I had refrained for some time. 0 Quote Share this post Link to post
Quasar Posted March 29, 2006 Lance MDR Rocket said:For future reference, the error message I got was the following: map01scr.txt(25) : error 008: must be a constant expression; assumed zero OK. That means that you have an executable statement where only a constant expression (like the number 0) is allowed. Changing bosshealth to static will break your script if you expect the value to persist between calls to the script; variables declared with "new" disappear when the script stops executing. Here's an example that should work: public Script0() { static bosshealth; static bool:firsttime = true; if(firsttime) { bosshealth = _ThingGetProperty(...); firsttime = false; } ... } 0 Quote Share this post Link to post
Bloodshedder Posted March 29, 2006 Quasar said:You told me not to link it until I had created an entire framework of subjects, which is something I simply am not capable of doing on my own, so I had refrained for some time. I don't recall saying that, but if you're not capable of doing it on your own, why not link to it so other people who might want to help can do so? 0 Quote Share this post Link to post
Quasar Posted March 30, 2006 BTW, if the sector you are trying to manipulate is already subject to the effects of a 242 linedef, it's possible to assign it a colormap via that method. Instead of trying to set _cmap_bottom, just set the lower texture name on the 242 linedef to the colormap lump (at least, IIRC, this is how it works). In Eternity, 242 colormaps work more like sector lighting than they did in BOOM, where they refused to work unless you were in the sector itself. While the change breaks compatibility slightly, it is a positive one where the benefits far outweigh the problems. 0 Quote Share this post Link to post
Mordeth Posted April 1, 2006 Quasar said: In Eternity, 242 colormaps work more like sector lighting than they did in BOOM, where they refused to work unless you were in the sector itself. OMFG I didn't know this. Yay for colormaps! 0 Quote Share this post Link to post
Mordeth Posted April 4, 2006 Mordeth said: OMFG I didn't know this. Yay for colormaps! ... And it does not work for portals. SOM..! :) 0 Quote Share this post Link to post
Quasar Posted April 5, 2006 Mordeth, the restrictions on 242 spaces still apply across portals. The player cannot see different vertical partitions of 242 spaces at the same time. If the player is in the "middle" section, as he is when he is in normal space, then he must ONLY be able to view the "normal" space of ALL 242 sectors in the entire map -- the alternative is HOM. Portals cannot violate this. This restriction is inherent to the 242 hack as it was created for BOOM, and cannot be removed as far as I know. Try using the "middle" space of the 242 effect . I'm not sure if it can be assigned a colormap or not. If not, you'll have to wait until general sector colormap assignment works properly. 0 Quote Share this post Link to post
Mordeth Posted April 6, 2006 Quasar said: This restriction is inherent to the 242 hack as it was created for BOOM, and cannot be removed as far as I know. Try using the "middle" space of the 242 effect . I'm not sure if it can be assigned a colormap or not. That is what I was talking about. Middle-space colormaps work right now, so you can have eg. a red-coloured sector somewhere on your map that looks OK from every other sector. Applying a middle-space colormap on a portal sector also colours that portal sector, but it looks normal (without colour) when the portal is viewed from its anchor (in-game) sector. If that worked, it would be extremely cool... especially with linked portals in place. For example: fog effects on the ground only, or a green glow just above nukage pools. God I love this engine ;) 0 Quote Share this post Link to post
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.