cast spell by script?

Talk about creating Grimrock 1 levels and mods here. Warning: forum contains spoilers!
User avatar
spectre900
Posts: 124
Joined: Fri Sep 14, 2012 1:47 am

cast spell by script?

Post by spectre900 » Tue May 06, 2014 9:37 pm

I dunno, I have searched around for what seems like hours but I just can't seem to find any good reference on how to make a script cast a spell for you, or on you. Like if I want to force darkness to be cast to disable any light spell cast by your party (not including torches). Or cast a buff spell like fire shield.

Anyone know how to do that?

User avatar
LocalFire
Posts: 261
Joined: Thu Feb 21, 2013 1:16 am
Location: Auckland, New Zealand

Re: cast spell by script?

Post by LocalFire » Wed May 07, 2014 8:21 am

Well I know how to buff the party, fire shield would be:

Code: Select all

     for i = 1,4 do
         party:getChampion(i):setCondition("fire_shield", 60) 
   end
And obviously changed for whatever effect you want, you can include a de-buff by changing the time to zero, and that will remove any effect. Same goe's if you wanted to curse/cure the party with Paralyse or poison effects by script.
My Dungeons
Paths of the Earth: viewtopic.php?f=14&t=5136
Beneath the Sands: viewtopic.php?f=14&t=5216
Videos: viewtopic.php?f=11&t=5443

User avatar
Leki
Posts: 548
Joined: Wed Sep 12, 2012 3:49 pm

Re: cast spell by script?

Post by Leki » Wed May 07, 2014 1:42 pm

In general, lighting in LoG is hardcoded and you cannot touch it in simply way. You cann't play with party's lightsources like light spell is. There is not access to light spell if I'm not wrong and you cannot force champion to cast that spell.

You can only spawn light as fx, for example:

Code: Select all

function light()
	spawn("fx", party.level, party.x, party.y, party.facing, "party_light"):setLight(1, 1, 1, 25, 25, 360, true)	
end
or as a light source you deffined as entity - see bellow.

Darkness is absence of light, so you cann't use:

Code: Select all

function darkness()
	spawn("fx", party.level, party.x, party.y, party.facing):setLight(0, 0, 0, 0, 100, 10, false)	
end
Unfortunatelly you cannot spawn "darkness" spell as "fireball" as well. Darkness spell only sets hardcoded party light to 0 brightness I guess.

i.e you have to be more specific, what you wanna achieve - e.g. If you need dark corridor/room for some special event, you can use black light sources for that: viewtopic.php?f=14&t=4367#p44675

If you wanna make some special light puzzles based dungeon, as old Shadowlands dungeon was, you have to create you own spells, fx, party hooks, light manager scripts etc, etc...[/color]
I'm the Gate I'm the Key.
Dawn of Lore

User avatar
spectre900
Posts: 124
Joined: Fri Sep 14, 2012 1:47 am

Re: cast spell by script?

Post by spectre900 » Wed May 07, 2014 3:41 pm

So there's no way to make the darkness spell be cast or activated on your party as if cast by hand/runes?

There's gotta be some way to activate it even if the spell and its effect is hardcoded in the game. =/

User avatar
Allanius2
Posts: 124
Joined: Mon Apr 14, 2014 10:12 pm

Re: cast spell by script?

Post by Allanius2 » Wed May 07, 2014 8:32 pm

I am currently playing the One Room Round Robin 2 mod an Cube's room has some sort of script to cast darkness in his room. You might want to download the source code and check his room out. Good luck.

User avatar
Komag
Posts: 3637
Joined: Sat Jul 28, 2012 4:55 pm
Location: Boston, USA

Re: cast spell by script?

Post by Komag » Wed May 07, 2014 9:57 pm

His spell simply puts out the torches
Finished Dungeons - complete mods to play

User avatar
spectre900
Posts: 124
Joined: Fri Sep 14, 2012 1:47 am

Re: cast spell by script?

Post by spectre900 » Thu May 08, 2014 3:08 am

oh, that sucks. =/

Ah well, thanks anyway guys.

User avatar
Diarmuid
Posts: 807
Joined: Thu Nov 22, 2012 6:59 am
Location: Montreal, Canada
Contact:

Re: cast spell by script?

Post by Diarmuid » Thu May 08, 2014 4:43 pm

Yes, unfortunately, we have no control over that... but if you need darkness, you can implement something like the LightTracker in the ORRR2, which is quite effective at tracking light/darkness as Komag saw in his last video, and then force the player to make darkness himself as part of the puzzle.

In my original mod I started working on and interrupted when I moved on to DarkDale and the ORRR2, I had a "temple of darkness" where you needed to walk in pure darkness. The moment you lighted up a torch or a light spell, you were teleported (expelled) instantly outside. So no tricks possible like holding torches on mouse, throwing them past check plates or whatever. I had tied that to a puzzle where you needed to retrieve a key item from the temple vaults, which sealed you inside when you picked it up. So you had to actually then use that "light -> expelled" trick to exit the temple. The design was fun and worked well and I'll reuse it in my game for sure.

User avatar
Eleven Warrior
Posts: 731
Joined: Thu Apr 18, 2013 2:32 pm
Location: Australia

Re: cast spell by script?

Post by Eleven Warrior » Fri May 09, 2014 2:13 pm

So how did you did you do it Diarmuid ?? I am really interested in this...... Please let us know how u did it thxs :) I have done all the above tricks but using timers and other stuff. I am interested in how you did it, and how the hell did you do the load and delete levels in RRR2, simply amazing bro for sure ahy :)

Is it possible we can get a Demo Dungeon??

Oh and don't stop working on Dark Dale it's going to be awesome.. The Shop system you have is so cool with the asking price of items and the buying price, man cant wait till this game is out. I (myself) think it will kill LOG 2, it offers so much more that that game. errrrrrrrrrrrrr sorry I should not talk like that..........I have been following your posts, and I like what I see awesome :) keep up the good work. PLEASE GET DARK DALE UP AND GOING MATE :)

User avatar
JKos
Posts: 464
Joined: Wed Sep 12, 2012 10:03 pm
Location: Finland
Contact:

Re: cast spell by script?

Post by JKos » Fri May 09, 2014 2:44 pm

one possible solution is to draw a dark overlay on entire screen with party.onDrawGui hook

Code: Select all

onDrawGui = function(g)
		g.color(2,2,2,240)
		g.drawRect(0, 0, g.width, g.height)
end
But that's really dark :)
- LoG Framework 2http://sites.google.com/site/jkoslog2 Define hooks in runtime by entity.name or entity.id + multiple hooks support.
- cloneObject viewtopic.php?f=22&t=8450

Post Reply