Question(s) on rangedAttack

Talk about creating Grimrock 1 levels and mods here. Warning: forum contains spoilers!
User avatar
Neikun
Posts: 2457
Joined: Thu Sep 13, 2012 1:06 pm
Location: New Brunswick, Canada
Contact:

Question(s) on rangedAttack

Post by Neikun »

From the modding resource:
rangedAttack: the ranged attack to perform when “ranged_attack” animation event is triggered. Must be one of the following: “lightning_bolt”, “lightning_bolt_greater”, “ice_shards”, “fireball”, “fireball_greater”, “poison_bolt”, “frost_arrow”.

Why are we limited to these? How would I go about using frostbolt instead?
"I'm okay with being referred to as a goddess."
Community Model Request Thread
See what I'm working on right now: Neikun's Workshop
Lead Coordinator for Legends of the Northern Realms Project
  • Message me to join in!
Batty
Posts: 509
Joined: Sun Apr 15, 2012 7:04 pm

Re: Question(s) on rangedAttack

Post by Batty »

Probably limited to those because those are the only ones monsters used in the main game, I think.
User avatar
Neikun
Posts: 2457
Joined: Thu Sep 13, 2012 1:06 pm
Location: New Brunswick, Canada
Contact:

Re: Question(s) on rangedAttack

Post by Neikun »

I figured as much. But we must be able to expand on it. An Icy Uggardian using ice shards will use it even if out of range. :\
"I'm okay with being referred to as a goddess."
Community Model Request Thread
See what I'm working on right now: Neikun's Workshop
Lead Coordinator for Legends of the Northern Realms Project
  • Message me to join in!
Batty
Posts: 509
Joined: Sun Apr 15, 2012 7:04 pm

Re: Question(s) on rangedAttack

Post by Batty »

Errrrr, I guess you'd have to cancel the spell the monster was gonna cast by using the onRangedAttack hook, then spawn your frostbolt from the monster's x, y, facing?
User avatar
LordGarth
Posts: 500
Joined: Mon Jun 18, 2012 5:07 pm
Location: Colorado USA

Re: Question(s) on rangedAttack

Post by LordGarth »

I already posted this on one of my posts.

onRangedAttack = function(self)
if self.facing == 0 then
spawn("armagedon", self.level, self.x, self.y-1, self.facing)
end
if self.facing == 1 then
spawn("armagedon", self.level, self.x+1, self.y, self.facing)
end
if self.facing == 2 then
spawn("armagedon", self.level, self.x, self.y+1, self.facing)
end
if self.facing == 3 then
spawn("armagedon", self.level, self.x-1, self.y, self.facing)
end

Just replace armagedon with any your spells. Custom spells or regular. Then the monster will shoot two spells. The one it would normally and the new one.

LG
Dungeon Master and DOOM will live forever.
User avatar
Xanathar
Posts: 629
Joined: Sun Apr 15, 2012 10:19 am
Location: Torino, Italy
Contact:

Re: Question(s) on rangedAttack

Post by Xanathar »

Great solution.
Just to improve it a little bit:

local dx, dy = getForward(self.facing)
spawn("whatever", self.level, self.x + dx, self.y + dy, self.facing)
return false

Should do the trick in less lines, plus, thanks to the return, cancel the original spell.
Waking Violet (Steam, PS4, PSVita, Switch) : http://www.wakingviolet.com

The Sunset Gate [MOD]: viewtopic.php?f=14&t=5563

My preciousss: http://www.moonsharp.org
User avatar
Komag
Posts: 3658
Joined: Sat Jul 28, 2012 4:55 pm
Location: Boston, USA

Re: Question(s) on rangedAttack

Post by Komag »

If in some other case you still needed a few separate lines, you can use elseif instead of fully separate if...end (so long as it makes sense to do so and it's not a case where it might be logical to do BOTH things)
Finished Dungeons - complete mods to play
User avatar
Neikun
Posts: 2457
Joined: Thu Sep 13, 2012 1:06 pm
Location: New Brunswick, Canada
Contact:

Re: Question(s) on rangedAttack

Post by Neikun »

I don't understand how to implement these scripts.
I tried throwing Garth's in the monster's script, but it causes the file not to open.
Not a clue as to where to stick Xanathar's either.

Edit: got Garth's to load the file. (was missing an end.)
It however creates an error message in the console.
How can I get Xanathar's to work?
"I'm okay with being referred to as a goddess."
Community Model Request Thread
See what I'm working on right now: Neikun's Workshop
Lead Coordinator for Legends of the Northern Realms Project
  • Message me to join in!
Batty
Posts: 509
Joined: Sun Apr 15, 2012 7:04 pm

Re: Question(s) on rangedAttack

Post by Batty »

Xanathar script would look like this:

Code: Select all

onRangedAttack = function(self)
     local dx, dy = getForward(self.facing)
     spawn("frostbolt", self.level, self.x + dx, self.y + dy, self.facing)
     return false
end,
Haven't tried it but it looks good.
User avatar
Neikun
Posts: 2457
Joined: Thu Sep 13, 2012 1:06 pm
Location: New Brunswick, Canada
Contact:

Re: Question(s) on rangedAttack

Post by Neikun »

welp. the function(self) part was what I was missing lol.
Thanks Batty. Testing now.

PERFECT!
Thanks everyone. Frozen Uggardian should be ready to pack shortly. What should we name it?
Lets do it logically and disect the word before voting.
Ug Gardian
Gardian phonetically sounds like 'guardian' and I feel that's what it means.
That means Ug means something fire related?

So lets vote on one syllable 'words' to name the cold uggardian.

I vote 'er' Ergardian
"I'm okay with being referred to as a goddess."
Community Model Request Thread
See what I'm working on right now: Neikun's Workshop
Lead Coordinator for Legends of the Northern Realms Project
  • Message me to join in!
Post Reply