New GUI scripting concepts and foundation

Talk about creating Grimrock 1 levels and mods here. Warning: forum contains spoilers!
User avatar
thomson
Posts: 337
Joined: Thu Sep 13, 2012 9:55 pm
Location: R'lyeh
Contact:

Re: New GUI scripting concepts and foundation

Post by thomson »

I've just finished the code for adding new character to the party. Its usage is very simple. Just add a script to your dungeon and put the following code in it.

Code: Select all

function newChampion()
	newguy = {
		name = "Taghor",    -- just a name
		race = "Insectoid", -- must be one of: Human, Minotaur, Lizardman, Insectoid
		class = "Mage",     -- must be one of: Figther, Rogue, Mage or Ranger
		sex = "male", 		-- must be one of: male, female
		level = 3,          -- character's level
		portrait = "mod_assets/textures/portraits/taghor.dds", -- must be 128x128 dds file
		
		-- allowed skills: air_magic, armors, assassination, athletics, axes, daggers, 
		-- dodge, earth_magic, fire_magic, ice_magic, maces, missile_weapons, spellcraft,
		-- staves, swords, throwing_weapons and unarmed_combat
		skills = { fire_magic = 10, earth_magic = 20, air_magic = 30, ice_magic = 40 },
				
		-- allowed traits: aggressive, agile, athletic, aura, cold_resistant, evasive, 
		-- fire_resistant, fist_fighter, head_hunter, healthy, lightning_speed,
		-- natural_armor, poison_resistant, skilled, strong_mind, tough
		-- Traits must be specified in quotes.
		-- Typically each character has 2 traits, but you can specify more or less.
		traits = { "lightning_speed", "tough", "skilled", "head_hunter", "aura" },
		
		health = 80, 		  -- Maximum health
		current_health = 70,  -- Current health
		
		energy = 300,         -- Maximum energy
		current_energy = 250, -- Current energy

		strength = 12,        -- Strength
		dexterity = 11,       -- Dexterity
		vitality = 10,        -- Vitality
		willpower = 9,        -- Willpower
		
		protection = 25,      -- protection
		evasion = 30, 		  -- evasion
				
		-- Resist fire/cold/poison/shock (remember that those values will be modified by bonuses
		-- from fire, cold, poison or shock magic
		resist_fire = 11,
		resist_cold = 22,
		resist_poison = 33,
		resist_shock = 44,
		
		-- items: Notation item_name = slot. Slots numbering: 1 (head), 2 (torso), 3 (legs), 4 (feet), 
		-- 5 (cloak), 6 (neck), 7 (left hand), 8 (right hand), 9 (gaunlets), 10 (bracers), 11-31 (backpack
		-- slots) or 0 (any empty slot in backpack)
		-- Make sure you put things in the right slot. Wrong slot (e.g. attempt to try boots on head)
		-- will make the item spawn to fail.
		items = { battle_axe = 0, lurker_hood = 1, lurker_vest = 2, lurker_pants = 3, lurker_boots = 4 },
		
		-- food: 0 (starving) to 1000 (just ate the whole cow)
		food = 100
		
	}

	-- Call addChampion method. It will add new guy to the party if there are suitable slots and will
	-- display a GUI prompt selecting a party member to drop if your party is already 4 guys
	gw_party.addChampion(newguy)
end
If there are less than 4 characters in your party, the new guy will join in immediately. If the party is full (4 guys), you'll see the following menu:
Image

Here's how the old and new champions look like: items view, stats view.
Note that specific values here are used as examples and not necessarily make much sense.

The example is available in grimwidgets repo. See new_champion script.
[MOD] Eye of the Beholder: Waterdeep sewers forum sources; Grimtools (LoG1 -> LoG2 converter) sources
User avatar
Neikun
Posts: 2457
Joined: Thu Sep 13, 2012 1:06 pm
Location: New Brunswick, Canada
Contact:

Re: New GUI scripting concepts and foundation

Post by Neikun »

This is gonna be super useful!
"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!
User avatar
Drakkan
Posts: 1318
Joined: Mon Dec 31, 2012 12:25 am

Re: New GUI scripting concepts and foundation

Post by Drakkan »

absolutely amazing script thomson !
Breath from the unpromising waters.
Eye of the Atlantis
User avatar
Diarmuid
Posts: 807
Joined: Thu Nov 22, 2012 6:59 am
Location: Montreal, Canada
Contact:

Re: New GUI scripting concepts and foundation

Post by Diarmuid »

This looks great. I wonder however why it doesn't use standard grimrock interface elements (textured boxes, font, color) is this something to be supported in the future? Not to spoil anything, but mahric's dialogue scripts for LotNR do have the grimrock gui elements and text, for example.
User avatar
thomson
Posts: 337
Joined: Thu Sep 13, 2012 9:55 pm
Location: R'lyeh
Contact:

Re: New GUI scripting concepts and foundation

Post by thomson »

Diarmuid wrote:I wonder however why it doesn't use standard grimrock interface elements (textured boxes, font, color) is this something to be supported in the future?
To use "standard grimrock interface elements" i.e. to have grimrock's look and feel, you actually need to create bitmaps.
Yes, this can be easily extended to display grimrock interface elements. Unfortunately, this requires some graphics oriented skills and I have none :) I'm just a software engineer.
However, if there's someone who is willing to create necessary images, I can tweak the script code to use it.

I'm not familiar with marhic's scripts. I was secretly hoping that perhaps LotNR guys would be interested in those scripts. I'm not sure what LotNR plans are, but it is likely that there will be some NPCs willing to join the party involved.
[MOD] Eye of the Beholder: Waterdeep sewers forum sources; Grimtools (LoG1 -> LoG2 converter) sources
User avatar
Diarmuid
Posts: 807
Joined: Thu Nov 22, 2012 6:59 am
Location: Montreal, Canada
Contact:

Re: New GUI scripting concepts and foundation

Post by Diarmuid »

Hi Thompson,

LotNR will definitely involve recruiting NPCs, so this is a great addition to our scripts. Our project has actually become a brewing ground for breaktrhough ideas as we are all daily exchange ideas and improve on each other's solutions. We thus have made big advances that even AH's staff is monitoring through Juho who scans our discussions and shows the others some of our experiments. Even if you don't have time to actively contribute to our project, being busy with EOB, i would like to invite you to our discussion group and give you access to our git repo. We should not be developping overlapping code and scripts independently from each other: you should see what we are doing and throw in suggestions if you may.
User avatar
Neikun
Posts: 2457
Joined: Thu Sep 13, 2012 1:06 pm
Location: New Brunswick, Canada
Contact:

Re: New GUI scripting concepts and foundation

Post by Neikun »

In fact, the reason I haven't sent you or any of the other EOB guys (aside from Jkos) an invitation to LotNR is because I presumed that you might be to busy to join up.
I do agree with Diarmuid though, we sure would love to have you on the team, even if for a less active role.
"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!
User avatar
thomson
Posts: 337
Joined: Thu Sep 13, 2012 9:55 pm
Location: R'lyeh
Contact:

Re: New GUI scripting concepts and foundation

Post by thomson »

Diarmuid wrote:i would like to invite you to our discussion group and give you access to our git repo. We should not be developping overlapping code and scripts independently from each other: you should see what we are doing and throw in suggestions if you may.
Neikun wrote:I do agree with Diarmuid though, we sure would love to have you on the team, even if for a less active role.
Thank you for your kind offer. I suppose I could join the team, but I do not have much time to offer. Besides LOG I have two big software projects I'm lead developer in, so this gives me really small bandwidth for LOG in general. And I need to split that time between EOB and grimwidgets already.

As Neikun said, my role will be less active one, but I'll try to contribute something. Two things that may be of interest to LotNR are NPC joining party script and events script. NPC joining party script is ready for use now. Event script is a work in progress. It is usable to some degree, but requires non-trivial amount of work. It allows to define easily scripted events based on dialog boxes. It was originally intended to handle NPC encounters in EOB, e.g. you meet a dwarf that you can heal, talk to, attack or leave. Depending on you choice you get another set of available actions. The current code is proof-of-concept only and requires substantial work before it becomes usable.
[MOD] Eye of the Beholder: Waterdeep sewers forum sources; Grimtools (LoG1 -> LoG2 converter) sources
User avatar
LordGarth
Posts: 500
Joined: Mon Jun 18, 2012 5:07 pm
Location: Colorado USA

Re: New GUI scripting concepts and foundation

Post by LordGarth »

We need to have parties of 6 or maybe 8.

Also need script like

function(monsters attacks other monsters not party)

I have summoning spells ready.

Summon Stone Golem, Magma Golem, Ice Golem, Storm Golem, Red, Purple and Black Phantoms.

New class needed. Summoner.

Thx,

LG
Dungeon Master and DOOM will live forever.
User avatar
thomson
Posts: 337
Joined: Thu Sep 13, 2012 9:55 pm
Location: R'lyeh
Contact:

Re: New GUI scripting concepts and foundation

Post by thomson »

LordGarth wrote:1. We need to have parties of 6 or maybe 8.
2. Also need script like function(monsters attacks other monsters not party)
3. New class needed. Summoner.
1. Party limit of 4 is a hard limit imposed by LOG engine and only AH can do anything about it.
2. This has nothing to do with GUI. Why are you mentioning this here?
3. Classes are hardcoded. See 1.
[MOD] Eye of the Beholder: Waterdeep sewers forum sources; Grimtools (LoG1 -> LoG2 converter) sources
Post Reply