Help needed with final boss-battle -script translation needed!

Started by Grim, Fri 25/01/2008 12:54:12

Previous topic - Next topic

Grim

Yet again I need your help, people:)
I'm using AGS 2.61 with Left/right click template.

My game is nearly finished. I thought it would be interesting to end it with this massive fight with huge monster. Player has shotgun in the inv that will be used as a weapon. Now- I need help with scripting the whole thing and I'd apreciate all suggestions here.

1. First of all I want to create this monster as a couple of objects stuck together. 3 smaller objects player should shoot to kill it(certain vulnerable parts of the enemy) but when enemy shot elsewhere I want a short animation of blood splashing displayed in that exact spot.

2. I want monster to once every 15 seconds hit player and make him drop shotgun( so he has to run and pick it up again)When hit 5 times player dies.

3. Obviously shooting will be done by using inv item on enemy

4. Object 0- shotgun(when dropped)
    Object 1- body of the monster, undestructable
    Object 2, 3, 4 - parts that need to be hit and destroyed in order to kill enemy
    Object 5- monster's arm that every 15 secs hits the player

Ok. I know this is not ordinary question for this thread, I hope this is still fine with the rules. I just thought that some pro's like you will come up with the best way to script it. And if you do, can you please indicate where to put the script(rep-execute, etc)?

Thanks!

Dualnames

#1
Wow... I'm working on a code at the point and i'll edit this. Keep your breath.



EDIT:

About the objects being put together..I don;t really understand why you don't just put them together at the editor since the monster isn't walking.

top of the script
int loop;
int hits;
int bdeath;

repeatedly_execute {
loop++;
if (loop>=600) {
loop=0;
//add set object/animation run for shotgun
hits++;
return;
}
}

mouse click {
if (button==eMouseLeftClick) {
if ((mouse.Mode=emodeUseinv) && (player.ActiveInventory==igun)) {
if (Object.GetAtScreen(mouse.x,mouse.y)==oobject1) {
//use the object animate function(to do whatever you want with blood)
}
if (Object.GetAtScreen(mouse.x,mouse.y)==oobject2) {
bdeath++;
ObjectOff(2);
}
if (Object.GetAtScreen(mouse.x,mouse.y)==oobject3) {
bdeath++;
ObjectOff(3);
}
if (Object.GetAtScreen(mouse.x,mouse.y)==oobject4) {
bdeath++;
ObjectOff(4);
}
}
}
}

Worked on Strangeland, Primordia, Hob's Barrow, The Cat Lady, Mage's Initiation, Until I Have You, Downfall, Hunie Pop, and every game in the Wadjet Eye Games catalogue (porting)

Khris


Dualnames

Worked on Strangeland, Primordia, Hob's Barrow, The Cat Lady, Mage's Initiation, Until I Have You, Downfall, Hunie Pop, and every game in the Wadjet Eye Games catalogue (porting)

Grim

Thanks Dualnames! That was quick:)
I'll start making this scene next week and if I have further questions I will pm you( propably I will 'cos I'm not too good with scripting and mess it up:)

By the way, I really apreciate your enthusiasm and support on my game. I hope that "Downfall" won't let you down:)

Khris

Grim Reaper:
The script provided by Dualnames should get you started but it can't be used as-is.
Another thing: what you want is way easier if you split it up into its parts:

1. the arm hitting the player
2. shooting the monster results in a gush of blood
3. shooting all three objects kills the monster

1:
Code: ags
// player enters screen after fadein
  SetTimer(1, 15);

// room's rep_ex
  if (IsTimerExpired(1)) {
    oArm.Visible = true;
    if (player.InventoryQuantity[iShotgun.ID]==0) {
      SetTimer(1, 15);
      Wait(20);
      oArm.Visible = false;
      return;
    }
    player.LoseInventory(iShotgun);
    Wait(10);
    int x, y, dx, dy;
    bool done;
    while (!done) {
      x = Random(320); y = Random(200);
      dx = player.x-x; dy = player.y-y;
      if ((dx*dx+dy*dy)<60*60 && GetWalkableAreaAt(x,y)>0) done=true;
    }
    x -= 20; // shotgun sprite is 40px wide
    oShotgun.SetPosition(x, y);
    oShotgun.Visible = true;
    Wait(10);
    SetTimer(1, 15);
    oArm.Visible=false;
  }

And that was the hard part.

2: use inv iShotgun on cMonster -> play an anim at mouse.x, mouse.y + offsets (using an object)

3.
Code: ags
int hits;

function hit(int o) {
  object[o].Visible = false;
  PlaySound(X);   // ?
  hits++;
  if (hits == 3) {
    SetTimer(1, 0);
    cMonster.ChangeView(X);  // monster dies
    cMonster.Animate(...);       // ?
    player.ChangeRoom(X);
  }
}

// use inventory on object 2, 3 & 4
  hit(2);    // hit(3); / hit(4);


PS: I wanted to keep it short, but then I started typing the script and couldn't stop ;D

Dualnames

#6
FFS , just say once my script is good.  >:( If you wanted to help and not show off you wouldn;t have posted "this is gonna be good"

And adding sound and animating the char isn;t his problem at this point so no reason adding those lines instead of putting //put play sound functions
comment lines.

And you forgot to script actually one of the most important part of the codes, he actually insisted on getting help in that section since he got a lot troubled.

Plus I advice you to either help people, or not post at all because people get frustrated when they need help and you comment irrelevant things. You could PM me instead. It's like posting in the critic lounge and saying looks great.

On topic now:
Grim np helping, inform me or just post here and me or somebody as well will get you on track. I would have posted some code about that monster but I really need to see it so that I can help you out.
Worked on Strangeland, Primordia, Hob's Barrow, The Cat Lady, Mage's Initiation, Until I Have You, Downfall, Hunie Pop, and every game in the Wadjet Eye Games catalogue (porting)

Grim

Guys, I apreciate all help!

I know what I'll do. I'll make just one separate room to test this sequence and send it to you. Hopefully one room zipped will be small enough to email it... Then we'll see what works and what doesn't, 'cos as I said I'm a fool with scripting:) I shall start doing it on Moanday. I'll let you both know then.

Grim

Dualnames provided me with this script, but unfortunatelly it's not compatible with my version of ags. As I already said I'm using ags 2.61. Can someone "translate" this into code from the previous version please? When I test it in ags 2.7 it works fine but it's too late to upgrade my game to this version as the game is almost finished!:)

Rep_execute:

loop++;
if (loop>=600) {
oSohp.SetView(10);
oSohp.Animate(0, 5, eOnce, eBlock, eForwards);
oSohp.SetView(4,2,0);
if (hits==5) {
cEgo.LockView(11);
cEgo.Animate(1,5,eOnce,eBlock,eForwards);
cEgo.UnlockView();
}
if (hits<5) {
cEgo.LockView(11);
cEgo.Animate(0,5,eOnce,eBlock,eForwards);
cEgo.UnlockView();
}
object[2].Visible=true;
loop=0;
hits++;
return;
}
 
Use inv on object:

if (player.ActiveInventory==ishot) {
cEgo.LockView(9);
cEgo.Animate(0, 5, eOnce, eBlock, eForwards);
cEgo.UnlockView();
oBlodd.SetPosition(mouse.x,mouse.y);
oBlodd.SetView(8);
oBlodd.Visible=true;
oBlodd.Animate(0, 5, eOnce, eBlock, eForwards);
oBlodd.Visible=false; 

SMF spam blocked by CleanTalk