realityfactoryusr wrote:SetEventState (dropkey, true); --> Wherever I put this line, the script doesnt read past it. At this point, the NPC collision is still on, its animation keeps going, it doesnt fade out and is not removed.
You need quotes around dropkey and DIE. If the command requires a string value then use quotes:
Code: Select all
SetEventState ("dropkey", true);
SetNoCollision();
AnimateStop("DIE", DIEHOLD, "");
FadeOut(DIEFADE, 0);
Remove(true);
realityfactoryusr wrote:Is there anyway to make a level end AFTER completing a task? Say clearing a room down to the last enemy?
Or even better, after boss is defeated, the level simply ends, bypassing the whole "collect a key" problem.
Create a trigger entity that when activated will change the level. For this example I will call it LevelChangeTrigger. Add that trigger to the TriggerChange field of the ChangeLevel entity.
Then create a player attribute that keeps track of the number of enemies. For this example I'm going to use the attribute EnemyNumber. Set EnemyNumber to 0 in the player.ini.
Code: Select all
[EnemyNumber]
initial = 0
low = 0
high = 99999
In each enemy spawn order add 1 to EnemyNumber:
Code: Select all
Spawn[()
{
ModifyAttribute("EnemyNumber", 1, "Player");
In each enemy death order subtract 1 from EnemyNumber and check if EnemyNumber is 0, if it is then set ChangeLevel state to true:
Code: Select all
Death[()
{
ModifyAttribute("EnemyNumber", -1, "Player");
if (GetAttribute("EnemyNumber","Player") = 0)
{
SetEventState("ChangeLevel", true);
}
For a boss enemy you can leave out the EnemyNumber attribute code and just call the SetEventState("ChangeLevel", true) code in the death order of a boss.
realityfactoryusr wrote:Making a health bar appear over an enemies head?
I guess you can use the CheckArea() command to see if the enemy is visible on the screen and use a combination of the GetDistanceTo(), GetEntityScreenX(), GetEntityScreenY() commands to determine where to draw the health bar.
You can make a flipbook with 100 images which represent each percentage of health. Then use the DrawFlipBookImage() command to display the flipbook image. Or maybe use the FillScreenArea() command and calculate the correct size of rectangle to draw.
realityfactoryusr wrote:Doors that ONLY open when player has the key for them?
Place a trigger on the door and when you get the key set the trigger to true. If the door's bNoCollide field is false then the door won't open until you collide with it. You won't be able to open the door unless the trigger is true.
Note: I never tried any of this but it should work.