Jump to content

Photo

stdWeapons.zh

library beta

  • Please log in to reply
96 replies to this topic

#91 Timelord

Timelord

    The Timelord

  • Banned
  • Location:Prydon Academy

Posted 08 January 2017 - 10:17 AM

Mid-slash? Unfortunately, you can`t control melee weapon stuff midway trough sequence because Zscript doesn`t allow code injection into function.


Hmm?

You could adjust the position within the ffc. He apparently wants to read the present tile, and flip, then move the coordinates of the desired draw and hit offsets. The controlling ffc can do all of that.

If the swords no longer use ffcs, then whatever function is setting their tile could be modified to move the draw and hitoffsets, globally.

Edited by ZoriaRPG, 08 January 2017 - 10:19 AM.


#92 Alucard648

Alucard648

    Wizard

  • Members
  • Location:castle Dracula

Posted 08 January 2017 - 09:39 PM

The problem is the fact that melee weapon function won`t return to controlling script until finishing slash/stab sequence.



#93 Shadowblitz16

Shadowblitz16

    Illustrious

  • Members

Posted 08 January 2017 - 10:21 PM

whats the best way to do it without the melee functions?



#94 Timelord

Timelord

    The Timelord

  • Banned
  • Location:Prydon Academy

Posted 26 January 2017 - 11:17 PM

Something I would ask, if you decide to make a version of this for 2.54, is to modify the drawing system, to use sprites provided by the item editor. The sword stab, slash, and beam sprites, for example, can be set, and read, as any normal sword would.

 

You can also do this now:

 

item script WeaponLauncher{
    void run (int d0, int d1, int d2, int d3, int d4, int d5, int d6, int d7){
        int q;
        int ffcscript = this->Attributes[9]; //From the item editor.
        int itm = this->ID;
        int args[8] = {d0,d1,d2,d3,d4,d5,d6,d7}; //Now you have all eight, plus up to nine more Attributes[].
        ffc launch = RunFFCScriptOrQuit(ffcscript, args);
        /* You could also use the editor flags 1-5 as a flagset and forward them.
        int flags;
        if ( this->Flags[0] ) flags |= 00001b; if ( this->Flags[1] ) flags |= 00010b; if ( this->Flags[2] ) flags |= 00100b;
        if ( this->Flags[3] ) flags |= 01000b; if ( this->Flags[4] ) flags |= 10000b; //Silly way to store five individual bits.
        launch->Misc[17] = flags; //FFC can now read the item flags as flagset&bit.
        */
 
        // or just use the forwarded item ID, which is simpler.
        launch->Misc[16] = this->ID; //Store the ID of the item that launched this.
        //then do itemdata id = Game->LoadItemData(this->Misc[16]) from the ffc, and you can read any property of
        //the item that spawned it. :)
       
    }
}

 

You can see that your options have opened up quite a bit.


  • Alucard648 likes this

#95 Emily

Emily

    Scripter / Dev

  • ZC Developers

Posted 19 May 2019 - 03:37 AM

//Returns TRUE, if corners of Lweapon touch a solid portion of any combo.
bool WallCollision4way(lweapon lw){
	int lwx = lwx + lw->HitXOffset;
	int lwy = lwy + lw->HitYOffset;
	int COLL_POINTSX[4]={lwx, lwx+lw->HitWidth, lwx ,lwx+lw->HitWidth};
	int COLL_POINTSY[4]={lwy, lwy, lwy+lw->HitHeight, lwy+lw->HitHeight};
	for (int i=0; i<=3; i++){
		if (Screen->isSolid(COLL_POINTSX[i], COLL_POINTSY[i])) return true;
	}
	return false;
}

`int lwx = lwx + lw->HitXOffset` should be `int lwx = lw->X + lw->HitXOffset`.

Same for `lwy` below it

Don't even know why `int lwx = lwx` compiles in 2.50.2, but it won't compile as of 2.55.



#96 Timelord

Timelord

    The Timelord

  • Banned
  • Location:Prydon Academy

Posted 19 May 2019 - 03:41 AM

Illegal Syntax Warning
 
All use of syntax like this is illegal in 2.55

lwx = lwx + something
You cannot initialise a variable to itself. The ability to do this was a bug in 2.50.

The correct syntax is (e.g.)

lwx = this->X + something

  • Alucard648 likes this

#97 Alucard648

Alucard648

    Wizard

  • Members
  • Location:castle Dracula

Posted 19 May 2019 - 12:32 PM

Illegal Syntax Warning
 
All use of syntax like this is illegal in 2.55
 

lwx = lwx + something
You cannot initialise a variable to itself. The ability to do this was a bug in 2.50.

The correct syntax is (e.g.)

lwx = this->X + something

Fixed. Updated.


  • Lüt likes this



Also tagged with one or more of these keywords: library, beta

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users