Problem with custom functions.[Solved]

Started by Icey, Fri 08/02/2013 19:57:10

Previous topic - Next topic

Icey

Everything seems to work fine but I just can't get my custom functions to work with objects in rooms. I've never tried so many work around before when it came to one thing before I just tried something else or asked for help. I've tried so many thing and changed many things but still I get nothing. However when when I take the chunk of code and place within another function it works just how I need it but it's not ment to be there so I can't leave it plus I can't ignore the other problem.

Basically I have a action command that is called in battle, if you have the Magic commands set under the battler it should get called. Everything works fine except for where object
  • is. Everything that is labeled under object doesn't get called at all for some reason.

    Code: AGS
    function JoltCast1(String text, int W, int Z){
        battler2.Walk(battler2.x-7, battler2.y, eBlock, eAnywhere);
     // battler2.ChangeView(9);
     // battler2.Animate(1, 5, eOnce, eBlock);
      DisplayAtY(5, String.Format("%s",text));
      Wait(10);
      
      
      //------------------run action
         if(JoltCOM1 == COM_fire){
          battler2.ChangeView(9);
      battler2.Animate(1, 5, eOnce, eBlock);
        object[1].SetPosition(W, Z);
      object[1].SetView(10);
        object[1].Visible = true;
      object[1].Animate(1, 5, eOnce, eBlock);
      object[1].Visible = false;
      
            }
         else if(JoltCOM1 == COM_shock){
            battler2.ChangeView(9);
      battler2.Animate(1, 5, eOnce, eBlock);
       object[1].SetPosition(W, Z);
      object[1].SetView(10);
      object[1].Visible = true;
      object[1].Animate(0, 5, eOnce, eBlock);
      object[1].Visible = false;
         }
      
      
      
      
      
      //------------------End action
       battler2.ChangeView(5);
      battler2.Walk(battler2.x+7, battler2.y, eBlock, eAnywhere); 
    }


    I can't fix this on my own cause I
    m really all out of ideas and I can't spend really to many days on this one part. This is a major part to games to have the spells and other effects show up and work right in
    battle.

    Here is the source if this is easier.

Khris

You defined the functions in the HEADER.
Move them to S3.asC

As for what's wrong with your code, are you sure you've set JoltCOM1 correctly?

Icey

#2
Ok, and yep, I'm trying to follow everything you said from previous topics and also make sure I have everything set up. So I created a checker that would tell you what ability is set to each slot. I.e DaveCOM1, DaveCOM2, ToriCOM4, etc.

So I put this in the header?

Code: ags
import function FadingMessage(int x, int y);
import function Party_death();

import function DaveAttack();



import function DaveCast1(String text);
import function DaveCast2(String text);
import function DaveItem(String text);
import function DaveAssault(String text);
import function JoltAttack();
import function JoltCast1(String text, int W, int Z);
import function JoltCast2(String text, int W, int Z);
import function JoltItem(String text);
import function JoltAssault(String text, String);

SMF spam blocked by CleanTalk