English Two "?" about scripting.

8 replies
Goto Page
To the start Previous 1 Next To the start
01.09.21 02:47:30 pm
Up
Andrew12357
User
Offline Off
How do I block projectiles when they hit a barricade, like EnderCrypt's script?

Also, whenever a building is destroyed (made by players), it does not trigger the "break" hook, why? If there is a hook for this, please tell me!
01.09.21 03:36:53 pm
Up
Mami Tomoe
User
Offline Off
1. If the script is public, just look at the code.
2. Use the cs2d lua hook objectkill hook.
fish
01.09.21 04:19:59 pm
Up
Andrew12357
User
Offline Off
The script is not public.
01.09.21 04:53:51 pm
Up
Masea
Super User
Offline Off
Ask himself. He will surely be more than happy to answer that.
Shit your pants: file cs2d Outlast II Mod (29) | Create your UI faster: CS2D UI Framework
02.09.21 10:19:01 am
Up
Andrew12357
User
Offline Off
"objectkill" Does not return x and y pos, or the player ID that built the object, so I do not know who's supply is that.
02.09.21 11:41:05 am
Up
Bowlinghead
User
Offline Off
objectkill does not return anything. But the "objectid" or "id" parameter could be thing what you are looking for:
cs2d lua cmd object
cs2d lua hook objectkill
cs2d lua cmd objecttype
Code:
1
2
3
4
5
6
7
8
--untested
addhook("objectkill","OG")
function OG(oid, pid)
     msg("Type: "..objecttype(object(oid,"type"), "name"))
     msg("Owner: "..object(oid,"player"))
     msg("X: "..object(oid,"x"))
     msg("Y: "..object(oid,"y"))
end


Edit:
Note that the objecttype describes what it is like turret, etc.
What you get here instead, is a dynamic object id. Those exist for each turret, barricade, etc.
edited 1×, last 02.09.21 02:39:15 pm
Share time limited free games here
02.09.21 01:34:52 pm
Up
Andrew12357
User
Offline Off
Do objects have their own IDs when being destroyed?
02.09.21 01:52:58 pm
Up
Cure Pikachu
User
Offline Off
They do, that's what the first parameter in the cs2d lua hook objectkill hooked function is for.
IMG:https://i.imgur.com/uUrye71.png
IMG:https://i.imgur.com/xpsyQRX.png
02.09.21 03:33:07 pm
Up
Andrew12357
User
Offline Off
Alright then now I understand why I can upgrade barricades without having "upgraded barricades" researched.
To the start Previous 1 Next To the start