[project1dev] Re: Project1 - SVN Update 753

  • From: Alan Wolfe <alan.wolfe@xxxxxxxxx>
  • To: project1dev@xxxxxxxxxxxxx
  • Date: Mon, 31 May 2010 16:11:10 -0700

oops... Model_GetModelByNickName returns 0 when it cant find a model, not -1
(my bad!)

i tried changing your loop to while ~= 0 and it didnt infinite loop anymore
(:

ill update the docs to say that

where in the code is the second thing happening at?
On Mon, May 31, 2010 at 3:02 PM, Kent Petersen <kentkmp@xxxxxxxxx> wrote:

> Ok, yeah. I see.
>
> I think I am doing that but it's still not working. I currently commented
> out the loop portion for searching for troll huts. Maybe I did it wrong but
> if the loop is not commented out it gets stuck in an infinite loop searching
> for huts.
>
> Second. I thought I made the model read from the map spawn a mob. Didn't
> seem to work either. Not sure if I'm doing something wrong or what.
>
>  I'm going out for a bit. Talk later
>
>
> On Mon, May 31, 2010 at 12:25 PM, Alan Wolfe <alan.wolfe@xxxxxxxxx> wrote:
>
>> Er i think that solves the problem, but if not let me know... i think it
>> should be 100% doable but sometimes you go to do stuff and i realize "oh
>> crap there is a missing part" hehe
>>
>>
>> On Mon, May 31, 2010 at 12:15 PM, Alan Wolfe <alan.wolfe@xxxxxxxxx>wrote:
>>
>>> Basically youd create a mob and tell it what the model ID was.  It
>>> wouldnt need to create a model, it would just use the one already created.
>>>
>>> does that answer your question?
>>>   On Mon, May 31, 2010 at 11:42 AM, Kent Petersen <kentkmp@xxxxxxxxx>wrote:
>>>
>>>> 2nd conundrum:
>>>>
>>>> I place the model in the editor. I detect the model in the index.lua. I
>>>> have the nickname. I have the model ID. How do I give it the mob 
>>>> properties?
>>>>
>>>>
>>>>
>>>>
>>>> On Mon, May 31, 2010 at 11:38 AM, Kent Petersen <kentkmp@xxxxxxxxx>wrote:
>>>>
>>>>> I started implementing this and I ran into a problem.
>>>>>
>>>>> How does the game know when there are no more Trollhuts to read in?
>>>>>
>>>>>
>>>>> On Wed, May 19, 2010 at 1:21 PM, Kent Petersen <kentkmp@xxxxxxxxx>wrote:
>>>>>
>>>>>> awesome idea
>>>>>>
>>>>>>
>>>>>> On Wed, May 19, 2010 at 12:46 PM, Alan Wolfe <alan.wolfe@xxxxxxxxx>wrote:
>>>>>>
>>>>>>> you may be wondering how we are going to re-use this for future
>>>>>>> levels when we have less or more troll huts.
>>>>>>>
>>>>>>> what i would do if you dont have a solution for that would be to name
>>>>>>> them this way...
>>>>>>>
>>>>>>> TrollHut1
>>>>>>> TrollHut2
>>>>>>> TrollHut3
>>>>>>> ...
>>>>>>> etc
>>>>>>>
>>>>>>> and then, in the script for the level, basically have a while loop
>>>>>>> (pseudo code)
>>>>>>>
>>>>>>> Index = 1;
>>>>>>> NickName = "TrollHut"+Index;
>>>>>>> ModelID  = Model_GetByNickName(NickName);
>>>>>>>
>>>>>>> while ModelID != -1 do
>>>>>>>
>>>>>>>   --spawn a mob at ModelID's location
>>>>>>>
>>>>>>>   Index = Index + 1;
>>>>>>>
>>>>>>>   NickName = "TrollHut"+Index;
>>>>>>>   ModelID  = Model_GetByNickName(NickName);
>>>>>>>
>>>>>>> end
>>>>>>>
>>>>>>> so that way, as long as people follow the naming convention when
>>>>>>> building the maps, it will be able to "autodetect" troll huts.
>>>>>>>
>>>>>>>
>>>>>>> On Wed, May 19, 2010 at 12:41 PM, Kent Petersen 
>>>>>>> <kentkmp@xxxxxxxxx>wrote:
>>>>>>>
>>>>>>>> I'll look into that. Seems like a better way of doing it.
>>>>>>>>
>>>>>>>> On Wed, May 19, 2010 at 12:39 PM, Alan Wolfe 
>>>>>>>> <alan.wolfe@xxxxxxxxx>wrote:
>>>>>>>>
>>>>>>>>> Yes (:
>>>>>>>>>
>>>>>>>>> In the editor when you have the model properties window open,
>>>>>>>>> theres a place for  a "NickName"
>>>>>>>>>
>>>>>>>>> you just put a string of text in there...  aka "TrollHut1".
>>>>>>>>>
>>>>>>>>> Then from script you can do a Model_GetByNickName or something like
>>>>>>>>> that.  I forget what the function is called exactly but it should be
>>>>>>>>> obvious... or i think the level 1 overworld's index.lua script has an
>>>>>>>>> example of that to get the terrain model.
>>>>>>>>>
>>>>>>>>> Anyhow, from there you can get the model's position (and rotation
>>>>>>>>> if you care) and you should be able to spawn a mob of type "troll 
>>>>>>>>> hut" at
>>>>>>>>> that location.
>>>>>>>>>
>>>>>>>>> the troll hut mob would then not have to load any model as part of
>>>>>>>>> it's script... it would just worry about creating guys.
>>>>>>>>>
>>>>>>>>> it should all be possible (:
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> On Wed, May 19, 2010 at 12:35 PM, Kent Petersen <kentkmp@xxxxxxxxx
>>>>>>>>> > wrote:
>>>>>>>>>
>>>>>>>>>> Do we have functionality for that now?
>>>>>>>>>>
>>>>>>>>>> Would we be able to turn the model in the editor into a mob?
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> On Wed, May 19, 2010 at 10:23 AM, Alan Wolfe <
>>>>>>>>>> alan.wolfe@xxxxxxxxx> wrote:
>>>>>>>>>>
>>>>>>>>>>> Another idea that might be nice (maybe for later on though...)
>>>>>>>>>>> would be to place a model of a troll hut in the world in the editor 
>>>>>>>>>>> but give
>>>>>>>>>>> each a nickname of like "TrollHut1" "TrollHut2" etc and then from 
>>>>>>>>>>> script you
>>>>>>>>>>> can get a model by it's nickname, then get it's position and 
>>>>>>>>>>> rotation from
>>>>>>>>>>> the model (Model_GetPosition etc) and spawn your "spawning mob" at 
>>>>>>>>>>> the
>>>>>>>>>>> location.
>>>>>>>>>>>
>>>>>>>>>>> That way you can place and manipulate troll huts in the editor,
>>>>>>>>>>> but they are functional in game.
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> On Wed, May 19, 2010 at 10:06 AM, Kent Petersen <
>>>>>>>>>>> kentkmp@xxxxxxxxx> wrote:
>>>>>>>>>>>
>>>>>>>>>>>> Thanks man, I see what you mean. I like your suggestion
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>> On Tue, May 18, 2010 at 10:21 PM, Apache User <
>>>>>>>>>>>> dhapache@xxxxxxxxxxxxxxxxxxx> wrote:
>>>>>>>>>>>>
>>>>>>>>>>>>> User:atrix256
>>>>>>>>>>>>>
>>>>>>>>>>>>> Message: Hey Kent, this fixes the Model_SetOnWorld problem.
>>>>>>>>>>>>>
>>>>>>>>>>>>> (it uses that function to put the houses on the world for the
>>>>>>>>>>>>> town buildings now)
>>>>>>>>>>>>>
>>>>>>>>>>>>> One problem though, you can't use model_setonworld until the
>>>>>>>>>>>>> first Update happens (because the world isnt finished building 
>>>>>>>>>>>>> until then),
>>>>>>>>>>>>> so you can't put it just out there in the file.
>>>>>>>>>>>>>
>>>>>>>>>>>>> What i would do is make a variable like "IsFirstUpdate" and i'd
>>>>>>>>>>>>> set it to 1 or true, then in the Update function if that was 
>>>>>>>>>>>>> true, id set it
>>>>>>>>>>>>> to false and do the set on world stuff.
>>>>>>>>>>>>>
>>>>>>>>>>>>> Either that or manually place those on the world where they
>>>>>>>>>>>>> should be.
>>>>>>>>>>>>>
>>>>>>>>>>>>> <Files Changed>
>>>>>>>>>>>>> U   ActRaiser/ARRelease.exe
>>>>>>>>>>>>> U   ActRaiser/Scripts/GameOverworld/Town.lua
>>>>>>>>>>>>> U   Code/ARRelease.exe
>>>>>>>>>>>>> U   Code/AR_LuaFuncs.cpp
>>>>>>>>>>>>> U   PirateDice/ARRelease.exe
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>> ==============================
>>>>>>>>>>>>> Project 1 Dev mailing list
>>>>>>>>>>>>> to unsubscribe, please send an email request to
>>>>>>>>>>>>> demofox@xxxxxxxxxxx
>>>>>>>>>>>>> Project 1 website: http://project1.demofox.org
>>>>>>>>>>>>> Project 1 SVN repository: http://pyotek.com/project1
>>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>
>>>>>
>>>>
>>>
>>
>

Other related posts: