Skulltag Archive

Hosted by Dark-Assassin

The default theme was not avalible in the backup, sorry.
View unanswered posts | View active topics It is currently Fri Jul 23, 2021 9:51 pm



Reply to topic  [ 12 posts ] 
AndrewSauce's How To: HEALING SECTOR 
Author Message

Joined: Wed Dec 31, 1969 6:00 pm
Posts: 105
Location: Michigan
Reply with quote


While I may not be the greatest and smartest mapper out there, I have attained quite a wealth of knowledge about some odds and ends that can really enhance the feel of a map! In this tutorial, you're going to learn how to create an easy-to-make healing sector!

No, not the preset shitty one that comes built into the ST config that heals you 1 HP per second. I'm talking about an easily configurable one that is easy to set up and only requires 10 lines of code! So, without further ado... Here we go! (Pics will be uploaded if requested to aid in the execution of this tutorial.)

Step 1: Create the sector you wish to designate as the sector as the "healing" sector.
This is as simple as creating a 64x64 box. Just create the sector that you want the player to heal in. No sector tag required here!

Step 2: Place the "Actor Enters Sector" and "Actor Leaves Sector" things inside of the tagged sector.
These "things" are located under the "Sector Actions" subcategory in the "Things" menu. Simply place one of each inside of the tagged sector that you wish for the player to heal in.

Step 3: Open up the Script Editor and use the following code
Simple as that. Pull open the script editor and copy/paste the following code into your Script Box:



Step 4: Set Action Specials to activate/terminate the script
Remember those "Actor Enters Sector" and "Actor Exits Sector" things that we placed a while ago? Well, now it's time to put them to use! Right click on the "Actor Enters Sector" thing, and go to the "Action" tab. Then, in the area labeled "Action", type in 80. The action that appears should be "Script Execute". Simply type in 1 for the script number argument, and you're all set! (This is not always the case; Enter the script number that you're using for the healing script!) Now whenever you enter the sector, it will activate the script!

Now, right click on the "Actor Leaves Sector", and repeat the process defined above. However, instead of entering 80 for the action, enter 82. The action that appears should be, "Script Terminate". Enter 1 in the script number argument, and you will be all set! (Again, this is not always the case; Enter the script number that you're using for the healing script!)This is so that when you leave the sector, it cancels the healing script so that it doesn't continue to take effect after you leave!



Hopefully this is useful for any aspiring mappers out there! If anyone notices any mistakes, typos, or perhaps even more efficient ways to go about this, please let me know! This is a tutorial after all, and it's here to help people learn and achieve what they couldn't before! Thanks for reading! Happy mapping everyone!

EDIT: No problem, I was going to change them back to normal anyways. I had to leave right after I posted this though so it didn't get done.


Last edited by -=Dark-Assassin=- on Fri Jul 22, 2011 8:56 pm, edited 1 time in total.

Removed Colors. Sorry, they were too hard to read.



Fri Jul 22, 2011 8:43 pm
Profile

Joined: Wed Dec 31, 1969 6:00 pm
Posts: 461
Location: Rus
Reply with quote
The only problem that it still adds only a single hp per set amount of time. Setting 0 will result in a runaway script, and setting 1 will result in 35 hp per second. For you that might be enough, but for me who tends to lose a good 130 hp per second this isn't great. Ecpesially if the mapper made player have a 1000 hp (well, sometimes happens). Of course, we can easily increase the amount of health to heal but the script will still think that per each amount of time we heal only a single health point. And why messing with a variable if we can just do WHILE(GetActorProperty(0, APROP_HEALTH)<100)? I don't have ACC in my possession now, but I think it should work perfectly. This will allow us to heal the player with ANY number per amount of time.
Otherwise, great script, great tut. GJ


Fri Jul 22, 2011 11:47 pm
Profile ICQ

Joined: Wed Dec 31, 1969 6:00 pm
Posts: 105
Location: Michigan
Reply with quote
Alright, I understand what you're saying Hexa. This would remedy the problem you're bringing up.

Let's say that you wanted to regain about ~130 health/second, right? Well, all you would have to do is make the following changes to the code to make this work.



Also, it didn't really occur to me to just stick GetActorProperty inside of the loop. I think I tried it once before, but it didn't work for some reason. Probably due to my own mistakes lol. But the variable that is created in the script is useful because then you can do what I did above, which is increase "stop" by a number greater than 1 so that we can handle situations such as these.

I guess your proposition would negate the necessity for that as well, but with the variable in there it allows for greater flexibility. What if someone wanted to change the rate of growth to be something different than the amount of health regained? I mean hey, you never know! Better to be over-prepared than under-prepared, right?


Sat Jul 23, 2011 1:51 am
Profile

Joined: Wed Dec 31, 1969 6:00 pm
Posts: 461
Location: Rus
Reply with quote


Sat Jul 23, 2011 2:27 am
Profile ICQ

Joined: Wed Dec 31, 1969 6:00 pm
Posts: 105
Location: Michigan
Reply with quote
Aha! I've got it! This should work, even if you do get hurt while inside of the healing sector.



This way, "stop" updates itself real-time as the script progresses, giving it more reliability.

As for making the sector heal you while you're in it, even after the script supposedly "terminates", I think I've also found a solution. Instead of using the thing "Actor Enters Sector", I've decided to use "Actor Hits Floor". For MOST instances this should work perfectly. I can imagine a few scenarios where it wouldn't, but all that it would require is a little more configuration!


Sat Jul 23, 2011 9:45 am
Profile

Joined: Wed Dec 31, 1969 6:00 pm
Posts: 698
Location: powernoob
Reply with quote


Mon Jul 25, 2011 6:26 am
Profile
Competition Moderator

Joined: Wed Dec 31, 1969 6:00 pm
Posts: 472
Location: New Zealand
Reply with quote


Mon Jul 25, 2011 7:56 am
Profile

Joined: Wed Dec 31, 1969 6:00 pm
Posts: 698
Location: powernoob
Reply with quote


Mon Jul 25, 2011 6:25 pm
Profile

Joined: Wed Dec 31, 1969 6:00 pm
Posts: 105
Location: Michigan
Reply with quote
Heh, your guys' scripts seem to be much more elegantly written than my own.

Mine was simply an attempt at creating an easy-to-configure healing script that newer players could use with only 10 lines of code. (I've noticed that a lot of newer mappers get intimidated by more than 10 lines of code as it is lol.) TheMisterCat wrote his script with only 10 lines of code as well, but yours is well over that Ijon. Not that it's any less valuable, of course! Just well over 10.

Also Ijon, in cases like this, why wouldn't you suggest ever using Script Terminate? I mean it's there to be used isn't it?


Tue Jul 26, 2011 12:07 am
Profile

Joined: Wed Dec 31, 1969 6:00 pm
Posts: 698
Location: powernoob
Reply with quote
Terminating something without really giving it a say in the matter really feels inelegant and wrong to me. Building in the exit methods yourself guarantees that any cleanup code that must be run will be run, and gives people an interface to use.

Also, 'goto' exists to be used by your argument, but no serious programmer would suggest its use (and indeed, in most high-level languages, it doesn't exist). Just because it's there doesn't mean it's the right way.


Tue Jul 26, 2011 5:31 am
Profile

Joined: Wed Dec 31, 1969 6:00 pm
Posts: 105
Location: Michigan
Reply with quote
Hm... All of these are very valid points. I shall utilize them in my pursuits of coding and tutorials from here on out!

As you have probably guessed, I'm still fairly new to programming and coding lol. While I've taken Java/VB classes in high school, and am going to be getting my minor in CS, I'm still fairly new to this stuff so bear with me! I've already learned a few things from your guys' scripts! :)


Tue Jul 26, 2011 11:56 am
Profile

Joined: Wed Dec 31, 1969 6:00 pm
Posts: 8
Location: Cornwall, United Kingdom
Reply with quote
Wonderful, just what I needed for a simple healing sector.

I have made a demo healing WAD, credits go to the script master. Well done!


Fri Feb 17, 2012 5:57 pm
Profile WWW
Display posts from previous:  Sort by  
Reply to topic   [ 12 posts ] 

Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group
Designed by ST Software.