This is a read only copy without any forum functionality of the old Modcraft forum.
If there is anything that you would like to have removed, message me on Discord via Kaev#5208.
Big thanks to Alastor for making this copy!

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Rochet2

Pages: 1 2 [3] 4
31
Miscellaneous / Re: [Question] Items that spawn temporary objects.
« on: July 30, 2015, 12:14:18 am »
GOMove is just stabbing the existing systems.
The temporary object guids are hacked into the system so that the high part is used as the spawn ID even if that is not intended. The objects are saved to some gameobject storage system used by spells.
Would probably code it a bit differently on the spell storage part now..

Yeah, tested and you should be able to use the guid:

Code: [Select]
local x,y,z,o = plr:GetLocation()
local tar = plr:SpawnCreature( 36, x, y, z, o )
-- save guid somewhere, I save it to global variable GUIDL, but then again this is just an example code
GUIDL = tar:GetGUID()

-- Later access the creature by the saved guid:
local creature = plr:GetMap():GetWorldObject( GUIDL )
creature:SendUnitSay("asd", 0)

ps. even though I wrote this for creaturem same code works with gameobjects except gameobjects cant say stuff :P

32
Miscellaneous / Re: [Question] Items that spawn temporary objects.
« on: July 29, 2015, 10:38:29 pm »
What core / lua engine are you using?
On trinitycore all objects have a guid - however Im unsure if you can use it to get the object.
In any case when spawing an object the spawn function usually returns a reference to the object.
This reference could be used to identify and maybe access the object later on.

However such access is dangerous without guaranteeing the object still exists (dangling pointer).
A grid search with checking the guid might be a better way if needing access after time has passed.

Can you post what you have already?

33
Serverside Modding / Re: [C++]  StockExchange NPC Script
« on: July 25, 2015, 05:32:26 pm »
PR would be a github pull request.

Did you fix the crash? Did you get the debugging and or crash logging working?

I was just noting about the investment. I ignored what the purpose of the code was and simply analyzed the code. Seemed the code said only use 1.2.3.4. etc and nothing about using higher values.

If you keep the stock data in RAM and when you update it, update it to both to RAM and to DB.
That way the info in both places is uptodate and you can get the correct data in code at any time with simply using the stored data. Like I mentioned earlier, using Exeute to update the database should be less heavy than using Query.
Though its a bit hard for me to see how this ratio thing works .. I feel like storing a float ratio is a bad thing since rounding could make it screw up so that its over or under allowed. Not that I checked if that is possible in the code.

You seem to be using Query/PQuery for all your database actions. What is wrong with using Execute?
You should change all SQL statements where you do not actually fetch any data into Execute, PExecute or DirectExecute or PDirectExecute.

34
Serverside Modding / Re: [C++]  StockExchange NPC Script
« on: July 25, 2015, 12:43:55 pm »
Working on coding Eluna multithreaded version.
Should work on a PR as well .. and hoover since its saturday.

You dont actually need to do anything to your script to have the crash logs etc I just said. :3

Some notes:
Do not store variables like _stock unless you REALLY have to. They are subject to race conditions in some cases and they are shared between users using the gossip on any NPCs using the same script.
So even if you have 2 players on same NPC using the script, they may mess up eachother's choices in the script. Its better to use the sender and action to pass data around gossip and if something needs to be stored outside, store it to the player class or similar. (depends on situation)
I think its a waste sometimes when something like GOSSIP_SENDER_MAIN is used as sender.

Spell, aura, creature and gameobject AI scripts are different and in those you can store member variables to the script class. But do not store anything to the base script classes you use like CreatureScript and PlayerScript and so.

Use the override keyword if possible. It will make sure the script operates correctly in the future and makes your own typos and other mistakes show.

Since gossip is handled in thread safe environment, it delays ALL actions on the server for the time the script runs. For that reson it would be important to keep it efficient. And one thing that is not efficient at all is database querying in real time. PExecute (and Execute) should be asynchronous (delayed/queued) though, so that /should/ be alright.
Load the needed data on start up or player log in or similar so its loaded beforehand and doesnt need loading all the time when using the script
That way you wont probably need to resort to hacks like this; SELECT %u FROM.
Database actions should be file reads, so having an SSD would speed the database. File IO is way slower than RAM access.

Post the database SQL code and data with the script. Its not always easy to just read a random script and see whats wrong and testing it is not a walk in the park without the database structure and code. Also the database structure could be faulty - many use bad database table structures without being aware how it may affect their script.
For example what data do you have in stock table?

Note that those talk and similar functions can be spammed. You can hit some action and everyone gets their chat and screen spammed with text.
Note that investment can be 99999. was this intended?

When testing, I dont have any crash.

Note that UPDATE `character_stockdata` SET `1` = %u WHERE `iD` = %f
here you mixed %u and %f.
Note that in SellStock you use result1 before checking if it is null. Check EVERY query! (if (!result) return)


PS. I hope you are using some sane IDE like Visual Studio to code your scripts.

35
Serverside Modding / Re: [C++]  StockExchange NPC Script
« on: July 25, 2015, 01:35:00 am »
Going to sleep myself now, but you could try:

If you are on windows, set the compile mode to debug and try crashing again. There should be a crash log in the server folder / crashes. http://prntscr.com/7wnmvp
You can also try debugging easily after compiling in debug by using attach to process.
Open the TrinityCore.sln (or whatever core you use) and start the server normally. Then in visual studio click this: http://prntscr.com/7wnngg
Then choose worldserver and you are debugging the code.
From there you can either crash the script and the debugger will move to that point or you can set break points by clicking the "gutter" http://prntscr.com/7wnnp5
The text file is what you want to look at in the crash logs. The dmp file can be dragged to visual studio and it will show as if you were debugging at that time (shows call stacks, local variables and everything)

On linux you would need to use gdb to debug and TC provides a GDB file for creating crash logs I assume
See and read more at: https://github.com/TrinityCore/TrinityC ... b/debugger

You can here as well try use the gdb with the debugger file like the TC link readme tells you and let the core crash without actually using the debugger with break points etc and it should proabably output a log automatically similar to windows.


I hope you can get to some crash logging and debugging to make future ventures easier :)
I myself discovered these tools WAY too late.


Crash logs may not be that useful always, but most of the time (at least on windows) they provide a huge amount of useful information .. like .. what line crashed.
Here is a log example from my own crashes on windows from when I was developing today:
http://pastebin.com/0K0CBYa5
it has all kind of information like branch and commit, but the most important is the call stack which shows at top where the program crashed and what was called to get to that crashing point.
Below the call stack is a bunch of local variables and similar info.
on linux you would expect to see something similar.

36
Serverside Modding / [RELEASE] Dress NPCs
« on: July 20, 2015, 04:49:05 pm »
This has been posted in some topics here already, but here it is as a release : )
Thanks a lot to Valkryst for reporting bugs and just using the modification.

Additional note: You can dress any existing races including playable and the naga and vrykul etc.

Ppl have asked once in a while if you could dress NPCs some gear and items etc. Usually people answer that you need to make a patch or similar.
Through some core editing and the mage spell "mirror image" (not actually using the spell, but the packet and flags) I made it possible to dress NPCs with gear.
Its a rather simple idea.

You can make an NPC, set the displays of items you want him to have and his race and gender (defines displayID) as well as facial features and skin color.
All this is done in the database.
The values for skins and features range from 0 to 12 or something .. not quite sure how many there are.

Read more & get it:
http://rochet2.github.io/Dress-NPCs.html


37
I decided to dump some of my stuff on modcraft aswell. : )

AIO is a pure lua server-client communication system for Eluna and WoW.
AIO is designed for sending lua addons and data to player from server and data from player to server.

As a recent addition I have been working with SaiF to make some C API so you wouldnt have to have Eluna.

With AIO you can deal out addons and make changes to them without dealing out patches or new addon files to users afterwards.
AIO allows you to make UI to interact with your lua scripts. You can use the base WoW addon API and you will have access to few AIO specific functions for communication with the server.
AIO is using compression and obfuscation to make addon codes smaller to send. Also a cache system is in place to further reduce server side work.


Get your's now!
http://rochet2.github.io/AIO.html


38
SQL does math with bigint - int64.
So if there is any problems with the result2 being wrong, its likely that you would need to use GetInt64.
Read more here: https://github.com/ElunaLuaEngine/Eluna/issues/89

39
Miscellaneous / Re: [QUESTION] Unsheathe aura
« on: July 13, 2015, 02:46:05 pm »
I tested the C++ option, but it doesnt work.
It is only used to send the sheath information to other players around. Your own client handles your character sheathing and its not controllable from server.
Disabling all the sheath code only resulted into players not seeing eachother sheath and unsheath weapons.

So unless this is needed for a creature, there is no way to control the player's sheathe without client modifications. And using a spell visual like on the frostmourne spell will not copy the currently equipped weapon model.

40
Miscellaneous / Re: [QUESTIONS] - Objects & Others
« on: July 12, 2015, 03:22:16 pm »
Create this small script that works with the spell
http://www.wowhead.com/spell=62743/undercity-banner
as an example to save the spawned object to the database.
https://gist.github.com/Rochet2/d6212b5a2289eeac2d56

What it does?
It stops the default behavior and uses the spell's data to make a permanent spawn.

41
Miscellaneous / Re: [QUESTIONS] - Objects & Others
« on: July 12, 2015, 12:32:41 am »
Only already saved objects are in the database.

You should make it so that the default action is cancelled for the spell and then use the spell position and spawn a saved object there.
See the way objects are save spawned from .gob add command.
Many spell scripts work as an example for the spell script part.
You need to hook to the effect and call PreventDefaultAction() or similar function that is a member of the SpellScript class.

42
Quote from: "Смердокрыл"
Quote from: "Valkryst"
This core modification by Rochet2 will do what you want.
Does this work for 4.3.4?

It is only made for 3.3.5 and 6.x (TC) and it be added to 4.3.4 as well. However it might need a bit of tweaking to do that.

43
Miscellaneous / Re: [QUESTION] Unsheathe aura
« on: July 10, 2015, 01:20:04 am »
And the one there should be is 6358.
Exactly why I said I couldnt find how they are linked : /

44
Miscellaneous / Re: [QUESTION] Unsheathe aura
« on: July 10, 2015, 12:52:22 am »
Hmm, seems the item is a spell visual.
Its not even positioned right in the hand to be like an equipped weapon. And the model is different from the item model.

Found it with ID 6358 in spellvisualeffectname.dbc

WIth some understanding and client editing I guess it could be possible to for example edit this spell to use some other item model or something.
Never really modded myself though. And dont see how the visual and the spell link together at all ..

45
Miscellaneous / Re: [TrinityCore] Max Level over 255?
« on: July 09, 2015, 11:08:09 pm »
There used to be servers where you could have 1000 level, but you would DC or crash a lot. ( the client )
And yes, they were arcemu from what I recall.

Anyways, it is possible to at least SHOW level 1000 or anything on the client.
However functionality with other packets might not work since the data might have the expected sizes like 8 bit etc.

The reason you can change the level is that it is one of the "uint32" values.
If you use for example .debug Mod32Value 54 6666, you can set the level to 6666
(this is for wotlk, the field might be different for other patches)

Example of output result with using huge numbers:



If you want something "original", why not scrap "levels" all together and make it be something else completely.
Like in darksouls its not level at all.

Pages: 1 2 [3] 4