AwesomeJRFD wrote:Poison Effect & Cure(I thought I posted this here before, but it may have gotten removed for some reason)
- Place 4 triggers around the player that each move all 4 with the player (You can use my player coordinates detector for that)
- Modify those triggers to also move the spikes item which has a separate tag than the 4 triggers ("poisonspikes" for example), and is about 256 Item Coordinates above the player's start position:
- Code: Select all
llitem:0;144;1504;1;0;0|6:player;-112;1504;512;256;1;1;move,player,0,32,0,0:move,poisonspikes,0,32,0,0:add,g_playerY,g_playerY,32|6;110;1444;64;64;0;1;set,g_playerX,144:set,g_playerY,1504|6:player;-128;1232;256;512;1;1;move,player,-32,0,0,0:move,poisonspikes,-32,0,0,0:sub,g_playerX,g_playerX,32:set,g_F,0|6:player;-112;1216;512;256;1;1;move,player,0,-32,0,0:move,poisonspikes,0,-32,0,0:sub,g_playerY,g_playerY,32|6:player;160;1232;256;512;1;1;move,player,32,0,0,0:move,poisonspikes,32,0,0,0:add,g_playerX,g_playerX,32:set,g_F,1
The spikes item should follow the player just outside of the camera's view, assuming you haven't zoomed out or changed the camera in any way. - When you want to move the spikes item to the player, have the following code in the level and use Activate: "poison":
- Code: Select all
llitem:6:poison;736;1600;16;16;0;1;branch,5,2,g_poisoned,0:exit:move,poisonspikes,0,512,0,0:set,g_poisoned,1
- When you want to move the spikes item away from the player, have the following code in the level and use Activate: "cure":
- Code: Select all
llitem:6:cure;752;1600;16;16;0;1;branch,5,2,g_poisoned,1:exit:move,poisonspikes,0,-512,0,0:set,g_poisoned,0
- As you can see, I also included a boolean variable check (g_poisoned) to make sure that "poison" or "cure" aren't activated twice in a row, which would cause the spikes to move too far above or below the player.
Proof of concept level using the codes I provided above (I left the spikes visible so you can see what happens):
- Code: Select all
150x50~.7050aa34amaa149amaa149amaa115~~~~0;144;1504;1;0;0~6:mushroom;536;1472;48;32;0;1;playsound,55:activate,poison:sleep,150:activate,cure:sleep,30:turnon,this|6:player;-112;1504;512;256;1;1;move,player,0,32,0,0:move,poisonspikes,0,32,0,0:add,g_playerY,g_playerY,32|6;112;1440;64;64;0;1;set,g_playerX,144:set,g_playerY,1504|6:player;-128;1232;256;512;1;1;move,player,-32,0,0,0:move,poisonspikes,-32,0,0,0:sub,g_playerX,g_playerX,32:set,g_F,0|6:player;-112;1216;512;256;1;1;move,player,0,-32,0,0:move,poisonspikes,0,-32,0,0:sub,g_playerY,g_playerY,32|6:player;160;1232;256;512;1;1;move,player,32,0,0,0:move,poisonspikes,32,0,0,0:add,g_playerX,g_playerX,32:set,g_F,1|272:poisonspikes;144;992;2;2;0;;0|165:mushroom;560;1504;1;1;0;400,100,50;0|90;272;1504;-1;1;0;;0;4;0;camera,1,0,0,0,mushroom,0,0,10:dialog,1,Be%20careful%21%20Touch%20a%20poison%20mushroom%20and%20you%20will%20be%20poisoned%20for%205%20seconds%21:camera,1,0,0,0,tree,0,0,10:dialog,1,Touch%20a%20tree%20to%20cure%20yourself%20if%20you%20get%20poisoned.:cameraoff;0|133:tree;816;1504;1;1;0;;0|6:tree;792;1408;48;96;0;1;playsound,47:stoptrigger,mushroom:activate,cure:invis_wait:turnon,this:turnon,mushroom|6:poison;0;1600;16;16;0;1;branch,5,2,g_poisoned,0:exit:move,poisonspikes,0,512,0,0:set,g_poisoned,1|6:cure;16;1600;16;16;0;1;branch,5,2,g_poisoned,1:exit:move,poisonspikes,0,-512,0,0:set,g_poisoned,0|2;1104;1504~Poison%20proof%20of%20concept~AwesomeJRFD~3~4;0;0~1~1;0~0;0;3~1378948444~0.4
This indeed works the way it should,
however, I found that something needs to be changed when going through transitions and back while the poison is still running, but I fail to figure out what it is exactly, like EXACTLY.
I'm using a "slowed down" poison so that the player doesn't get killed too quickly. After 180 frames, the "poison" trigger is activated for 60 frames before activating the "cure" trigger, and it repeats after 120 more frames to go back to activating the "poison" trigger again. Basically, the problem is that whenever I try to fix it so that the spikes go back up (or down?) when they're supposed to (with that boolean variable check) after returning to the transition it started in, they either hurt the player before going back up or they will somehow fail to pass the boolean variable check and I don't know why so. Strangely, it may even work correctly at random. It think it depends
on whether it is running the cure or the poison that it will break trying to fix it with other trigger hitboxes, after leaving and coming back through a transition. I really don't know for sure, though; it seems mixed.
AKA:
I need to know how to fix it so that the spikes NEVER go too far down or up when passing transitions and coming back. Also how to make sure the player doesn't get hurt just as they return through the transition, before the spikes go back up (or down?); it seems random.
I'm looking for trigger hitboxes that go right next to mandatory transitions ON BOTH SIDES, but I can't seem to find an arrangement of functions that prevents the cure and/or poison from working improperly. Like every time.Really AKA: I need to know how before I can continue working on the level that needs the fix.
EDIT: Moved post here to make it easier to find.
Plus, I
highlighted the most important parts of this post, and the especially important parts are
highlighted differently. Just to make it easier to understand.
EDIT2: I forgot to mention that I'm using JSlayerXero's Alternate Player Coordinates Detection. His poison demonstration version:
JSlayerXero wrote:Alternate Player Coordinates DetectionThis is an alternative to JRFD's
Player Coordinates Detector. Instead of the hitboxes being huge and detecting in full blocks, these move 8 pixels at a time, and are set up so that the player will collide with more if it's moving quickly. There is a speed limit I'm not quite aware of though. It does involve significantly more triggers, which can be a bit annoying if you're trying to manually combine it with the poison affect JRFD posted since you'll need to alter/add or remove several move triggers. There might be some other slight differences I'm not quite aware of yet.
These are the raw items, not programmed to work with poison. Springboard button was added to test how fast you can move without breaking this. Feel free to experiment yourself.
- Code: Select all
llitem:6:player;64;1504;160;80;1;1;move,player,0,8,0,0:add,g_playerY,g_playerY,8|6:player;48;1408;80;160;1;1;move,player,-8,0,0,0:sub,g_playerX,g_playerX,8:set,g_F,0|6:player;64;1392;160;80;1;1;move,player,0,-8,0,0:sub,g_playerY,g_playerY,8|6:player;160;1408;80;160;1;1;move,player,8,0,0,0:add,g_playerX,g_playerX,8:set,g_F,1|6:player;48;1408;72;160;1;1;move,player,-8,0,0,0:sub,g_playerX,g_playerX,8:set,g_F,0|6:player;48;1408;64;160;1;1;move,player,-8,0,0,0:sub,g_playerX,g_playerX,8:set,g_F,0|6:player;48;1408;56;160;1;1;move,player,-8,0,0,0:sub,g_playerX,g_playerX,8:set,g_F,0|6:player;48;1408;48;160;1;1;move,player,-8,0,0,0:sub,g_playerX,g_playerX,8:set,g_F,0|6:player;168;1408;72;160;1;1;move,player,8,0,0,0:add,g_playerX,g_playerX,8:set,g_F,1|6:player;176;1408;64;160;1;1;move,player,8,0,0,0:add,g_playerX,g_playerX,8:set,g_F,1|6:player;184;1408;56;160;1;1;move,player,8,0,0,0:add,g_playerX,g_playerX,8:set,g_F,1|6:player;192;1408;48;160;1;1;move,player,8,0,0,0:add,g_playerX,g_playerX,8:set,g_F,1|6:player;64;1392;160;72;1;1;move,player,0,-8,0,0:sub,g_playerY,g_playerY,8|6:player;64;1392;160;64;1;1;move,player,0,-8,0,0:sub,g_playerY,g_playerY,8|6:player;64;1392;160;56;1;1;move,player,0,-8,0,0:sub,g_playerY,g_playerY,8|6:player;64;1392;160;48;1;1;move,player,0,-8,0,0:sub,g_playerY,g_playerY,8|6:player;64;1512;160;72;1;1;move,player,0,8,0,0:add,g_playerY,g_playerY,8|6:player;64;1520;160;64;1;1;move,player,0,8,0,0:add,g_playerY,g_playerY,8|6:player;64;1528;160;56;1;1;move,player,0,8,0,0:add,g_playerY,g_playerY,8|6:player;64;1536;160;48;1;1;move,player,0,8,0,0:add,g_playerY,g_playerY,8
Here is an alteration to JRFD's poison demonstration level. Spikes are still visible for demonstration.
- Code: Select all
39x50~.1833aa34amaa38amaa38amaa4~~~~0;144;1504;1;0;0~6:mushroom;536;1472;48;32;0;1;playsound,55:activate,poison:sleep,300:activate,cure:sleep,30:turnon,this|6:player;64;1504;160;80;1;1;move,player,0,8,0,0:move,poisonspikes,0,8,0,0:add,g_playerY,g_playerY,8|6;112;1440;64;64;0;1;set,g_playerX,144:set,g_playerY,1504|6:player;48;1408;80;160;1;1;move,player,-8,0,0,0:move,poisonspikes,-8,0,0,0:sub,g_playerX,g_playerX,8:set,g_F,0|6:player;64;1392;160;80;1;1;move,player,0,-8,0,0:move,poisonspikes,0,-8,0,0:sub,g_playerY,g_playerY,8|6:player;160;1408;80;160;1;1;move,player,8,0,0,0:move,poisonspikes,8,0,0,0:add,g_playerX,g_playerX,8:set,g_F,1|272:poisonspikes;144;992;2;2;0;;0|165:mushroom;560;1504;1;1;0;400,100,50;0|90;272;1504;-1;1;0;;0;4;0;camera,1,0,0,0,mushroom,0,0,10:dialog,1,Be%20careful%21%20Touch%20a%20poison%20mushroom%20and%20you%20will%20be%20poisoned%20for%205%20seconds%21:camera,1,0,0,0,tree,0,0,10:dialog,1,Touch%20a%20tree%20to%20cure%20yourself%20if%20you%20get%20poisoned.:cameraoff;0|133:tree;816;1504;1;1;0;;0|6:tree;792;1408;48;96;0;1;playsound,47:stoptrigger,mushroom:activate,cure:invis_wait:turnon,this:turnon,mushroom|6:poison;0;1600;16;16;0;1;branch,5,2,g_poisoned,0:exit:move,poisonspikes,0,512,0,0:set,g_poisoned,1|6:cure;16;1600;16;16;0;1;branch,5,2,g_poisoned,1:exit:move,poisonspikes,0,-512,0,0:set,g_poisoned,0|2;1104;1504|6:player;168;1408;72;160;1;1;move,player,8,0,0,0:move,poisonspikes,8,0,0,0:add,g_playerX,g_playerX,8:set,g_F,1|6:player;176;1408;64;160;1;1;move,player,8,0,0,0:move,poisonspikes,8,0,0,0:add,g_playerX,g_playerX,8:set,g_F,1|6:player;184;1408;56;160;1;1;move,player,8,0,0,0:move,poisonspikes,8,0,0,0:add,g_playerX,g_playerX,8:set,g_F,1|6:player;192;1408;48;160;1;1;move,player,8,0,0,0:move,poisonspikes,8,0,0,0:add,g_playerX,g_playerX,8:set,g_F,1|6:player;48;1408;72;160;1;1;move,player,-8,0,0,0:move,poisonspikes,-8,0,0,0:sub,g_playerX,g_playerX,8:set,g_F,0|6:player;48;1408;64;160;1;1;move,player,-8,0,0,0:move,poisonspikes,-8,0,0,0:sub,g_playerX,g_playerX,8:set,g_F,0|6:player;48;1408;56;160;1;1;move,player,-8,0,0,0:move,poisonspikes,-8,0,0,0:sub,g_playerX,g_playerX,8:set,g_F,0|6:player;48;1408;48;160;1;1;move,player,-8,0,0,0:move,poisonspikes,-8,0,0,0:sub,g_playerX,g_playerX,8:set,g_F,0|6:player;64;1392;160;72;1;1;move,player,0,-8,0,0:move,poisonspikes,0,-8,0,0:sub,g_playerY,g_playerY,8|6:player;64;1392;160;64;1;1;move,player,0,-8,0,0:move,poisonspikes,0,-8,0,0:sub,g_playerY,g_playerY,8|6:player;64;1392;160;56;1;1;move,player,0,-8,0,0:move,poisonspikes,0,-8,0,0:sub,g_playerY,g_playerY,8|6:player;64;1392;160;48;1;1;move,player,0,-8,0,0:move,poisonspikes,0,-8,0,0:sub,g_playerY,g_playerY,8|6:player;64;1512;160;72;1;1;move,player,0,8,0,0:move,poisonspikes,0,8,0,0:add,g_playerY,g_playerY,8|6:player;64;1520;160;64;1;1;move,player,0,8,0,0:move,poisonspikes,0,8,0,0:add,g_playerY,g_playerY,8|6:player;64;1528;160;56;1;1;move,player,0,8,0,0:move,poisonspikes,0,8,0,0:add,g_playerY,g_playerY,8|6:player;64;1536;160;48;1;1;move,player,0,8,0,0:move,poisonspikes,0,8,0,0:add,g_playerY,g_playerY,8|5;632;1504;0;1;0;movechar,this,0,0,0,-32,1,0:sleep,1:turnon,this~Poison%20proof%20of%20concept~AwesomeJRFD~3~4;0;0~1~1;0~0;0;3~1385498775~0.4
EDIT3: Argh.
I forgot something important.NOTE: If I end up solving this by accident somehow, please still answer.EDIT4: Okay. New question.
Is it really impossible to use the Player Coordinates Detection across level splitters? If so, then the level I'm working on will be ruined. : (
EDIT5: Thankfully (and what a relief...), I found a workaround (AKA: using doors to go through transitions, then to be sent directly to another set of Player Coordinates Detection triggers). I dunno... I guess somebody could still provide answers to this or whatever, but nonetheless figured out how to work my level out.