Hey, we have forums!

Author Topic: How to make forms in mods  (Read 9019 times)

0 Members and 1 Guest are viewing this topic.

Offline TinaFishOfDoom

  • Bit
  • ***
  • Posts: 12
    • View Profile
How to make forms in mods
« 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.
« Last Edit: January 21, 2009, 03:24:41 am by TinaFishOfDoom »

Offline TheBear

  • Extra Bit
  • *****
  • Posts: 199
    • View Profile
    • http://doconnell.wordpress.com
Re: How to make forms in mods
« Reply #1 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
« Last Edit: January 21, 2009, 03:31:02 am by TheBear »

Offline Edwards

  • Bit Bit
  • ****
  • Posts: 93
    • View Profile
Re: How to make forms in mods
« Reply #2 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:


- 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.
« Last Edit: January 21, 2009, 03:48:37 am by Edwards »
You should only need one canister shell to bag your deer using your howitzer, but assemble more than one if  you have a mind to.1

Offline TinaFishOfDoom

  • Bit
  • ***
  • Posts: 12
    • View Profile
Re: How to make forms in mods
« Reply #3 on: January 21, 2009, 06:24:51 am »
well i tryed what the first comment said and its not working? :'(

Offline Dolphin's Cry

  • Bit Bit
  • ****
  • Posts: 61
    • View Profile
Re: How to make forms in mods
« Reply #4 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.
Can you hear the dolphin's cry?

Offline TheBear

  • Extra Bit
  • *****
  • Posts: 199
    • View Profile
    • http://doconnell.wordpress.com
Re: How to make forms in mods
« Reply #5 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.