Aller au contenu

Photo

Are "global" objects possible?


  • Veuillez vous connecter pour répondre
41 réponses à ce sujet

#26
Quildra

Quildra
  • Members
  • 45 messages
yeah I already have all of that scripted except the inventory storage section.



as for the #include's do .nss scripts generate _h files? and can I forward declare arrays and functions?

if I can does DA scripting support dynamic arrays/vectors(not locations vectors).




#27
Nodrak

Nodrak
  • Members
  • 144 messages
Yes it can support foreward declaration, and I am assuming it can handle darrays since it looks like that is how nearby objects/eneimes are handled, though that is returned from the engine.

void main()
{
    object oChest;
    object[] objects;
}

Compiles fine.

Your work will be in making an array of resources, I am not sure if you can type cast the resources to Item or not since resource type appears to be a variable itself (enum/int).

Modifié par Nodrak, 20 novembre 2009 - 03:25 .


#28
Quildra

Quildra
  • Members
  • 45 messages
Sweet even if it doesn't It wont matter too much as I was planning to implement a capacity to my chest so its not uber game breaking. So i could use a fixed size array anyway

#29
Quildra

Quildra
  • Members
  • 45 messages
Wouldn't it need to be defined out of main or it would be remade every time and the contents lost. it would have to be treated like a member variable in C++.
so

object[] objects
void main()
{

}
no idea if that would compile or not.

*edit* Yep that compiles as well I shall test it out properly after I finish work.

Modifié par Quildra, 20 novembre 2009 - 03:30 .


#30
Nodrak

Nodrak
  • Members
  • 144 messages
Hmm yea good call.

Modifié par Nodrak, 20 novembre 2009 - 03:37 .


#31
AND04

AND04
  • Members
  • 154 messages
hmm, nice going - will try that stuff later on as well - problem being though that there is no "Inventory closed" event - just a Open Inventory one - and i wasn'T able to access the chest inventory in the leave area event either hmm :S

#32
Nodrak

Nodrak
  • Members
  • 144 messages
There is a file that has basically what you need for getting the inventory: _Debug/getinventory.nss

#33
Quildra

Quildra
  • Members
  • 45 messages
I wonder if i could use that for the object.

So the first time it is spawned i assign it to the and object outside of main. once i move areas the next time it is summoned I move it to the new area like I normally move the chest.



If this works then we have found a way to get global objects :)

#34
AND04

AND04
  • Members
  • 154 messages

Nodrak wrote...

There is a file that has basically what you need for getting the inventory: _Debug/getinventory.nss


hmm, will have to take a look at that - is this any different than the Standard GetInventoty() function implemented (wich didn't return anything in the leave event - maybe because they were allready unloaded?)

#35
Quildra

Quildra
  • Members
  • 45 messages

AND04 wrote...

hmm, nice going - will try that stuff later on as well - problem being though that there is no "Inventory closed" event - just a Open Inventory one - and i wasn'T able to access the chest inventory in the leave area event either hmm :S


There is PLACEABLE_ACTION_CLOSE but I've never tried to use it yet but it might be worth giving that a  go. 

#36
AND04

AND04
  • Members
  • 154 messages

Quildra wrote...

AND04 wrote...

hmm, nice going - will try that stuff later on as well - problem being though that there is no "Inventory closed" event - just a Open Inventory one - and i wasn'T able to access the chest inventory in the leave area event either hmm :S


There is PLACEABLE_ACTION_CLOSE but I've never tried to use it yet but it might be worth giving that a  go. 


hmm, how did i miss that? - thx gona try :)

though hmm, is that an action of the "Use" event?

Modifié par AND04, 20 novembre 2009 - 03:48 .


#37
Quildra

Quildra
  • Members
  • 45 messages
Its a placeable action but i believe it is generated from an EVENT_TYPE_USE

#38
AND04

AND04
  • Members
  • 154 messages

Quildra wrote...

Its a placeable action but i believe it is generated from an EVENT_TYPE_USE


bah overriding that Event is such a pain in the ass (using it in my Auto Loot Mod) :/

btw - what i am trying to do is actually quite similar to what you wanna do now - i want to be able to access a defined amount of chest-inventorys (Wardens Keep, the Example Partychest and maybe some others that are popular like the Beyond Feraldens) from anywhere using some sort of summoning item (code for that was finished long ago)

can't wait to try that new approach now :)

Modifié par AND04, 20 novembre 2009 - 03:56 .


#39
Nodrak

Nodrak
  • Members
  • 144 messages
I would parse the inventory of the chest before you leave the area incase it gets serialzed into binary data when it gets unloaded.  I would also destroy the chest too, instead of try to move it between areas.

Modifié par Nodrak, 20 novembre 2009 - 03:54 .


#40
Quildra

Quildra
  • Members
  • 45 messages
seemed simple enough when I did it. I just have an interaction script on my chest so i can handle any events that get called on it. Then if its one I don't have I route it back to the main game.

*edit*
Yeah it might be safer seen as the engine really doesn't seem to want to let us have a global object 

Modifié par Quildra, 20 novembre 2009 - 03:59 .


#41
AND04

AND04
  • Members
  • 154 messages

Quildra wrote...

seemed simple enough when I did it. I just have an interaction script on my chest so i can handle any events that get called on it. Then if its one I don't have I route it back to the main game.


Its simple if you limit it to a specific object true - but in case of the Auto Loot Mod i have to override the whole thing - means all Use events fire into my override first.

#42
Craig Graff

Craig Graff
  • Members
  • 608 messages
Something you might be interested in here:

a combination of GetObjectByTag and SetLocation can be used to move objects in and out of the char_stage area which is accessible from anywhere in the game.

Modifié par Craig Graff, 22 novembre 2009 - 08:17 .