Jump to content

Photo

Custom Magic Book Help

item fulfilled

  • Please log in to reply
5 replies to this topic

#1 Jambu

Jambu

    Doyen(ne)

  • Members
  • Pronouns:He / Him

Posted 19 April 2024 - 08:21 AM

I'm looking for a replacement magic book. That makes the magic explode when it dies instead of the usual fire effect.


Edited by Jambu, 02 May 2024 - 05:36 PM.


#2 Jambu

Jambu

    Doyen(ne)

  • Members
  • Pronouns:He / Him

Posted 23 April 2024 - 12:17 PM

lweapon script magicbookworstitem{
	void run(int book_id = 32){
		if (player->Item[book_id] == -1){
			quit(); //Do nothing we don't got a book!
		}
		if (this->DeadState == 0){ //is the weapon about to die?
			lweapon boom = Create->LWeapon(LW_BOMBBLAST)
			boom->x = this->x
			boom->y = this->y
		}
	}
}

I tried writing it myself. but i get an error

 

[Error] syntax error, unexpected LINK [scripts\ExplosiveWand.zs Line 3 Column 13 'player']
[Error] ZQ_BUFFER Line 2 @ Columns 1-27 - Error P001: Included file 'scripts\ExplosiveWand.zs' encountered an error.


#3 connor.clark

connor.clark

    Junior

  • ZC Developers

Posted 23 April 2024 - 09:41 PM

"player" should be "Player".


  • Jambu likes this

#4 Jambu

Jambu

    Doyen(ne)

  • Members
  • Pronouns:He / Him

Posted 23 April 2024 - 10:06 PM

I got my first script to compile. I attached it to the weapon slot for the wand and magicbook (I'm not sure which one is correct) and the magic isn't exploding... :(

//causes magic to explode on death.
lweapon script magicbookworstitem{
	void run(int book_id = 32){
		if (Player->Item[book_id] == -1){
			Quit();
		}
		lweapon boom = Screen->CreateLWeapon(LW_BOMBBLAST);
		boom->X = this->X;
		boom->Y = this->Y;
	}
}


#5 Emily

Emily

    Scripter / Dev

  • ZC Developers
  • Pronouns:She / Her

Posted 23 April 2024 - 10:44 PM

You probably want `unless(Player->Item[book_id])` instead of `if(Player->Item[book_id] == -1)`.

Also, uh, booleans generally will only be `true` or `false`, never `-1`.



#6 Jambu

Jambu

    Doyen(ne)

  • Members
  • Pronouns:He / Him

Posted 24 April 2024 - 12:04 PM

Works now thanks for your help again you two.

My only missgiving is when it hits mirrors it explodes. Which is find in it's own way since the magic duplicated also explodes.


Edited by Jambu, 24 April 2024 - 12:06 PM.



0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users