PDA

View Full Version : enemy scripts, question.



michal9000
09-02-2007, 07:27 PM
is it possible to lets say, change enemies traits for different dmaps? example

enemies on any dmap with the level "0" the enemies do not inflect damage but instead they warp you to a dmap with a higher level than "0" were they can inflect damage? then when you leave that screen it side warps you right back to the same spot on the level "0" dmap?

DarkDragon
09-02-2007, 07:35 PM
Yes, but it would take a bit of setup.

First, create new enemies that don't hurt Link. Then on each screen of DMap 0 add an invisible FFC that checks if Link's action gets set to hurt, and if so, teleports him to DMap 1 (you could also use a single carryover FFC). Then on DMap 1, just put 4 sidewarps on every screen back to DMap 0.

michal9000
09-04-2007, 01:42 AM
Thanks DarkDragon! That is exactly what I needed. I am going to be going to school for game dev. so I was wanting learn more on scripting. I will take your advise and study up more here and at pure. Thanks!

DarkDragon
09-04-2007, 02:45 AM
You're welcome :) Don't hesitate to ask if you have any questions along the way.

michal9000
09-04-2007, 03:27 PM
ok I will. I got one more question regarding this, is it possible to script the enemies to spawn every 10 to 15 seconds on the screen then disappear and re appear? Cause I am trying to make a quest like A.o.L but not a remake.

DarkDragon
09-04-2007, 04:12 PM
Yes. Make an FFC that calls CreateNPC() every 9000 frames or so.

I'm not sure what you mean by "disappear and reappear," but you can use scripts to either change the enemy's tile, or move him off of the screen completely, effectively making him invisible.

michal9000
09-04-2007, 05:49 PM
ok thank. But what I was meaning by disappear and reappear is link the enemies in A.o.L when your on the over world those black enemies pop up and if you don't come in contact with them the disappear and after a little while they reappear.

So that is what I was wanting to script is first script the enemies on level 0 to do the above and if link comes in contact with them he is warped to a side scroll screen on a higher level dmap were he does fight the enemies and then when he walks off the screen he side warps right back to the same spot on the level 0 dmap.

ShadowMancer
09-04-2007, 08:39 PM
Okay I see what you want to do (I was considering doing this style as well but changed my mind) anyway, what you want to do is, (see the code box it explains it)



//Psudocode just off the top of my head
//when timer runs out do following:
//get enemy tile
int orig_tile = ene_1->Tile
ene_1->Tile = 0 //Don't actually use 0 find a blank tile and use that
//then set another timer, when that runs out set the enemy tile back to orig_tile
////////////////
//Durring each frame check if Link is touching enemy
//You can run a loop where you load each enemy onscreen into a varible and then check the X and Y cords to see if they intersect with Link's X and Y and check the enemy tile to see if the enemy is not 'invisible'
//Load each enemy
int numb = NumbNPCs()
for (int i = 0; i <= numb; i += 1)
{
//one day we will have arrays :D
if (i == 1) {ene_01 = LoadNPC(1);}
if (i == 2) {ene_02 = LoadNPC(2);}
if (i == 3) {ene_03 = LoadNPC(3);}
if (i == 4) {ene_04 = LoadNPC(4);}
//etc, etc, etc, (and if anyone knows a better way to do this don't be shy
}
//check if the enemy is touching Link
if (Link->X >= ene_01->X - 8 && Link->X <= ene_01->X + 24 && Link->Y >= ene_01->Y && Link->Y <= Link->Y + 24 && ene_01->Tile != 0) //once again use a blank tile
{
//teleport Link
}


That is the basic idea, the code may not be 100% accurate but you seem to have an idea of what you are doing. Hope this helps :)