Week 14 Day 2 - Quake Modding III

Channel:
Subscribers:
2,640
Published on ● Video Link: https://www.youtube.com/watch?v=GojX-zhUcig



Duration: 1:30:51
31 views
0


Today we played more Quake and learned four things:


1) How to spawn an entity (an "actor" in UE4) with spawn(), and the different things we can set on this blank entity: origin, velocity, avelocity, movetype (what physics to use), touch, think, model, size, solid



2) dremove to delete an entity. If you make entities and don't delete them, the idTech engine will crash when its entity limit is hit.


3) findradius(origin,radius) returns a list of all entities with a location within 'radius' units of 'origin'. Very useful if you're going to be doing explosions and things like that. It returns a linked list, so if you don't know what that is, just copy/paste some code that uses findradius and change the inside of the loop.



4) .nextthink set on an entity will cause its .think function to be called at whatever time you put into nextthink. So for example, if you have a function called say_hi(), that will have the entity say hi, and you want it to activate 4.5 seconds from now, you could do this:



entity tmp = spawn();

tmp.nextthink = time + 4.5;
tmp.think = say_hi;


4.5 seconds after the current time, it calls say_hi, and then say_hi should probably finish with a dremove(self) to remove the timer. If you want it to repeat saying hi every 4.5 seconds, then have the function end with self.nextthink = time + 4.5; and it will say hi endlessly every 4.5 seconds.A lot of delayed action (like pulling the pin on a grenade) takes place in this way.







Tags:
is50a
quakec
quake modding
timers