Setting up an entity commands for scene

DJGameFreakTheIguana

Active member


Ok, if you guys peep the screenshot, I want to recreate the scene from Sonic one where Dr. Robotnik presses a button to break the platform and send you down to the next act, the shot there is basically a mock up so I have my coards straight. For this, I'd need to know how to have one entity command another, and I think I can do this in 2 ways.

1. Assuming I don't need the platform to be spawned by another entity, I can just have Robotnik press a button and command it to explode when it happens.

2. If the platform does need to be spawned by another entity, I can make an invisible one that will do it through it's spawn animation, and once you reach a certain point of the stage and within range for it's attack animation, it will Spawn Robotnik's screen where he pushes the button, and time the animations right so when the button is pressed, the commanding entity will then make the platform explode.

This is a bit extra but might as well ask while I'm making this topic, I can make the platform end the level during it's exploding animation so I don't have to force the player to fall, but just in case, can I make the platform force the player into an animation where they seemingly fall down? Maybe make them spawn another entity with the needed animation as the real players are made invisible and unable to do anything until the stage is forced to end?

x)
 
I suggest doing it with straight way aka:

1. Assuming I don't need the platform to be spawned by another entity, I can just have Robotnik press a button and command it to explode when it happens.

You can have the platform like this:
Code:
anim	idle
@script
    void self = getlocalvar("self");
    int Code = getentityproperty(self,"mp");
    int Status = getindexedvar(Code);
      
    if(Status==1){
      performattack(self, openborconstant("ANI_FOLLOW1"));
    }
@end_script
	loop	1
   	delay	2
	offset	50 20
	bbox	0 0 100 20
	platform 50 20 -65 -65 65 65 20 20
	frame	data/bgs/pabrik/lift1.png
	frame	data/bgs/pabrik/lift1.png

This platform will change to FOLLOW1 animation when certain indexed variable, matches with its MP is set to 1
Oh yes, I usually use MP to define switching code for platforms/traps in my mods, like this:

spawn PLift1
mp 2
coords 400 500 210
at 0

spawn PLift1
mp 4
coords 900 500 210
at 0

This is so I don't need to create multiple entities with different indexed variable to read/switch with
As for Robotnik, he should switch that platform by setting respective indexed variable with script
 
This platform will change to FOLLOW1 animation when certain indexed variable, matches with its MP is set to 1
Oh yes, I usually use MP to define switching code for platforms/traps in my mods
This sounds useful. Not even sure if I need it but I'll try it.

As for Robotnik, he should switch that platform by setting respective indexed variable with script
I figured I would need a script, I just need to know how. Also, during the platforms explode animations, I should be able to have ti do the same to Players and NPCs right?

EDIT:
By any chance would it look like that Unlock script?
Code:
@script
    if(frame==1){
      setglobalvar("Load9", 9);
    }
@end_script

x)
 
Also, during the platforms explode animations, I should be able to have ti do the same to Players and NPCs right?

You mean, running that script?

By any chance would it look like that Unlock script?

Yes, but you'll be using indexed variable like this:

Code:
    setindexedvar(2, 1);

That code will set indexed variable 2 to 1
 
You mean, running that script?
Yeah. Given what you showed me, I assume this is a yes, but I'll have to set up new animations for the characters, which I already planned on.

Yes, but you'll be using indexed variable like this:
    setindexedvar(2, 1);
That code will set indexed variable 2 to 1
lol, I thought that when I saw it. I'll keep this on hand and come back if I have an issue whenever I get to it, but I understand now why you set the MP after Spawn now. Thanks a lot.

x)
 


Got the script in and got the results I needed! At first I would test the animations and script and it would work, but when I would restart the level again, the platform would start exploding as soon as the level starts. I was going to post about it but decided to at "else if" commands to the index script and also have Robotnik's screen control all index changes, then added Spawn and Follow2 animations for the platform for insurance, and now it works perfectly. All I've got now is to test this on players.

EDIT:
Tried this for players using Raphael but there's no effect. Here's what I got for Robotnik.
Code:
anim idle
	 @script
     if(frame==69){
      setindexedvar(2, 1);
     }
     else if(frame==71){
      setindexedvar(1, 3);
     }
     else if(frame==73){
      setindexedvar(3, 2);
     }
     @end_script
	 loop      0
	 offset    123 127
	 delay     3
	 frame     data/bgs/ScrapBrain/DocS4.gif
	 frame     data/bgs/ScrapBrain/DocS5.gif
---
	 frame     data/bgs/ScrapBrain/DocS7.gif
	 delay     70
	 frame     data/bgs/ScrapBrain/DocS8.gif
	 delay     235
	 frame     data/bgs/ScrapBrain/DocS9.gif#69
	 delay     1
	 frame     data/bgs/ScrapBrain/DocS9.gif
	 delay     78
	 frame     data/bgs/ScrapBrain/DocS9.gif#71
	 delay     1
	 frame     data/bgs/ScrapBrain/DocS9.gif#72
	 delay     1
	 frame     data/bgs/ScrapBrain/DocS9.gif
	 delay     79
       @cmd    jumptobranch "ScrapBrain3" 1
	 frame     data/bgs/ScrapBrain/DocS9.gif#74

Here's what I have for Raph
Code:
anim	idle
@script
    void self = getlocalvar("self");
    int Code = getentityproperty(self,"mp");
    int Status = getindexedvar(Code);
     
    if(Status==3){
      performattack(self, openborconstant("ANI_FOLLOW3"));
    }
@end_script
	loop	1
	delay	9
	offset	152 134
	bbox	136 93 31 40
	frame	data/chars/Raph/Idle1.gif

anim    Follow3
	loop	0
	delay	10
	offset	152 134
        Jumpframe 3 3 0
	quakeframe	0 3 4
	#Landframe	3
	attack3	140 99 24 35 10 0 0 0 0 20
	Bbox	140 99 24 35
	#sound	Data/CHARS/Sonic/whoa.wav
	@cmd	changeentityproperty getlocalvar("self") "Subject_to_Platform" 1
	frame	data/chars/Raph/Fall0.gif
	frame	data/chars/Raph/Fall1.gif
	delay	500
	frame	data/chars/Raph/Fall2.gif

x)
 
Hmmm... this can't be used on players since player's MP will always change. You will need to define specific indexed variable for this purpose. So if you are using indexed variable 1 to force player then the script should be like this:

Code:
anim	idle
@script
    void self = getlocalvar("self");
    int Status = getindexedvar(1);
     
    if(Status==3){
      performattack(self, openborconstant("ANI_FOLLOW3"));
    }
@end_script
	loop	1
	delay	9
	offset	152 134
	bbox	136 93 31 40
	frame	data/chars/Raph/Idle1.gif
 
Thanks Blood. It took a while but after a lot of trial and error, I got the scene to go down perfectly. Had switch indexes the right way after doing their job so they don't repeat after the stage(Raph did his falling animation during the select screen at one point), here's what I got.
Code:
anim idle
	 @script
     if(frame==69){
      setindexedvar(2, 1); #platform explosion
     }
     else if(frame==71){
      setindexedvar(1, 3); #blast player up
     }
     else if(frame==73){
      setindexedvar(1, 2); #reset platform
     }
     else if(frame==74){
      setindexedvar(2, 3); #No command index
     }
     @end_script
	 loop      0
	 offset    123 127
	 delay     3
	 frame     data/bgs/ScrapBrain/DocS4.gif
         (over 60 repeated frames)
	 delay     70
	 frame     data/bgs/ScrapBrain/DocS8.gif
	 delay     235
	 frame     data/bgs/ScrapBrain/DocS9.gif#69
	 delay     1
	 frame     data/bgs/ScrapBrain/DocS9.gif
	 delay     68
	 frame     data/bgs/ScrapBrain/DocS9.gif#71
	 delay     3
	 frame     data/bgs/ScrapBrain/DocS9.gif
	 frame     data/bgs/ScrapBrain/DocS9.gif#73
	 frame     data/bgs/ScrapBrain/DocS9.gif
	 frame     data/bgs/ScrapBrain/DocS9.gif
	 delay     79
       @cmd    jumptobranch "ScrapBrain3" 1
	 frame     data/bgs/ScrapBrain/DocS9.gif#76
Had to number off the frames so I wouldn't have to use the editors to get the right number.

x)
 
Back
Top Bottom