Forum

> > Carnage Contest > Lua Scripts/Questions/Help
Forums overviewCarnage Contest overviewLog in to reply

English Lua Scripts/Questions/Help

89 replies
Page
To the start Previous 1 2 3 4 5 Next To the start

old Re: Lua Scripts/Questions/Help

Mumu
User Off Offline

Quote
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 ?!?

old Re: Lua Scripts/Questions/Help

DC
Admin Off Offline

Quote
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:
1
2
3
if (getframe()%50)==0 then
	-- your actions here
end
(untested)

old Re: Lua Scripts/Questions/Help

Loooser
User Off Offline

Quote
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?

old Re: Lua Scripts/Questions/Help

DannyDeth
User Off Offline

Quote
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.

old Weapon Bug

secritek
User Off Offline

Quote
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?

old Re: Lua Scripts/Questions/Help

secritek
User Off Offline

Quote
@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 ^^.

old Re: Lua Scripts/Questions/Help

Vectarrio
User Off Offline

Quote
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.

old Re: Lua Scripts/Questions/Help

Nem
User Off Offline

Quote
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)"

old Re: Lua Scripts/Questions/Help

Loooser
User Off Offline

Quote
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
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()
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

old Re: Lua Scripts/Questions/Help

DC
Admin Off Offline

Quote
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.

old Re: Lua Scripts/Questions/Help

DC
Admin Off Offline

Quote
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

old Re: Lua Scripts/Questions/Help

DC
Admin Off Offline

Quote
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.

old Re: Lua Scripts/Questions/Help

Loooser
User Off Offline

Quote
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
To the start Previous 1 2 3 4 5 Next To the start
Log in to replyCarnage Contest overviewForums overview