English Lua Scripts/Questions/Help

89 replies
Goto Page
To the start Previous 1 2 3 4 5 Next To the start
14.10.10 07:20:38 am
Up
Mumu
User
Offline Off
I was wandering if its possible (no sprite) to make a invisible block coz it cold be very cool to make invisible stairs and stuff but it cold be still be "detected" by blood spatter or explosion craters ...
By the way whats the status on the fire extinguisher ?!?
My Eng. Suks so don't comment on my Gram. misstakes !!! IMG:http://www.walkover.org/files/walkbutton.gif
RULZ!
14.10.10 09:17:54 am
Up
Loooser
User
Offline Off
is there a second hook?
IMG:http://i45.tinypic.com/saus1e.jpg
14.10.10 11:38:55 am
Up
DC
Admin
Offline Off
mumu:
invisible objects: yes, that's possible. you have to use Lua scripted objects for that (see shield generator or explosives script). just don't do anything in the object draw function!
BUT: blood splatter, craters and other effects can not be rendered to invisible objects. that's technically not possible in carnage contest. they can only be rendered to terrain and terrain is always non-transparent.

loooser:
indirectly. you can use cc cmd getframe in combination with the modulo operator so your action is executed every 50 frames (50 frames = second). use this in your update function:
Code:
1
2
3
if (getframe()%50)==0 then
     -- your actions here
end

(untested)
www.UnrealSoftware.de | www.CS2D.com | www.CarnageContest.com | Use the forum & avoid PMs!
14.10.10 04:24:21 pm
Up
Loooser
User
Offline Off
Thank you, for the information

But does that also work for gamemodes?

by they way:
is there also a hook for end turn or better start turn?
how to make terrain indestructible?
IMG:http://i45.tinypic.com/saus1e.jpg
14.10.10 04:48:10 pm
Up
DannyDeth
User
Offline Off
loooser has written:
Thank you, for the information

But does that also work for gamemodes?

by they way:
is there also a hook for end turn or better start turn?
how to make terrain indestructible?


It does, all lua commands work in GAmeModes, so you can poosible make flying greands that explode on caontact! tha would be cool

EDIT: DC has implemented somehting, not sure thogh. I might be dreaming.
21.11.10 12:45:28 pm
Up
secritek
User
Offline Off
hi all, i made a weapon with script, everything fine, loaded and image in hand and weapon select menu is ok. But what i dont understand is shooting. if you press space for shoot so you have chance 1:6 in one round it will start shooting into youreself (like if you just delete : no collision with current player on start). i dont know what it is. please can anyone help?
IMG:http://i.imgur.com/0kd8i.png
21.11.10 12:55:35 pm
Up
DannyDeth
User
Offline Off
Here:
Code:
1
projectiles[id].ignore=playercurrent()

That should do the trick when placed intside the firing action.
21.11.10 01:53:21 pm
Up
Vectarrio
User
Offline Off
You changed speed of projectile but you didn't change initial movement, so, it moves directly through player more than 1 time.
21.11.10 02:11:37 pm
Up
secritek
User
Offline Off
@DanyDeth - i had that, i controlled it 2 times, that sentence was in script, but thanks for answer :).
@Vectar666 - thank you, it was by speed that i made ^^.
IMG:http://i.imgur.com/0kd8i.png
14.01.11 10:21:27 pm
Up
Vectarrio
User
Offline Off
Yes there is.
Chack playery and watery, if they are close, push player by absolute, push x=getplayerxspeed(i), push y=-getplayeryspeed(i)
where i is for loop variable.
14.01.11 10:23:09 pm
Up
Nem
User
Offline Off
Thanks.
damn there is no button to delete posts. Some idea came in my mind after like 1-2 min's after i post it. But i didnt thought about "push x=getplayerxspeed(i)"
11.08.11 03:43:48 pm
Up
Loooser
User
Offline Off
i have a problem

how do i find out what type an object has (the object is not in the same script) that is not an default object and has been created by an other script?

because i want to make that a weapon only attacks one special object ,and the only way to find this object is with the type

here is an example
Code:
1
2
3
4
5
6
7
8
9
10
--Here i try to find an object with this type but i dont know what i have to write as type
allobjects=objecttable()
for i=1,#allobjects do
if getobjecttype(allobjects[i])==cc.heli.object.id then -- now what do i write instead of cc.heli.object.id 
--or where do i find the type 

--do something

end
end


also some questions are:

Is the type a number or what else?

in the cc page you can find this info for objecttable()
Code:
1
2
3
4
5
6
7
8
objecttable([TYPE=0])
Parameters:     
[TYPE=0] - list objects of this type only (0 for all types)
Returns:     
OBJECT TABLE - a table containing object IDs
Returns a table/array which contains the IDs of objects in the game.

By default all object types are included. Use another value for TYPE to get a table which only contains objects of a certain type.


what do i have to write objecttable(here) if i only what objects with this type?

ps i hope you understand what i meant
edited 7×, last 23.08.11 02:33:03 pm
IMG:http://i45.tinypic.com/saus1e.jpg
23.08.11 02:41:31 pm
Up
DC
Admin
Offline Off
cc cmd addobject returns the required ID. it must be saved in a variable/table (otherwise there is no way to create instances of this object type).

simply use this variable for cc cmd objecttable or whereever you have to use the object type id.
www.UnrealSoftware.de | www.CS2D.com | www.CarnageContest.com | Use the forum & avoid PMs!
23.08.11 04:37:30 pm
Up
Loooser
User
Offline Off
does that mean what i am trying is impossible?

also is there a way to use varialbes from a other weapon script?
IMG:http://i45.tinypic.com/saus1e.jpg
23.08.11 04:38:18 pm
Up
DC
Admin
Offline Off
you didn't get me, right? of course it's possible and of course you can access variables of other weapon scripts. that's what I was talking about

but be careful: you shouldn't try to access variables from other weapons directly when the script is loaded (outside a CC function). this might lead to problems.
and you should also check if the used table is ~= nil because otherwise your script will cause a bug when the other weapon/object is currently not in the weaponset.
edited 1×, last 23.08.11 04:40:58 pm
www.UnrealSoftware.de | www.CS2D.com | www.CarnageContest.com | Use the forum & avoid PMs!
23.08.11 04:39:53 pm
Up
Loooser
User
Offline Off
sorry, im just a bit confused now
IMG:http://i45.tinypic.com/saus1e.jpg
23.08.11 04:42:12 pm
Up
DC
Admin
Offline Off
it's actually like writing ALL your weapon scripts into one single Lua file and executing this file. you can access all variables of all weapons.
www.UnrealSoftware.de | www.CS2D.com | www.CarnageContest.com | Use the forum & avoid PMs!
23.08.11 05:05:31 pm
Up
Loooser
User
Offline Off
is there any command to get a table of all projectiles ?
i didnt find it

is there a way to make a ai/bot hud position a weapon?
edited 3×, last 29.08.11 10:25:44 am
IMG:http://i45.tinypic.com/saus1e.jpg
To the start Previous 1 2 3 4 5 Next To the start