It is currently 07 Sep 2025, 07:33
   
Text Size

Formal Request Thread

Moderator: CCGHQ Admins

Re: Formal Request Thread

Postby Xander9009 » 11 Feb 2015, 14:39

Zambooo wrote:regarding Leyline of Punishment, I made another try:
| Open
Code: Select all
  <TRIGGERED_ABILITY replacement_effect="1">
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Damage can’t be prevented.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[Les blessures ne peuvent pas être prévenues.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[El daño no puede ser prevenido.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Schaden kann nicht verhindert werden.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Il danno non può essere prevenuto.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[ダメージは軽減できない。]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[Damage can’t be prevented.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[Повреждения не могуть быть предотвращены.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[O dano não pode ser prevenido.]]></LOCALISED_TEXT>
   <TRIGGER value="SOURCE_DEALS_DAMAGE" pre_trigger="1" damage_type="all" />
   <RESOLUTION_TIME_ACTION>
      local damage = Damage():PreventAll()
      EffectDC():Set_Int(1, damage)
   </RESOLUTION_TIME_ACTION>
   <RESOLUTION_TIME_ACTION>
      local damage = EffectDC():Get_Int(1)
      local source = Damage():GetSource()
      local target_object = Damage():GetReceivingObject()
      local target_player = Damage():GetReceivingPlayer()
      if damage ~= 0 then
         if ( target_object ~= nil ) then
            source:DealUnpreventableDamageTo( damage, target_object )
         elseif ( target_player ~= nil ) then
            source:DealUnpreventableDamageTo( damage, target_player )
         end
      end
    </RESOLUTION_TIME_ACTION>
 </TRIGGERED_ABILITY>
this way it should work as a check: if the damage is unpreventable Damage():PreventAll() will return 0, and the source won't deal damage again. yet I can't make the source deal damage to its target (again) in any case
I haven't looked at the code, but you might be encountering the engine bug I discovered with Deflecting Palm (at least, it appears to be an engine bug). The game seems to have trouble understanding what to do when an ability both prevents damage and deals damage. You have to split those up into two separate abilities such that the one that prevents the damage fires the other ability which deals the damage. Set them up as linked_ability_group="1" and you should be able to pass the numbers from one to the other using LinkedDC():Set_Int(0, damage).

Here's where we discussed it including an example of the delayed trigger solution two posts down: viewtopic.php?f=109&t=11010&start=2700#p172662
_______________________________
Community Wad - Community Wad Website - How to Help and Report Bugs
Discord: discord.gg/4AXvHzW
User avatar
Xander9009
Programmer
 
Posts: 2905
Joined: 29 Jun 2013, 07:44
Location: Indiana, United States
Has thanked: 121 times
Been thanked: 445 times

Re: Formal Request Thread

Postby Zambooo » 11 Feb 2015, 15:18

the code didn't work even before I added the "PreventAll()" part, so there is still something wrong :(
PS: I asked for the Deflecting Palm fix so I followed the story :P (even though it doesn't seem like by my code LOL)
User avatar
Zambooo
 
Posts: 242
Joined: 01 Jul 2012, 21:33
Has thanked: 19 times
Been thanked: 17 times

Re: Formal Request Thread

Postby Xander9009 » 11 Feb 2015, 16:17

My bad. I wasn't paying any attention to who requested it.

Have you tried adding in some messages to display the values of the variables at certain points? If you haven't and don't know how, you just put this:
EffectController():DisplayMessage("Damage variable is currently: " .. damage)
"Damage variable is currently: " will display literally on screen followed by whatever 'damage' currently is. Prefix them with numbers in teh order they go off, and you can see where exactly in the code it starts to misbehave.
_______________________________
Community Wad - Community Wad Website - How to Help and Report Bugs
Discord: discord.gg/4AXvHzW
User avatar
Xander9009
Programmer
 
Posts: 2905
Joined: 29 Jun 2013, 07:44
Location: Indiana, United States
Has thanked: 121 times
Been thanked: 445 times

Re: Formal Request Thread

Postby Zambooo » 12 Feb 2015, 20:07

Xander9009 wrote:My bad. I wasn't paying any attention to who requested it.

Have you tried adding in some messages to display the values of the variables at certain points? If you haven't and don't know how, you just put this:
EffectController():DisplayMessage("Damage variable is currently: " .. damage)
"Damage variable is currently: " will display literally on screen followed by whatever 'damage' currently is. Prefix them with numbers in teh order they go off, and you can see where exactly in the code it starts to misbehave.
cool! I didn't know about the DisplayMessage function.
though I can't use it to print my 'source' variable (aka Damage():GetSource()).. how can I achieve it? :D

this is what I get
Code: Select all
[lua] [string "LEYLINE_OF_PUNISHMENT_283205018_TITLE (RESOLUTION_TIME_ACTION)~0x000003c3"]:6: attempt to concatenate local 'source' (a table value)
from this

Does GetSource() return an array? :/
Code: Select all
local source = Damage():GetSource()
EffectController():DisplayMessage("Source variable is currently: " .. source)
User avatar
Zambooo
 
Posts: 242
Joined: 01 Jul 2012, 21:33
Has thanked: 19 times
Been thanked: 17 times

Re: Formal Request Thread

Postby Xander9009 » 12 Feb 2015, 20:31

Zambooo wrote:
Xander9009 wrote:My bad. I wasn't paying any attention to who requested it.

Have you tried adding in some messages to display the values of the variables at certain points? If you haven't and don't know how, you just put this:
EffectController():DisplayMessage("Damage variable is currently: " .. damage)
"Damage variable is currently: " will display literally on screen followed by whatever 'damage' currently is. Prefix them with numbers in teh order they go off, and you can see where exactly in the code it starts to misbehave.
cool! I didn't know about the DisplayMessage function.
though I can't use it to print my 'source' variable (aka Damage():GetSource()).. how can I achieve it? :D

this is what I get
Code: Select all
[lua] [string "LEYLINE_OF_PUNISHMENT_283205018_TITLE (RESOLUTION_TIME_ACTION)~0x000003c3"]:6: attempt to concatenate local 'source' (a table value)
from this

Does GetSource() return an array? :/
Code: Select all
local source = Damage():GetSource()
EffectController():DisplayMessage("Source variable is currently: " .. source)
GetSource() returns a card (should, at least), which does make sense as a table. I've never thought of them like that, but yeah. However, you can use GetName() to return a string which can be printed by DisplayMessage(). And yeah, I got the tip to use DisplayMessage() from Neo awhile back. It's quite handy :)

Code: Select all
local source = Damage():GetSource()
EffectController():DisplayMessage("Source variable is currently: " .. source:GetName())
_______________________________
Community Wad - Community Wad Website - How to Help and Report Bugs
Discord: discord.gg/4AXvHzW
User avatar
Xander9009
Programmer
 
Posts: 2905
Joined: 29 Jun 2013, 07:44
Location: Indiana, United States
Has thanked: 121 times
Been thanked: 445 times

Re: Formal Request Thread

Postby Zambooo » 12 Feb 2015, 20:43

| Open
Code: Select all
  <TRIGGERED_ABILITY replacement_effect="1">
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Damage can’t be prevented.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[Les blessures ne peuvent pas être prévenues.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[El daño no puede ser prevenido.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Schaden kann nicht verhindert werden.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Il danno non può essere prevenuto.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[ダメージは軽減できない。]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[Damage can’t be prevented.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[Повреждения не могуть быть предотвращены.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[O dano não pode ser prevenido.]]></LOCALISED_TEXT>
   <TRIGGER value="SOURCE_DEALS_DAMAGE" pre_trigger="1" damage_type="all" />
   <RESOLUTION_TIME_ACTION>
      local damage = Damage():GetAmount()
      EffectController():DisplayMessage("Damage variable is currently: " .. damage)
               
                local source = Damage():GetSource()
      if source == nil then
         EffectController():DisplayMessage("source is nil")
      else
         EffectController():DisplayMessage("Source variable is currently: " .. source:GetName())
      end

      local target_object = Damage():GetReceivingObject()
      if target_object == nil then
         EffectController():DisplayMessage("target_object is nil")
      else
         EffectController():DisplayMessage("Receiving Object is: " .. target_object)
      end

      local target_player = Damage():GetReceivingPlayer()
      if target_player == nil then
         EffectController():DisplayMessage("target_player is nil")
      else
         EffectController():DisplayMessage("Receiving Player is: " .. target_player)
      end

      if damage ~= 0 then
         if ( target_object ~= nil ) then
            source:DealUnpreventableDamageTo( damage, target_object )
         elseif ( target_player ~= nil ) then
            source:DealUnpreventableDamageTo( damage, target_player )
         end
      end
    </RESOLUTION_TIME_ACTION>
   <RESOLUTION_TIME_ACTION>
    Damage():Multiply(1)
    </RESOLUTION_TIME_ACTION>
 </TRIGGERED_ABILITY>
note: i added the "Multiply(1)" part otherwise there would have been no damage at all

now I get this
Code: Select all
[lua] [string "LEYLINE_OF_PUNISHMENT_283205018_TITLE (RESOLUTION_TIME_ACTION)~0x000005ae"]:9: attempt to call method 'GetName' (a nil value)
seems like source is not nil but GetName() returns nil..
User avatar
Zambooo
 
Posts: 242
Joined: 01 Jul 2012, 21:33
Has thanked: 19 times
Been thanked: 17 times

Re: Formal Request Thread

Postby RiiakShiNal » 12 Feb 2015, 23:30

Xander9009 wrote:
Zambooo wrote:cool! I didn't know about the DisplayMessage function.
though I can't use it to print my 'source' variable (aka Damage():GetSource()).. how can I achieve it? :D

this is what I get
Code: Select all
[lua] [string "LEYLINE_OF_PUNISHMENT_283205018_TITLE (RESOLUTION_TIME_ACTION)~0x000003c3"]:6: attempt to concatenate local 'source' (a table value)
from this

Does GetSource() return an array? :/
Code: Select all
local source = Damage():GetSource()
EffectController():DisplayMessage("Source variable is currently: " .. source)
GetSource() returns a card (should, at least), which does make sense as a table. I've never thought of them like that, but yeah. However, you can use GetName() to return a string which can be printed by DisplayMessage(). And yeah, I got the tip to use DisplayMessage() from Neo awhile back. It's quite handy :)

Code: Select all
local source = Damage():GetSource()
EffectController():DisplayMessage("Source variable is currently: " .. source:GetName())
Technically, C/C++ objects in Lua are implemented as a table of function pointers so cards are "tables". So you can look at them sort of as first looking up the function name as the key in the table with the function pointer being the value and you use that with the provided arguments to call the appropriate object function.

Also the function is actually GetCardName() not GetName().
RiiakShiNal
Programmer
 
Posts: 2188
Joined: 16 May 2011, 21:37
Has thanked: 75 times
Been thanked: 497 times

Re: Formal Request Thread

Postby Xander9009 » 13 Feb 2015, 00:10

RiiakShiNal wrote:Also the function is actually GetCardName() not GetName().
Oops. I should probably proof read things when I'm giving others advice. Thanks :oops:
_______________________________
Community Wad - Community Wad Website - How to Help and Report Bugs
Discord: discord.gg/4AXvHzW
User avatar
Xander9009
Programmer
 
Posts: 2905
Joined: 29 Jun 2013, 07:44
Location: Indiana, United States
Has thanked: 121 times
Been thanked: 445 times

Re: Formal Request Thread

Postby Blue Ghost » 13 Feb 2015, 02:47

Can I request Marath, Will of the Wild, if it's workable, or can be approximated? Thanks.
Blue Ghost
 
Posts: 52
Joined: 07 Apr 2013, 20:41
Has thanked: 6 times
Been thanked: 0 time

Re: Formal Request Thread

Postby Zambooo » 13 Feb 2015, 13:54

[always talking about Leyline of Punishment]
Code: Select all
local target_player = SecondaryPlayer()
      if target_player == nil then
         EffectController():DisplayMessage("target_player is nil")
      else
         EffectController():DisplayMessage("Receiving Player is: " .. target_player:GetPlayerName())
      end
GetPlayerName() returned a nil value.. how can I print player's Name then? :/
User avatar
Zambooo
 
Posts: 242
Joined: 01 Jul 2012, 21:33
Has thanked: 19 times
Been thanked: 17 times

Re: Formal Request Thread

Postby Xander9009 » 13 Feb 2015, 14:27

Zambooo wrote:[always talking about Leyline of Punishment]
Code: Select all
local target_player = SecondaryPlayer()
      if target_player == nil then
         EffectController():DisplayMessage("target_player is nil")
      else
         EffectController():DisplayMessage("Receiving Player is: " .. target_player:GetPlayerName())
      end
GetPlayerName() returned a nil value.. how can I print player's Name then? :/
IF you need to know what functions can be called on an object (such as a player), look here. You don't have to bookmark it to remember it: click wiki in the top left, go to 2014, and go to functions. If you see the list of player functions, those are all of the functions you can call on an object you know is a player. Unfortunately, getting their name isn't one of those functions. However, what I do usually is use IsAI(). I test in 2-player games, so that tells me if it's getting something valid and the thing it's getting is properly the computer controlled player.
_______________________________
Community Wad - Community Wad Website - How to Help and Report Bugs
Discord: discord.gg/4AXvHzW
User avatar
Xander9009
Programmer
 
Posts: 2905
Joined: 29 Jun 2013, 07:44
Location: Indiana, United States
Has thanked: 121 times
Been thanked: 445 times

Re: Formal Request Thread

Postby Zambooo » 13 Feb 2015, 15:43

ok this is my latest shot
| Open
Code: Select all
  <TRIGGERED_ABILITY replacement_effect="1">
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Damage can’t be prevented.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[Les blessures ne peuvent pas être prévenues.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[El daño no puede ser prevenido.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Schaden kann nicht verhindert werden.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Il danno non può essere prevenuto.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[ダメージは軽減できない。]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[Damage can’t be prevented.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[Повреждения не могуть быть предотвращены.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[O dano não pode ser prevenido.]]></LOCALISED_TEXT>
   <TRIGGER value="SOURCE_DEALS_DAMAGE_TO_PLAYER" pre_trigger="1" damage_type="all" />
   <TRIGGER value="SOURCE_DEALS_DAMAGE_TO_OBJECT" pre_trigger="1" damage_type="all" />
   <RESOLUTION_TIME_ACTION>
      local damage = Damage():GetAmount()
      EffectController():DisplayMessage("Damage variable is currently: " .. damage)
      
      local source = Damage():GetSource()
      if source == nil then
         EffectController():DisplayMessage("source is nil")
      else
         EffectController():DisplayMessage("Source variable is currently: " .. source:GetCardName())
      end
      
      local target_object = SecondaryObject()
      if target_object == nil then
         EffectController():DisplayMessage("target_object is nil")
      else
         EffectController():DisplayMessage("Receiving Object is: " .. target_object:GetCardName())
      end
      
      local target_player = SecondaryPlayer()
      if (target_player == nil) then
         EffectController():DisplayMessage("target_player is nil")
      end

      local delayDC = EffectDC():Make_Chest(1)
      delayDC:Set_CardPtr(0, source)
      delayDC:Protect_CardPtr(0)
        delayDC:Set_CardPtr(1, target_object)
        delayDC:Protect_CardPtr(1)
      delayDC:Set_PlayerPtr(0, target_player)
    </RESOLUTION_TIME_ACTION>
   <RESOLUTION_TIME_ACTION>
      local damage = Damage():PreventAll()
      EffectDC():Set_Int(1, damage)
      if damage ~= 0 then
         EffectController():DisplayMessage("Prevented Damage is: " .. damage)
         MTG():CreateDelayedTrigger(1, EffectDC())
      end
   </RESOLUTION_TIME_ACTION>
 </TRIGGERED_ABILITY>
 
 <TRIGGERED_ABILITY resource_id="1" replacement_effect="1">
   <TRIGGER value="STATE_BASED_EFFECTS" pre_trigger="1" />
   <CLEANUP fire_once="1" />
   <RESOLUTION_TIME_ACTION>
      local source = EffectDC():Get_CardPtr(0)
      local target_object = EffectDC():Get_CardPtr(1)
      local target_player = EffectDC():Get_PlayerPtr(0)
      if source ~= nil then
         if ( target_object ~= nil ) then
            source:DealUnpreventableDamageTo( damage, target_object )
         end
         if ( target_player ~= nil ) then
            source:DealUnpreventableDamageTo( damage, target_player )
         end
      end
   </RESOLUTION_TIME_ACTION>
  </TRIGGERED_ABILITY>
sadly it does not work.. can you check if I created the DelayedTrigger correctly?
User avatar
Zambooo
 
Posts: 242
Joined: 01 Jul 2012, 21:33
Has thanked: 19 times
Been thanked: 17 times

Re: Formal Request Thread

Postby Xenoix » 13 Feb 2015, 17:37

Would anyone mind coding Cream of the Crop ? I see someone had once, but it's been since removed.
Xenoix
 
Posts: 7
Joined: 09 Feb 2015, 07:43
Has thanked: 2 times
Been thanked: 0 time

Re: Formal Request Thread

Postby Peeping Peacock » 13 Feb 2015, 23:07

Did Pull from Eternity ever get coded?

There was a discussion after an attempt at it was made that implied it was possible to code, but after that I don't know if anything happened.

viewtopic.php?f=109&t=11010&p=165993&hilit=Pull+from+Eternity#p165993
Last edited by Peeping Peacock on 13 Feb 2015, 23:12, edited 1 time in total.
User avatar
Peeping Peacock
 
Posts: 1
Joined: 13 Feb 2015, 22:44
Has thanked: 1 time
Been thanked: 0 time

Re: Formal Request Thread

Postby Xander9009 » 13 Feb 2015, 23:10

Not that I know of. I'm currently trying to get the art wad split up into multiple smaller files (for the community wad). Once that's done, I'll be coding the other two requests. If I'm still motivated after I've done those, I'll consider this one.
_______________________________
Community Wad - Community Wad Website - How to Help and Report Bugs
Discord: discord.gg/4AXvHzW
User avatar
Xander9009
Programmer
 
Posts: 2905
Joined: 29 Jun 2013, 07:44
Location: Indiana, United States
Has thanked: 121 times
Been thanked: 445 times

PreviousNext

Return to 2014

Who is online

Users browsing this forum: No registered users and 19 guests

Main Menu

User Menu

Our Partners


Who is online

In total there are 19 users online :: 0 registered, 0 hidden and 19 guests (based on users active over the past 10 minutes)
Most users ever online was 7303 on 15 Jul 2025, 20:46

Users browsing this forum: No registered users and 19 guests

Login Form