Jump to content

Photo

Fire Extinguisher

LWeapon Script modified freeze Water 2.55 Alpha 79

  • Please log in to reply
6 replies to this topic

#1 Bagu

Bagu

    Fandomizer

  • Members
  • Real Name:A.I. Bot Bottomheimer
  • Location:Germany

Posted 07 September 2020 - 04:55 PM

                                                             Hey, folks :)

I wanted a fire extinguisher item in my quest (turning one type of damage combos into the next, following combo -just like the trigger->next function of generic combos), so I had the idea to modify a simialar lweapon code, that Venrob had written. (I already use the that script in one of my other projects ...it's great)
...it's the freeze water script.

-original code:

typedef const int DEFINE;
typedef const int CONFIG;

CONFIG MAX_ICE_LAYER = 0;

lweapon script freezeWater
{
	void run()
	{
		while(true)
		{
			freeze(ComboAt(this->X, this->Y));
			freeze(ComboAt(this->X+15, this->Y));
			freeze(ComboAt(this->X, this->Y+15));
			freeze(ComboAt(this->X+15, this->Y+15));
			Waitframe();
		}
	}
	
	void freeze(int loc)
	{
		for(int q = 0; q <= MAX_ICE_LAYER; ++q)
		{
			mapdata scr = Game->LoadTempScreen(q);
			if(scr->ComboT[loc] == CT_WATER)
				++scr->ComboD[loc];
		}
	}
}

I changed the script name to "FireExtinguisher" and CONFIG MAX_ICE_LAYER to MAX_CLEAR_LAYER
(I know, names doesn't matter, in this case)
But I had a big problem... (very intressting, btw)
When I changed this line...

if(scr->ComboT[loc] == CT_WATER)

to this...

if(scr->ComboT[loc] == CT_DAMAGE1)

...the script didn't do anything.

That's funny, cause I tried a bit around and I can replace CT_WATER with every other combo type and everything works fine.
....no matter if graves, Hookshootgrabs etc., they all turn into the next combo in the list.
It seems, it only doesn't work on damage combos. 
Don't know why

I hope someone can help me.


btw, I decided to modify Venrob's script, cause I'm not a good scripter and can only write very simple codes on my own  (still learning),
But there might be better ways, to do, whate I want.
I know I should rather use a code, the effects on a special combo ID (that I use for the "fire" damage combo), so the LWeapon won't work on other CT_DAMAGE1 combos, but yeah ...I have no idea how to script that. :goof: 


 


Edited by Bagu, 08 September 2020 - 06:24 PM.


#2 Timelord

Timelord

    The Timelord

  • Banned
  • Location:Prydon Academy

Posted 08 September 2020 - 03:58 AM

Did you assign the script to an lwpn script slot, and also set the item to run the script?


  • Bagu likes this

#3 Bagu

Bagu

    Fandomizer

  • Members
  • Real Name:A.I. Bot Bottomheimer
  • Location:Germany

Posted 08 September 2020 - 04:09 AM

Yes, of course and it works with all combo types I tried
...excepting on damage Combos


Edited by Bagu, 08 September 2020 - 04:33 AM.


#4 Bagu

Bagu

    Fandomizer

  • Members
  • Real Name:A.I. Bot Bottomheimer
  • Location:Germany

Posted 08 September 2020 - 07:46 AM

That's the current code, I use for the fire extinguisher.

 

typedef const int DEFINE;
typedef const int CONFIG;

CONFIG MAX_CLEAR_LAYER = 0;

lweapon script Fire_Extinguisher
{
	void run()
	{
		while(true)
		{
			extinguish(ComboAt(this->X, this->Y));
			extinguish(ComboAt(this->X+15, this->Y));
			extinguish(ComboAt(this->X, this->Y+15));
			extinguish(ComboAt(this->X+15, this->Y+15));
			Waitframe();
		}
	}
	
	void extinguish(int loc)
	{
		for(int q = 0; q <= MAX_CLEAR_LAYER; ++q)
		{
			mapdata scr = Game->LoadTempScreen(q);
			if(scr->ComboT[loc] == CT_DAMAGE1)
				++scr->ComboD[loc];
		}
	}
}

It does nothing...
...but when I replace "CT_DAMAGE1" with any other combo type, everything works fine (just like the freeze water code).



#5 Saffith

Saffith

    IPv7 user

  • ZC Developers

Posted 08 September 2020 - 03:55 PM

If it works for every other combo type, then presumably it's a mismatch between the constant and the actual value. That is, either CT_DAMAGE1 is wrong (unlikely) or that's not the combo type you're actually using.

CT_DAMAGE1 corresponds to Damage (1/2 Heart). In ZQuest, press Q twice to see the combo type numbers; it should be 31.


  • ShadowTiger, Timelord and Bagu like this

#6 Bagu

Bagu

    Fandomizer

  • Members
  • Real Name:A.I. Bot Bottomheimer
  • Location:Germany

Posted 08 September 2020 - 04:42 PM

Thanks that's great
...I'll check it out



#7 Bagu

Bagu

    Fandomizer

  • Members
  • Real Name:A.I. Bot Bottomheimer
  • Location:Germany

Posted 08 September 2020 - 05:41 PM

If it works for every other combo type, then presumably it's a mismatch between the constant and the actual value. That is, either CT_DAMAGE1 is wrong (unlikely) or that's not the combo type you're actually using.

CT_DAMAGE1 corresponds to Damage (1/2 Heart). In ZQuest, press Q twice to see the combo type numbers; it should be 31.

Everything works perfect now

Thank you, very much





Also tagged with one or more of these keywords: LWeapon Script, modified freeze Water, 2.55 Alpha 79

1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users