Bit Blot Forum

Aquaria => Modding => Topic started by: TinaFishOfDoom on January 21, 2009, 02:36:13 am

Title: How to make forms in mods
Post by: TinaFishOfDoom on January 21, 2009, 02:36:13 am
Well Ive been wondering about the node to make naija learn forms  i need a bit of help. also i am new to modding and ive used the tutorial to figure out sum nodes but it dosent say anything bout it.
Title: Re: How to make forms in mods
Post by: TheBear on January 21, 2009, 03:27:56 am
I was messing around with this just yesterday. You'll need to create a script or copy one from another mod. The script below is from Guert mod...when Naija swims across that node she will learn energyForm and then a bool will prevent her from learning it twice...unless of course the map is reloaded or reentered.
Quote
n= 0
isenergylearned=false

function init(me)
   n = getNaija()     
end


function update(me, dt)

   if isenergylearned==false then
      if node_isEntityIn(me, n) then
         setControlHint("You've found a new song! You can now use ENERGY form!", 0, 0, 0, 16)
         learnSong(1)
         isenergylearned=True
      end
   end

end
Place the above text into "node_learnenergy.lua" in the scripts folder of your mod. Then place a node in your map called "learnenergy" to call it.

Substitute the "1" in learnSong(1) to learn a different form
1 = energyform
2 = ~
3 = spiritform
4 = bind
5 = nature
6 = beast
7 = shield
8 = ~
9 = duel
10 = fish
11 = sun
12 = li

oddly getForm(#) returns different but you don't need to worry about this
getForm(1) = energyform
getForm(2) = beastform
getForm(3) = natureform
getForm(6) = fishform
getForm(7) =  sunform
Title: Re: How to make forms in mods
Post by: Edwards on January 21, 2009, 03:38:29 am
As a more detailed explanation of why learnSong uses different numbers from getForm, it's because learnSong uses the index of a particular song you want the player to learn (Energy Form, Bind, Li*, etc.), while getForm returns the (completely unrelated) index of the form that the player is currently in (which is limited to just forms, not "forms and any other songs you happen to have").  You can find the numbers for both forms and songs in entityinclude.lua in the game's data files, although actually finding any particular number in that file takes a bit of searching.

Incidentally, learnSong(0) will teach the player the "heal" song, which has a broken animation and heals the player for about a tenth of a circle of health (I believe it is one hitpoint).  [EDIT] Here's the note sequence for it:
(http://i9.photobucket.com/albums/a68/vernagovi/HealSong.png)

- Edwards

* Although you can trivially teach the player Li's song, actually adding him to a mod is a bit more complex, and I haven't bothered to figure out how to do so.
Title: Re: How to make forms in mods
Post by: TinaFishOfDoom on January 21, 2009, 06:24:51 am
well i tryed what the first comment said and its not working? :'(
Title: Re: How to make forms in mods
Post by: Dolphin's Cry on January 21, 2009, 07:48:57 am
TheBear: True ~= true. The latter is a keyword in Lua, the former is just a global variable that defaults to nil like any other global variable that has not been set.
Title: Re: How to make forms in mods
Post by: TheBear on January 21, 2009, 04:16:23 pm
@tina: The code should work Tina...download Guert mod or BigEnergyBattle and copy node_learnenergy.lua from there (then create the node and swim across it).

@dolphin: Yeah I didn't write that code and wouldn't use a cap T there anyways but I didn't know that was case sensitive. I always set truth statements to == true just to be safe.