Oh yes, this what I was looking for. Thank you, and minmay!Isaac wrote:You can tag the tile damager as coming from a specific PC like this:
Code: Select all
onCast = function(champ, x, y, direction, skill) local dx,dy = getForward(party.facing) spawn("wall_fire", party.level, party.x+dx, party.y+dy, direction, party.elevation).tiledamager:setCastByChampion(champ:getOrdinal()) end,
Ask a simple question, get a simple answer
- zimberzimber
- Posts: 432
- Joined: Fri Feb 08, 2013 8:06 pm
Re: Ask a simple question, get a simple answer
My asset pack [v1.10]
Features a bit of everything!
Features a bit of everything!
Re: Ask a simple question, get a simple answer
It works ~in the sense that you can check it with [object_id].tiledamager:getCastByChampion()... but in practice I don't see any special XP treatment.
I just tested it with Zero XP characters, and found that after killing a monster with it, the whole party got the same experience bonus; actually PC 1 & 4 (humans) got 220xp, and PC 2&3 got 200xp. Only the mage ever damaged the monster [via the spell]... so I'm starting to wonder what setCastByChampion() is really for.
But they do get the XP... Unrelated tiledamagers that kill, don't award XP to the party.
I just tested it with Zero XP characters, and found that after killing a monster with it, the whole party got the same experience bonus; actually PC 1 & 4 (humans) got 220xp, and PC 2&3 got 200xp. Only the mage ever damaged the monster [via the spell]... so I'm starting to wonder what setCastByChampion() is really for.
But they do get the XP... Unrelated tiledamagers that kill, don't award XP to the party.
Re: Ask a simple question, get a simple answer
It doesn't matter which champion killed the monster in Grimrock 2, it just matters that a champion did it. You could always set the castByChampion to 1 if you wanted and it would work fine.
Grimrock 1 dungeon
Grimrock 2 resources
I no longer answer scripting questions in private messages. Please ask in a forum topic or this Discord server.
Grimrock 2 resources
I no longer answer scripting questions in private messages. Please ask in a forum topic or this Discord server.
- zimberzimber
- Posts: 432
- Joined: Fri Feb 08, 2013 8:06 pm
Re: Ask a simple question, get a simple answer
As Minmay already said, it is used to check whether the party should receive XP, and it can be used with other scripts like checking how much damage a hero did, or other damage modifiers.Isaac wrote:I just tested it with Zero XP characters, and found that after killing a monster with it, the whole party got the same experience bonus; actually PC 1 & 4 (humans) got 220xp, and PC 2&3 got 200xp. Only the mage ever damaged the monster [via the spell]... so I'm starting to wonder what setCastByChampion() is really for.
My asset pack [v1.10]
Features a bit of everything!
Features a bit of everything!
Re: Ask a simple question, get a simple answer
... But like minmay said, it doesn't seem to matter that any specific party member did the damage.
It may as well have been :setCastByParty(true)
It may as well have been :setCastByParty(true)
- zimberzimber
- Posts: 432
- Joined: Fri Feb 08, 2013 8:06 pm
Re: Ask a simple question, get a simple answer
Yes, if you don't plan on doing anything related to damage dealt by a champion or DPS checking.Isaac wrote:... But like minmay said, it doesn't seem to matter that any specific party member did the damage.
It may as well have been :setCastByParty(true)
For example, if a monster is immune to damage unless dealt by specific champion or by a champion that has a certain trait or item.
My asset pack [v1.10]
Features a bit of everything!
Features a bit of everything!
Re: Ask a simple question, get a simple answer
Updated that firewall spell to include environment checks. Now it appropriately reacts to doors and walls.
Code: Select all
defineSpell{
name = "fireWall",
uiName = "Firewall",
gesture = 14,
manaCost = 25,
skill = "fire_magic",
requirements = { "fire_magic", 3},
icon = 60,
spellIcon = 1,
description = "Summons forth a fiery wall to incinerate your foes",
onCast = function(champ, x, y, direction, skill)
local dx,dy = getForward(party.facing)
local test = party.map:checkObstacle(party, party.facing)
if not test or test == "dynamic_obstacle" then
spawn("wall_fire", party.level, party.x+dx, party.y+dy, direction, party.elevation).tiledamager:setCastByChampion(champ:getOrdinal())
else spawn("wall_fire", party.level, party.x, party.y, direction, party.elevation).tiledamager:setCastByChampion(champ:getOrdinal())
end
end,
}
- AndakRainor
- Posts: 674
- Joined: Thu Nov 20, 2014 5:18 pm
Re: Ask a simple question, get a simple answer
Hey guys, making spells is way more complex than that
You also have to test elevation when spawning ground spells! And if you want your fire wall to spawn on more than one tile, you will have to test every tiles
You also have to test elevation when spawning ground spells! And if you want your fire wall to spawn on more than one tile, you will have to test every tiles
Code: Select all
function checkGround(x, y)
if party.map:getElevation(x, y) == party.elevation then return true end
for e in party.map:entitiesAt(x, y) do
if e.platform and e.platform:isEnabled() and e.elevation == party.elevation then return true end
end
return false
end
- zimberzimber
- Posts: 432
- Joined: Fri Feb 08, 2013 8:06 pm
Re: Ask a simple question, get a simple answer
Isn't that part of what isBlocked() does?AndakRainor wrote:Hey guys, making spells is way more complex than that
You also have to test elevation when spawning ground spells!
Or you can just give it an iceShards component which does that automatically.AndakRainor wrote:And if you want your fire wall to spawn on more than one tile, you will have to test every tiles
My asset pack [v1.10]
Features a bit of everything!
Features a bit of everything!
- AndakRainor
- Posts: 674
- Joined: Thu Nov 20, 2014 5:18 pm
Re: Ask a simple question, get a simple answer
No, you have at least to test if the party is not in front of a tile with a lower elevation, in that case the ice shards spell does nothing.zimberzimber wrote:Isn't that part of what isBlocked() does?